Skip to content

Commit 187c848

Browse files
fix: update Cargo.lock and harden CI/release pipeline
- Fix stale Cargo.lock (was 2.0.1, now 2.1.0) - Add cargo update + --allow-dirty to release publish step - Add lockfile version consistency check to CI - Remove cross-compilation from PR pipeline (covered by release) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3b7e7e8 commit 187c848

4 files changed

Lines changed: 21 additions & 30 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ jobs:
1717
- uses: Swatinem/rust-cache@v2
1818
- run: cargo fmt --check
1919
- run: cargo clippy -- -D warnings
20+
lockfile:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v6
24+
- name: Verify Cargo.lock matches Cargo.toml
25+
run: |
26+
TOML_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
27+
LOCK_VERSION=$(sed -n '/^name = "initium"/{n;s/^version = "\(.*\)"/\1/p;}' Cargo.lock)
28+
if [ "$TOML_VERSION" != "$LOCK_VERSION" ]; then
29+
echo "::error::Cargo.toml version ($TOML_VERSION) does not match Cargo.lock version ($LOCK_VERSION). Run 'cargo update --workspace' and commit Cargo.lock."
30+
exit 1
31+
fi
2032
dprint:
2133
runs-on: ubuntu-latest
2234
steps:
@@ -29,33 +41,6 @@ jobs:
2941
- uses: dtolnay/rust-toolchain@stable
3042
- uses: Swatinem/rust-cache@v2
3143
- run: cargo test --all
32-
build:
33-
runs-on: ubuntu-latest
34-
needs: [lint, test]
35-
strategy:
36-
matrix:
37-
include:
38-
- target: x86_64-unknown-linux-musl
39-
arch: amd64
40-
- target: aarch64-unknown-linux-musl
41-
arch: arm64
42-
steps:
43-
- uses: actions/checkout@v6
44-
- uses: dtolnay/rust-toolchain@stable
45-
with:
46-
targets: ${{ matrix.target }}
47-
- name: Install zig and cargo-zigbuild
48-
run: pip install ziglang && curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash && cargo binstall -y cargo-zigbuild
49-
- uses: mozilla-actions/sccache-action@v0.0.9
50-
- name: Cross-compile for ${{ matrix.arch }}
51-
run: cargo zigbuild --release --target ${{ matrix.target }}
52-
env:
53-
SCCACHE_GHA_ENABLED: "true"
54-
RUSTC_WRAPPER: sccache
55-
- uses: actions/upload-artifact@v7
56-
with:
57-
name: initium-${{ matrix.arch }}
58-
path: target/${{ matrix.target }}/release/initium
5944
helm-lint:
6045
runs-on: ubuntu-latest
6146
steps:
@@ -67,7 +52,7 @@ jobs:
6752
- run: helm unittest charts/initium
6853
ci:
6954
if: always()
70-
needs: [lint, test, build, helm-lint, dprint]
55+
needs: [lint, test, helm-lint, dprint, lockfile]
7156
runs-on: ubuntu-latest
7257
steps:
7358
- run: |

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,11 @@ jobs:
136136
steps:
137137
- uses: actions/checkout@v6
138138
- uses: dtolnay/rust-toolchain@stable
139+
- name: Ensure Cargo.lock is up to date
140+
run: cargo update --workspace
139141
- name: Publish to crates.io
140142
run: |
141-
cargo publish 2>&1 || {
143+
cargo publish --allow-dirty 2>&1 || {
142144
if cargo search initium --limit 1 | grep -q "$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')"; then
143145
echo "::warning::Version already published to crates.io — skipping"
144146
else

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Release workflow: `cargo publish` failed when `Cargo.lock` was stale. Added an explicit `cargo update --workspace` step before publish to ensure lockfile consistency.
13+
1014
## [2.1.0] - 2026-03-14
1115

1216
### Added

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)