Skip to content

Commit fa59883

Browse files
authored
CI: Enable try-runtime idempotency check (polkadot-fellows#133)
Enable one more check in the CI to ensure that our migrations are idempotent. Can only merge after polkadot-fellows#118 --------- Signed-off-by: Oliver Tale-Yazdi <[email protected]>
1 parent 98872cb commit fa59883

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

.github/workflows/check-migrations.yml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747

4848
- name: Download try-runtime-cli
4949
run: |
50-
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.5.0/try-runtime-x86_64-unknown-linux-musl -o try-runtime
50+
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.5.2/try-runtime-x86_64-unknown-linux-musl -o try-runtime
5151
chmod +x ./try-runtime
5252
5353
- name: Install Protoc
@@ -60,21 +60,43 @@ jobs:
6060

6161
- name: Build ${{ matrix.runtime.name }}
6262
run: |
63-
cargo build --profile production -p ${{ matrix.runtime.package }} --features try-runtime
63+
cargo build --profile production -p ${{ matrix.runtime.package }} --features try-runtime -q --locked
6464
6565
- name: Check migrations
6666
run: |
6767
PACKAGE_NAME=${{ matrix.runtime.package }}
6868
RUNTIME_BLOB_NAME=$(echo $PACKAGE_NAME | sed 's/-/_/g').compact.compressed.wasm
69+
RUNTIME_BLOB_PATH=./target/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME
70+
6971
# When running on relay, we don't need weight checks.
70-
NO_WEIGHT_WARNINGS_FLAG=""
72+
EXTRA_FLAGS=""
7173
if [[ "${{ matrix.runtime.is_relay }}" == "true" ]]; then
72-
NO_WEIGHT_WARNINGS_FLAG="--no-weight-warnings"
74+
EXTRA_FLAGS+="--no-weight-warnings"
75+
echo "Disabling weight checks since we are on a relay"
76+
else
77+
echo "Enabling weight checks since we are not on a relay"
78+
fi
79+
80+
# Disable the spec version check when we dont want to release.
81+
if ! .github/changelog-processor.py CHANGELOG.md --should-release ; then
82+
EXTRA_FLAGS+=" --disable-spec-version-check"
83+
echo "Disabling the spec version check since we are not releasing"
84+
else
85+
echo "Enabling the spec version check since we are releasing"
7386
fi
74-
# Disable idempotency checks for now because the Scheduler pallet MigrateToV1 migration is
75-
# non-idempotent at its root in Polkadot SDK V1.2.0. In V1.3.0 we can re-enable
76-
# idempotency checks.
77-
EXTRA_ARGS="--disable-spec-version-check --disable-idempotency-checks"
87+
88+
# Disable idemepotency checks on Polkadot until we enact them.
89+
if [[ "${{ matrix.runtime.name }}" == "polkadot" ]]; then
90+
echo "Disabling the idempotency check since we are on Polkadot"
91+
EXTRA_FLAGS+=" --disable-idempotency-checks"
92+
else
93+
echo "Enabling the idempotency check since we are not on Polkadot"
94+
fi
95+
96+
echo "Flags: $EXTRA_FLAGS"
97+
7898
./try-runtime \
79-
--runtime ./target/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME \
80-
on-runtime-upgrade --checks=pre-and-post $EXTRA_ARGS $NO_WEIGHT_WARNINGS_FLAG live --uri ${{ matrix.runtime.uri }}
99+
--runtime $RUNTIME_BLOB_PATH \
100+
on-runtime-upgrade --checks=pre-and-post \
101+
$EXTRA_FLAGS \
102+
live --uri ${{ matrix.runtime.uri }}

0 commit comments

Comments
 (0)