From 3a2c10647c7722511e17ee5ac9ae3e073f1479e2 Mon Sep 17 00:00:00 2001 From: Kumar Ujjawal Date: Wed, 2 Jul 2025 19:53:21 +0530 Subject: [PATCH 1/5] Run cargo semvar checks on PR --- .github/workflows/semvar-checks.yaml | 59 ++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/semvar-checks.yaml diff --git a/.github/workflows/semvar-checks.yaml b/.github/workflows/semvar-checks.yaml new file mode 100644 index 00000000..9983b5ba --- /dev/null +++ b/.github/workflows/semvar-checks.yaml @@ -0,0 +1,59 @@ +name: Cargo Semver Checks + +on: + pull_request: + push: + workflow_dispatch: + schedule: + - cron: "0 2 * * *" + +env: + CARGO_TERM_COLOR: always + CI: true + SCCACHE_GHA_ENABLED: true + RUSTC_WRAPPER: sccache + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + semver-check: + if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository + name: Semver compatibility check + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + + - name: Cache Cargo registry + uses: Swatinem/rust-cache@v2 + with: + shared-key: 'rust-semver' + cache-bin: 'false' + + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.9 + + - name: Install cargo-semver-checks + run: cargo install cargo-semver-checks --locked + + - name: Find latest tag + id: get_tag + run: | + git fetch --tags + echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT + + - name: Build previous release (latest tag) + run: | + git checkout ${{ steps.get_tag.outputs.tag }} + cargo build --release + git checkout ${{ github.sha }} + + - name: Run cargo-semver-checks + run: cargo semver-checks check-release From f5fbf1a982f4ee38efa06a8006628616987d5ed3 Mon Sep 17 00:00:00 2001 From: Kumar Ujjawal Date: Wed, 2 Jul 2025 20:21:16 +0530 Subject: [PATCH 2/5] added semvar check in RustCI workflow --- .github/workflows/rust.yml | 42 ++++++++++++++++++++ .github/workflows/semvar-checks.yaml | 59 ---------------------------- 2 files changed, 42 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/semvar-checks.yaml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b43392af..b1a66f2f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -374,3 +374,45 @@ jobs: with: log-level: warn command: check licenses + + semver-check: + if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository + + name: Semver compatibility check + runs-on: ubuntu-latest + needs: ["build"] + steps: + - name: Checkout source + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + + - name: Cache Cargo registry + uses: Swatinem/rust-cache@v2 + with: + shared-key: 'rust-semver' + cache-bin: 'false' + + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.9 + + - name: Install cargo-semver-checks + run: cargo install cargo-semver-checks --locked + + - name: Find latest tag + id: get_tag + run: | + git fetch --tags + echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT + + - name: Build previous release (latest tag) + run: | + git checkout ${{ steps.get_tag.outputs.tag }} + cargo build --release + git checkout ${{ github.sha }} + + - name: Run cargo-semver-checks + run: cargo semver-checks check-release diff --git a/.github/workflows/semvar-checks.yaml b/.github/workflows/semvar-checks.yaml deleted file mode 100644 index 9983b5ba..00000000 --- a/.github/workflows/semvar-checks.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: Cargo Semver Checks - -on: - pull_request: - push: - workflow_dispatch: - schedule: - - cron: "0 2 * * *" - -env: - CARGO_TERM_COLOR: always - CI: true - SCCACHE_GHA_ENABLED: true - RUSTC_WRAPPER: sccache - -concurrency: - group: ${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - -jobs: - semver-check: - if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository - name: Semver compatibility check - runs-on: ubuntu-latest - steps: - - name: Checkout source - uses: actions/checkout@v4 - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - - - name: Cache Cargo registry - uses: Swatinem/rust-cache@v2 - with: - shared-key: 'rust-semver' - cache-bin: 'false' - - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.9 - - - name: Install cargo-semver-checks - run: cargo install cargo-semver-checks --locked - - - name: Find latest tag - id: get_tag - run: | - git fetch --tags - echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT - - - name: Build previous release (latest tag) - run: | - git checkout ${{ steps.get_tag.outputs.tag }} - cargo build --release - git checkout ${{ github.sha }} - - - name: Run cargo-semver-checks - run: cargo semver-checks check-release From 6d396d667a598d22862601519d775ef176f3e17c Mon Sep 17 00:00:00 2001 From: Kumar Ujjawal Date: Thu, 3 Jul 2025 21:34:27 +0530 Subject: [PATCH 3/5] using official Github actions for semvar checks --- .github/workflows/rust.yml | 40 +++++++++----------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b1a66f2f..3e98ab96 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -376,43 +376,21 @@ jobs: command: check licenses semver-check: - if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository - + if: github.event_name == 'pull_request' name: Semver compatibility check runs-on: ubuntu-latest needs: ["build"] + steps: - name: Checkout source uses: actions/checkout@v4 - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master with: - toolchain: stable - - - name: Cache Cargo registry - uses: Swatinem/rust-cache@v2 - with: - shared-key: 'rust-semver' - cache-bin: 'false' - - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.9 - - - name: Install cargo-semver-checks - run: cargo install cargo-semver-checks --locked - - - name: Find latest tag - id: get_tag - run: | - git fetch --tags - echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT - - - name: Build previous release (latest tag) - run: | - git checkout ${{ steps.get_tag.outputs.tag }} - cargo build --release - git checkout ${{ github.sha }} + fetch-depth: 0 - name: Run cargo-semver-checks - run: cargo semver-checks check-release + uses: obi1kenobi/cargo-semver-checks-action@v2.8 + with: + rust-toolchain: stable + baseline-rev: ${{ github.event.pull_request.base.sha }} + feature-group: all-features + verbose: true From 06d75faee57e654eda1c7cf0388cb153889ad3de Mon Sep 17 00:00:00 2001 From: Kumar Ujjawal Date: Thu, 3 Jul 2025 22:04:28 +0530 Subject: [PATCH 4/5] fixed sccache issue with semvar check --- .github/workflows/rust.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3e98ab96..009c8adb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -381,6 +381,10 @@ jobs: runs-on: ubuntu-latest needs: ["build"] + env: + RUSTC_WRAPPER: "" + SCCACHE_GHA_ENABLED: "" + steps: - name: Checkout source uses: actions/checkout@v4 From d4a0ef6196afb076b24d8ca6e188506bdbd86069 Mon Sep 17 00:00:00 2001 From: Kumar Ujjawal Date: Sat, 5 Jul 2025 09:36:58 +0530 Subject: [PATCH 5/5] fixed env issues --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 009c8adb..74e1ade2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -382,8 +382,8 @@ jobs: needs: ["build"] env: - RUSTC_WRAPPER: "" - SCCACHE_GHA_ENABLED: "" + RUSTC_WRAPPER: "" + SCCACHE_GHA_ENABLED: "" steps: - name: Checkout source