Skip to content

Commit

Permalink
[CI] Cache try-runtime check (#5179)
Browse files Browse the repository at this point in the history
Adds a snapshot step to the try-runtime check that tries to download a
cached snapshot.
The cache is valid for the current day and is otherwise re-created.

Check is now only limited by build time and docker startup.

![Screenshot 2024-07-30 at 02 02
58](https://github.com/user-attachments/assets/0773e9b9-4a52-4572-a891-74b9d725ba70)

![Screenshot 2024-07-30 at 02 02
20](https://github.com/user-attachments/assets/4685ef17-a04c-4bdc-9d61-311d0010f71c)

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
ggwpez authored Jul 30, 2024
1 parent 4ffa9b8 commit 686ee99
Showing 1 changed file with 36 additions and 9 deletions.
45 changes: 36 additions & 9 deletions .github/workflows/check-runtime-migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
merge_group:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand All @@ -27,7 +29,9 @@ jobs:
# rococo and westend are disabled for now (no access to parity-chains.parity.io)
check-runtime-migration:
runs-on: arc-runners-polkadot-sdk-beefy
timeout-minutes: 40
# We need to set this to rather long to allow the snapshot to be created, but the average time
# should be much lower.
timeout-minutes: 60
needs: [set-image]
container:
image: ${{ needs.set-image.outputs.IMAGE }}
Expand Down Expand Up @@ -94,22 +98,45 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: script
run: |
echo "Running ${{ matrix.network }} runtime migration check"
export RUST_LOG=remote-ext=debug,runtime=debug

echo "---------- Downloading try-runtime CLI ----------"
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.5.4/try-runtime-x86_64-unknown-linux-musl -o try-runtime
- name: Download CLI
run: |
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.7.0/try-runtime-x86_64-unknown-linux-musl -o try-runtime
chmod +x ./try-runtime
echo "Using try-runtime-cli version:"
./try-runtime --version
- name: Get Date
id: get-date
run: |
echo "today=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
shell: bash

- name: Download Snapshot
uses: actions/cache@v4
with:
path: snapshot.raw
key: try-runtime-snapshot-${{ matrix.network }}-${{ steps.get-date.outputs.today }}
save-always: true

- name: Create Snapshot If Stale
if: ${{ hashFiles('snapshot.raw') == '' }}
run: |
echo "Creating new snapshot for today (${{ steps.get-date.outputs.today }})"
./try-runtime create-snapshot --uri ${{ matrix.uri }} snapshot.raw
- name: Build Runtime
run: |
echo "---------- Building ${{ matrix.package }} runtime ----------"
time forklift cargo build --release --locked -p ${{ matrix.package }} --features try-runtime
time forklift cargo build --release --locked -p ${{ matrix.package }} --features try-runtime -q
- name: Run Check
run: |
echo "Running ${{ matrix.network }} runtime migration check"
export RUST_LOG=remote-ext=debug,runtime=debug
echo "---------- Executing on-runtime-upgrade for ${{ matrix.network }} ----------"
time ./try-runtime ${{ matrix.command_extra_args }} \
--runtime ./target/release/wbuild/${{ matrix.package }}/${{ matrix.wasm }} \
on-runtime-upgrade --disable-spec-version-check --checks=all ${{ matrix.subcommand_extra_args }} live --uri ${{ matrix.uri }}
on-runtime-upgrade --disable-spec-version-check --checks=all ${{ matrix.subcommand_extra_args }} snap -p snapshot.raw
sleep 5

0 comments on commit 686ee99

Please sign in to comment.