fix: update Cargo.lock and harden CI/release pipeline #144
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, rustfmt | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo fmt --check | |
| - run: cargo clippy -- -D warnings | |
| lockfile: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Verify Cargo.lock matches Cargo.toml | |
| run: | | |
| TOML_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/') | |
| LOCK_VERSION=$(sed -n '/^name = "initium"/{n;s/^version = "\(.*\)"/\1/p;}' Cargo.lock) | |
| if [ "$TOML_VERSION" != "$LOCK_VERSION" ]; then | |
| echo "::error::Cargo.toml version ($TOML_VERSION) does not match Cargo.lock version ($LOCK_VERSION). Run 'cargo update --workspace' and commit Cargo.lock." | |
| exit 1 | |
| fi | |
| dprint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dprint/check@v2.3 | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo test --all | |
| helm-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: azure/setup-helm@v4 | |
| - run: helm plugin install --verify=false https://github.com/helm-unittest/helm-unittest.git --version v0.5.1 | |
| - run: helm lint charts/initium | |
| - run: helm template test-release charts/initium --set sampleDeployment.enabled=true --set 'initContainers[0].name=wait' --set 'initContainers[0].command[0]=wait-for' --set 'initContainers[0].args[0]=--target' --set 'initContainers[0].args[1]=tcp://localhost:5432' | |
| - run: helm unittest charts/initium | |
| ci: | |
| if: always() | |
| needs: [lint, test, helm-lint, dprint, lockfile] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: | | |
| if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then | |
| echo "One or more jobs failed or were cancelled" | |
| exit 1 | |
| fi |