Skip to content

Commit 6e0a8cb

Browse files
authored
CI: Add semver-checks to publish workflow (#333)
#### Problem The semver checks job has been failing for a long time, because it's running on every single pull request. #### Summary of changes Just like the other program repos, move the checks to the publish step
1 parent e64df66 commit 6e0a8cb

File tree

2 files changed

+51
-26
lines changed

2 files changed

+51
-26
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -249,27 +249,6 @@ jobs:
249249
- name: Run cargo-audit
250250
run: pnpm rust:audit
251251

252-
semver_rust:
253-
name: Check semver Rust
254-
runs-on: ubuntu-latest
255-
steps:
256-
- name: Git Checkout
257-
uses: actions/checkout@v4
258-
259-
- name: Setup Environment
260-
uses: ./.github/actions/setup
261-
with:
262-
cli: true
263-
cargo-cache-key: cargo-semver
264-
265-
- name: Install cargo-semver-checks
266-
uses: taiki-e/install-action@v2
267-
with:
268-
tool: cargo-semver-checks
269-
270-
- name: Run semver checks
271-
run: pnpm rust:semver
272-
273252
spellcheck_rust:
274253
name: Spellcheck Rust
275254
runs-on: ubuntu-latest

.github/workflows/publish-rust.yml

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@ on:
66
package_path:
77
description: Path to directory with package to release
88
required: true
9-
type: string
9+
default: 'clients/cli'
10+
type: choice
11+
options:
12+
- clients/cli
13+
- clients/rust-legacy
14+
- confidential-transfer/ciphertext-arithmetic
15+
- confidential-transfer/elgamal-registry
16+
- confidential-transfer/proof-extraction
17+
- confidential-transfer/proof-generation
18+
- confidential-transfer/proof-tests
19+
- program
1020
level:
1121
description: Level
1222
required: true
@@ -70,10 +80,45 @@ jobs:
7080
- name: Test
7181
run: pnpm zx ./scripts/rust/test.mjs "${{ inputs.package_path }}"
7282

83+
semver:
84+
name: Check Semver
85+
runs-on: ubuntu-latest
86+
steps:
87+
- name: Git checkout
88+
uses: actions/checkout@v4
89+
90+
- name: Setup Environment
91+
uses: ./.github/actions/setup
92+
with:
93+
cargo-cache-key: cargo-publish-semver-${{ inputs.package_path }}
94+
cargo-cache-fallback-key: cargo-publish-semver
95+
96+
- name: Install cargo-semver-checks
97+
uses: taiki-e/install-action@v2
98+
with:
99+
tool: cargo-semver-checks,cargo-release
100+
101+
- name: Set Git Author (required for cargo-release)
102+
run: |
103+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
104+
git config --global user.name "github-actions[bot]"
105+
106+
- name: Set Version
107+
run: |
108+
if [ "${{ inputs.level }}" == "version" ]; then
109+
LEVEL=${{ inputs.version }}
110+
else
111+
LEVEL=${{ inputs.level }}
112+
fi
113+
cargo release $LEVEL --manifest-path "${{ inputs.package_path }}/Cargo.toml" --no-tag --no-publish --no-push --no-confirm --execute
114+
115+
- name: Check semver
116+
run: pnpm rust:semver --manifest-path "${{ inputs.package_path }}/Cargo.toml"
117+
73118
publish:
74119
name: Publish Rust Crate
75120
runs-on: ubuntu-latest
76-
needs: test
121+
needs: [test, semver]
77122
permissions:
78123
contents: write
79124
steps:
@@ -86,12 +131,13 @@ jobs:
86131
- name: Setup Environment
87132
uses: ./.github/actions/setup
88133
with:
89-
cli: true
90134
cargo-cache-key: cargo-publish-${{ inputs.package_path }}
91135
cargo-cache-fallback-key: cargo-publish
92136

93-
- name: Install Cargo Release
94-
run: which cargo-release || cargo install cargo-release
137+
- name: Install cargo-release
138+
uses: taiki-e/install-action@v2
139+
with:
140+
tool: cargo-release
95141

96142
- name: Ensure CARGO_REGISTRY_TOKEN variable is set
97143
env:

0 commit comments

Comments
 (0)