Skip to content

Commit d21a1d3

Browse files
authored
CI: Fix semver check job (#118)
#### Problem The semver check job isn't properly bumping to the new proposed version before running, causing false negatives. #### Summary of changes Bring this repo's job in line with the others, which runs cargo release to bump the version before running semver-checks.
1 parent f112a71 commit d21a1d3

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

.github/workflows/publish-rust.yml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ jobs:
5555
cargo-cache-key: cargo-test-publish-${{ inputs.package_path }}
5656
cargo-cache-fallback-key: cargo-test-publish
5757

58-
- name: Install cargo-audit
59-
uses: taiki-e/install-action@v2
60-
with:
61-
tool: cargo-semver-checks
62-
6358
- name: Format
6459
run: pnpm zx ./scripts/rust/format.mjs "${{ inputs.package_path }}"
6560

@@ -69,13 +64,45 @@ jobs:
6964
- name: Test
7065
run: pnpm zx ./scripts/rust/test.mjs "${{ inputs.package_path }}"
7166

67+
semver:
68+
name: Check Semver
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Git checkout
72+
uses: actions/checkout@v4
73+
74+
- name: Setup Environment
75+
uses: ./.github/actions/setup
76+
with:
77+
cargo-cache-key: cargo-publish-semver-${{ inputs.package_path }}
78+
cargo-cache-fallback-key: cargo-publish-semver
79+
80+
- name: Install cargo-semver-checks
81+
uses: taiki-e/install-action@v2
82+
with:
83+
tool: cargo-semver-checks,cargo-release
84+
85+
- name: Set Git Author (required for cargo-release)
86+
run: |
87+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
88+
git config --global user.name "github-actions[bot]"
89+
90+
- name: Set Version
91+
run: |
92+
if [ "${{ inputs.level }}" == "version" ]; then
93+
LEVEL=${{ inputs.version }}
94+
else
95+
LEVEL=${{ inputs.level }}
96+
fi
97+
cargo release $LEVEL --manifest-path "${{ inputs.package_path }}/Cargo.toml" --no-tag --no-publish --no-push --no-confirm --execute
98+
7299
- name: Check semver
73-
run: pnpm rust:semver ${{ inputs.package_path }} --release-type ${{ inputs.level }}
100+
run: pnpm rust:semver --manifest-path "${{ inputs.package_path }}/Cargo.toml"
74101

75102
publish:
76103
name: Publish Rust Crate
77104
runs-on: ubuntu-latest
78-
needs: test
105+
needs: [semver, test]
79106
permissions:
80107
contents: write
81108
steps:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"rust:audit": "zx ./scripts/rust/audit.mjs",
4141
"rust:publish": "zx ./scripts/rust/publish.mjs",
4242
"rust:hack": "zx ./scripts/rust/hack.mjs",
43-
"rust:semver": "zx ./scripts/rust/semver.mjs"
43+
"rust:semver": "cargo semver-checks"
4444
},
4545
"devDependencies": {
4646
"@iarna/toml": "^2.2.5",

scripts/rust/semver.mjs

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)