Small fixes #50612
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: check-runtime-migration | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| # Take a snapshot at 5am when most SDK devs are not working. | |
| schedule: | |
| - cron: "0 5 * * *" | |
| merge_group: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| isdraft: | |
| uses: ./.github/workflows/reusable-isdraft.yml | |
| preflight: | |
| needs: isdraft | |
| uses: ./.github/workflows/reusable-preflight.yml | |
| # Prepare snapshots for all networks. Runs before the actual migration checks. | |
| # For scheduled runs: always create fresh snapshots. | |
| # For PRs: use cached snapshots if available, create if not. | |
| prepare-snapshots: | |
| runs-on: ubuntu-latest | |
| needs: [preflight] | |
| if: ${{ needs.preflight.outputs.changes_rust }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| network: | |
| [ | |
| westend, | |
| asset-hub-westend, | |
| bridge-hub-westend, | |
| collectives-westend, | |
| coretime-westend, | |
| ] | |
| include: | |
| - network: westend | |
| uri: "wss://try-runtime-westend.polkadot.io:443" | |
| - network: asset-hub-westend | |
| uri: "wss://westend-asset-hub-rpc.polkadot.io:443" | |
| - network: bridge-hub-westend | |
| uri: "wss://westend-bridge-hub-rpc.polkadot.io:443" | |
| - network: collectives-westend | |
| uri: "wss://westend-collectives-rpc.polkadot.io:443" | |
| - network: coretime-westend | |
| uri: "wss://westend-coretime-rpc.polkadot.io:443" | |
| steps: | |
| - name: Check if snapshot exists in cache | |
| id: cache-restore | |
| if: ${{ github.event_name != 'schedule' }} | |
| uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| with: | |
| lookup-only: true | |
| path: snapshot.raw | |
| key: try-runtime-snapshot-${{ matrix.network }}- | |
| fail-on-cache-miss: false | |
| - name: Download CLI | |
| if: ${{ steps.cache-restore.outputs.cache-matched-key == '' }} | |
| run: | | |
| curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.10.1/try-runtime-x86_64-unknown-linux-musl -o try-runtime | |
| chmod +x ./try-runtime | |
| ./try-runtime --version | |
| - name: Generate snapshot for ${{ matrix.network }} | |
| if: ${{ steps.cache-restore.outputs.cache-matched-key == '' }} | |
| run: | | |
| echo "Generating snapshot for ${{ matrix.network }}..." | |
| for i in {1..10}; do | |
| echo "Snapshot creation attempt $i/10" | |
| if ./try-runtime create-snapshot --uri ${{ matrix.uri }} -- snapshot.raw; then | |
| if [ -f "snapshot.raw" ] && [ -s "snapshot.raw" ]; then | |
| echo "Snapshot created successfully" | |
| break | |
| fi | |
| fi | |
| echo "Snapshot creation failed, attempt $i/10" | |
| rm -f snapshot.raw | |
| if [ $i -eq 10 ]; then | |
| echo "All snapshot creation attempts failed" | |
| exit 1 | |
| fi | |
| sleep 10 | |
| done | |
| - name: Get Date | |
| id: get-date | |
| if: ${{ steps.cache-restore.outputs.cache-matched-key == '' }} | |
| run: | | |
| echo "today=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | |
| - name: Save snapshot to cache | |
| if: ${{ steps.cache-restore.outputs.cache-matched-key == '' }} | |
| uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| with: | |
| path: snapshot.raw | |
| key: try-runtime-snapshot-${{ matrix.network }}-${{ steps.get-date.outputs.today }} | |
| # More info can be found here: https://github.com/paritytech/polkadot/pull/5865 | |
| check-runtime-migration: | |
| runs-on: ${{ needs.preflight.outputs.RUNNER }} | |
| if: ${{ needs.preflight.outputs.changes_rust && github.event_name != 'schedule' }} | |
| timeout-minutes: 120 | |
| needs: [preflight, prepare-snapshots] | |
| container: | |
| image: ${{ needs.preflight.outputs.IMAGE }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| network: | |
| [ | |
| westend, | |
| asset-hub-westend, | |
| bridge-hub-westend, | |
| collectives-westend, | |
| coretime-westend, | |
| ] | |
| include: | |
| - network: westend | |
| package: westend-runtime | |
| wasm: westend_runtime.compact.compressed.wasm | |
| subcommand_extra_args: "--no-weight-warnings --blocktime 6000" | |
| command_extra_args: "" | |
| - network: asset-hub-westend | |
| package: asset-hub-westend-runtime | |
| wasm: asset_hub_westend_runtime.compact.compressed.wasm | |
| subcommand_extra_args: " --blocktime 6000" | |
| command_extra_args: "" | |
| - network: bridge-hub-westend | |
| package: bridge-hub-westend-runtime | |
| wasm: bridge_hub_westend_runtime.compact.compressed.wasm | |
| subcommand_extra_args: " --blocktime 6000" | |
| command_extra_args: "" | |
| - network: collectives-westend | |
| package: collectives-westend-runtime | |
| wasm: collectives_westend_runtime.compact.compressed.wasm | |
| command_extra_args: "--disable-spec-name-check" | |
| subcommand_extra_args: " --blocktime 6000" | |
| - network: coretime-westend | |
| package: coretime-westend-runtime | |
| wasm: coretime_westend_runtime.compact.compressed.wasm | |
| subcommand_extra_args: " --blocktime 6000" | |
| command_extra_args: "" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Download CLI | |
| run: | | |
| curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.10.1/try-runtime-x86_64-unknown-linux-musl -o try-runtime | |
| chmod +x ./try-runtime | |
| echo "Using try-runtime-cli version:" | |
| ./try-runtime --version | |
| - name: Restore snapshot from cache | |
| uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| with: | |
| path: snapshot.raw | |
| key: try-runtime-snapshot-${{ matrix.network }}- | |
| fail-on-cache-miss: true | |
| - name: Build Runtime | |
| id: required1 | |
| run: | | |
| echo "---------- Building ${{ matrix.package }} runtime ----------" | |
| forklift cargo build --release --locked -p ${{ matrix.package }} --features try-runtime -q | |
| - name: Run Check | |
| id: required2 | |
| run: | | |
| echo "Running ${{ matrix.network }} runtime migration check" | |
| export RUST_LOG=remote-ext=debug,runtime=debug | |
| echo "---------- Executing on-runtime-upgrade for ${{ matrix.network }} ----------" | |
| ./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 }} snap -p snapshot.raw | |
| sleep 5 | |
| - name: Stop all workflows if failed | |
| if: ${{ failure() && (steps.required1.conclusion == 'failure' || steps.required2.conclusion == 'failure') }} | |
| uses: ./.github/actions/workflow-stopper | |
| with: | |
| app-id: ${{ secrets.WORKFLOW_STOPPER_RUNNER_APP_ID }} | |
| app-key: ${{ secrets.WORKFLOW_STOPPER_RUNNER_APP_KEY }} | |
| # name of this job must be unique across all workflows | |
| # otherwise GitHub will mark all these jobs as required | |
| confirm-required-checks-passed: | |
| runs-on: ubuntu-latest | |
| name: All runtime migrations passed | |
| # If any new job gets added, be sure to add it to this array | |
| needs: [check-runtime-migration] | |
| if: always() && !cancelled() && github.event_name != 'schedule' | |
| steps: | |
| - run: | | |
| tee resultfile <<< '${{ toJSON(needs) }}' | |
| FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) | |
| if [ $FAILURES -gt 0 ]; then | |
| echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| else | |
| echo '### Good job! All the required jobs passed 🚀' >> $GITHUB_STEP_SUMMARY | |
| fi |