From c6748a637cfccd15fa14064563770ccca6d0ae10 Mon Sep 17 00:00:00 2001 From: Assem Hasna Date: Wed, 13 Dec 2023 09:20:38 +0100 Subject: [PATCH 1/3] =?UTF-8?q?chore:=20add=20runtime=20version=20check=20?= =?UTF-8?q?=F0=9F=91=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/_03_release_checks.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_03_release_checks.yml b/.github/workflows/_03_release_checks.yml index 43bb2a78b5..8f077d64c1 100644 --- a/.github/workflows/_03_release_checks.yml +++ b/.github/workflows/_03_release_checks.yml @@ -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 From efa5a33fab4fd608e914c9695e430ce58c2d7916 Mon Sep 17 00:00:00 2001 From: Assem Hasna Date: Wed, 13 Dec 2023 09:40:50 +0100 Subject: [PATCH 2/3] =?UTF-8?q?chore:=20check=20spec=20version=20?= =?UTF-8?q?=F0=9F=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/_03_release_checks.yml | 10 ++++++++++ ci/scripts/check_runtime_spec_version.sh | 14 ++++++++++++++ 2 files changed, 24 insertions(+) create mode 100755 ci/scripts/check_runtime_spec_version.sh diff --git a/.github/workflows/_03_release_checks.yml b/.github/workflows/_03_release_checks.yml index 8f077d64c1..4225db381b 100644 --- a/.github/workflows/_03_release_checks.yml +++ b/.github/workflows/_03_release_checks.yml @@ -68,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 }} diff --git a/ci/scripts/check_runtime_spec_version.sh b/ci/scripts/check_runtime_spec_version.sh new file mode 100755 index 0000000000..f052ab5a00 --- /dev/null +++ b/ci/scripts/check_runtime_spec_version.sh @@ -0,0 +1,14 @@ +#!/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 ',') + +# 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 From 512a99712d47a71c730d0f8731913de5843fb82c Mon Sep 17 00:00:00 2001 From: Assem Hasna Date: Wed, 13 Dec 2023 11:46:23 +0100 Subject: [PATCH 3/3] chore: check runtime against cargo.toml version --- ci/scripts/check_runtime_spec_version.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ci/scripts/check_runtime_spec_version.sh b/ci/scripts/check_runtime_spec_version.sh index f052ab5a00..708cedbfe6 100755 --- a/ci/scripts/check_runtime_spec_version.sh +++ b/ci/scripts/check_runtime_spec_version.sh @@ -7,8 +7,15 @@ 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