Skip to content

Commit

Permalink
chore: add runtime version check 👀 (#4344)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahasna committed Dec 13, 2023
1 parent 2e0efa1 commit fea5d05
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/_03_release_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
manifest: [state-chain/node/Cargo.toml, engine/Cargo.toml, api/bin/chainflip-cli/Cargo.toml, api/bin/chainflip-broker-api/Cargo.toml, api/bin/chainflip-lp-api/Cargo.toml]
manifest:
- state-chain/node/Cargo.toml
- engine/Cargo.toml
- api/bin/chainflip-cli/Cargo.toml
- api/bin/chainflip-broker-api/Cargo.toml
- api/bin/chainflip-lp-api/Cargo.toml
- state-chain/runtime/Cargo.toml
steps:
- name: Checkout 🏁
uses: actions/checkout@v3
Expand Down Expand Up @@ -62,3 +68,13 @@ jobs:
- name: Check changelog 📝
shell: bash
run: ./ci/scripts/check_changelog.sh ${{ inputs.tag }}

check-runtime-spec-version:
runs-on: ubuntu-latest
steps:
- name: Checkout 🏁
uses: actions/checkout@v3

- name: Check changelog 📝
shell: bash
run: ./ci/scripts/check_runtime_spec_version.sh ${{ inputs.tag }}
21 changes: 21 additions & 0 deletions ci/scripts/check_runtime_spec_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

version=$1
runtime_spec_version_file="state-chain/runtime/src/lib.rs"
numeric_version=$(echo $version | tr -d '.')

# Extract the spec_version from the Rust file
spec_version=$(grep 'spec_version:' $runtime_spec_version_file | awk '{print $2}' | tr -d ',')

runtime_version=$(cargo read-manifest --manifest-path state-chain/runtime/Cargo.toml | jq -r .version)

# Compare versions
if [ "$spec_version" != "$numeric_version" ]; then
echo "Error: spec_version ($spec_version) does not match the expected version ($numeric_version)"
exit 1
fi

if [ "$runtime_version" != "$version" ]; then
echo "Error: runtime version ($runtime_version) does not match the expected version ($version)"
exit 1
fi

0 comments on commit fea5d05

Please sign in to comment.