Split renew into separate pallet #2010
Workflow file for this run
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 Migrations | |
| # If you modify more jobs, ensure that you add them as required to the job "confirmMigrationsPassed" | |
| # which is located at the end of this file (more info in the job) | |
| on: | |
| push: | |
| branches: [main, "release-*"] | |
| pull_request: | |
| branches: [main, "release-*"] | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 5 * * *' # Daily at 5 AM UTC | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| # drop permissions for default token | |
| permissions: {} | |
| jobs: | |
| changes: | |
| uses: ./.github/workflows/check-changed-files.yml | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| runtime-matrix: | |
| if: needs.changes.outputs.should-run == 'true' | |
| needs: [changes] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| runtime: ${{ steps.runtime.outputs.runtime }} | |
| name: Extract tasks from matrix | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - id: runtime | |
| run: | | |
| # Expand each runtime into one task per try_runtime instance, | |
| # overlaying the instance's name (as `instance`) and `uris` onto | |
| # the runtime object. Strip the nested `instances` list so each | |
| # emitted entry only carries per-(runtime, instance) data. | |
| TASKS=$(jq '[ | |
| .[] as $r | |
| | ($r.try_runtime.instances // [])[] as $i | |
| | select(($i.uris // []) | length > 0) | |
| | $r | |
| + { instance: $i.name, uris: $i.uris } | |
| + { try_runtime: ($r.try_runtime | del(.instances)) } | |
| ]' scripts/runtimes-matrix.json) | |
| SKIPPED_TASKS=$(jq '[.[] | select(((.try_runtime.instances // []) | length) == 0)]' scripts/runtimes-matrix.json) | |
| echo --- Running the following tasks --- | |
| echo $TASKS | |
| echo --- Skipping the following runtimes with no try_runtime.instances --- | |
| echo $SKIPPED_TASKS | |
| # Strip whitespace from Tasks now that we've logged it | |
| TASKS=$(echo $TASKS | jq -c .) | |
| echo "runtime=$TASKS" >> $GITHUB_OUTPUT | |
| prepare-try-runtime: | |
| name: Prepare try-runtime | |
| needs: [changes] | |
| if: needs.changes.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Set up Polkadot binaries | |
| uses: ./.github/actions/use-polkadot-binaries | |
| with: | |
| groups: try-runtime | |
| mode: prepare | |
| prepare-snapshots: | |
| name: prepare-snapshot (${{ matrix.runtime.name }} / ${{ matrix.runtime.instance }}) | |
| needs: [runtime-matrix, prepare-try-runtime] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| # Snapshot lookup uses a deliberately-non-matching primary `key:` so | |
| # `restore-keys` always falls through to the most recent dated entry. | |
| # With `lookup-only` the snapshot isn't restored — we just decide | |
| # whether to regenerate. `cache-matched-key` is empty iff nothing was | |
| # found, which is also the case on the daily `schedule` (lookup | |
| # skipped) so the snapshot is force-refreshed nightly. | |
| - name: Check if snapshot exists in cache | |
| id: cache-restore | |
| if: github.event_name != 'schedule' | |
| uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| with: | |
| lookup-only: true | |
| path: snapshot.raw | |
| key: try-runtime-snapshot-${{ matrix.runtime.name }}-${{ matrix.runtime.instance }} | |
| restore-keys: | | |
| try-runtime-snapshot-${{ matrix.runtime.name }}-${{ matrix.runtime.instance }}- | |
| fail-on-cache-miss: false | |
| - name: Set up Polkadot binaries | |
| if: steps.cache-restore.outputs.cache-matched-key == '' | |
| uses: ./.github/actions/use-polkadot-binaries | |
| with: | |
| groups: try-runtime | |
| mode: consume | |
| - name: Generate snapshot for ${{ matrix.runtime.name }} (${{ matrix.runtime.instance }}) | |
| if: steps.cache-restore.outputs.cache-matched-key == '' | |
| env: | |
| RUNTIME_NAME: ${{ matrix.runtime.name }} | |
| RUNTIME_INSTANCE: ${{ matrix.runtime.instance }} | |
| RUNTIME_URIS_JSON: ${{ toJSON(matrix.runtime.uris) }} | |
| run: | | |
| echo "Generating snapshot for $RUNTIME_NAME ($RUNTIME_INSTANCE)..." | |
| URI_ARGS=() | |
| while IFS= read -r uri; do | |
| URI_ARGS+=(--uri "$uri") | |
| done < <(echo "$RUNTIME_URIS_JSON" | jq -r '.[]') | |
| echo "Using URIs: ${URI_ARGS[*]}" | |
| for i in {1..10}; do | |
| echo "Snapshot creation attempt $i/10" | |
| if try-runtime create-snapshot "${URI_ARGS[@]}" -- 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 | |
| run: | | |
| echo "today=$(/bin/date -u "+%Y%m%d")" >> "$GITHUB_OUTPUT" | |
| shell: bash | |
| - name: Save snapshot to cache | |
| if: steps.cache-restore.outputs.cache-matched-key == '' | |
| uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| with: | |
| path: snapshot.raw | |
| key: try-runtime-snapshot-${{ matrix.runtime.name }}-${{ matrix.runtime.instance }}-${{ steps.get-date.outputs.today }} | |
| check-migrations: | |
| name: check-migration (${{ matrix.runtime.name }} / ${{ matrix.runtime.instance }}) | |
| needs: [runtime-matrix, prepare-try-runtime, prepare-snapshots] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 120 | |
| if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: "Fetch upstream tags" | |
| if: github.event_name == 'pull_request' | |
| env: | |
| BASE_REPO: ${{ github.event.pull_request.base.repo.full_name }} | |
| run: | | |
| git remote add upstream "https://github.com/${BASE_REPO}.git" | |
| git fetch upstream --tags | |
| - name: Set up Polkadot binaries | |
| uses: ./.github/actions/use-polkadot-binaries | |
| with: | |
| groups: try-runtime | |
| mode: consume | |
| - name: Install stable toolchain | |
| uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master | |
| with: | |
| targets: "wasm32v1-none" | |
| components: "rust-src" | |
| toolchain: "${{ env.RUST_STABLE_VERSION }}" | |
| - name: Restore snapshot from cache | |
| uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| with: | |
| path: snapshot.raw | |
| key: try-runtime-snapshot-${{ matrix.runtime.name }}-${{ matrix.runtime.instance }}- | |
| fail-on-cache-miss: true | |
| - name: Run ${{ matrix.runtime.name }} (${{ matrix.runtime.instance }}) Runtime Checks | |
| env: | |
| PACKAGE_NAME: ${{ matrix.runtime.package }} | |
| TRY_RUNTIME_SPEC_NAME_CHECK: ${{ matrix.runtime.try_runtime.spec_name_check}} | |
| TRY_RUNTIME_EXTRA_FLAGS: ${{ matrix.runtime.try_runtime.extra_flags }} | |
| run: | | |
| try-runtime --version | |
| FEATURES="try-runtime" | |
| echo "Setting features: ${FEATURES}" | |
| cargo build --release -p "$PACKAGE_NAME" --features "$FEATURES" -q --locked | |
| RUNTIME_BLOB_NAME=$(echo "$PACKAGE_NAME" | sed 's/-/_/g').compact.compressed.wasm | |
| RUNTIME_BLOB_PATH="./target/release/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME" | |
| export RUST_LOG=remote-ext=debug,runtime=trace | |
| (set -x; try-runtime \ | |
| --runtime "$RUNTIME_BLOB_PATH" \ | |
| $TRY_RUNTIME_SPEC_NAME_CHECK \ | |
| on-runtime-upgrade --checks="all" \ | |
| $TRY_RUNTIME_EXTRA_FLAGS \ | |
| snap --path snapshot.raw) | |
| # This will only run if all the tests in its "needs" array passed. | |
| # Add this as your required job, becuase if the matrix changes size (new things get added) | |
| # it will still require all the steps to succeed. | |
| # If you add more jobs, remember to add them to the "needs" array. | |
| confirmMigrationsPassed: | |
| runs-on: ubuntu-latest | |
| name: All migrations passed | |
| if: always() && github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' | |
| needs: [changes, prepare-try-runtime, prepare-snapshots, check-migrations] | |
| steps: | |
| - name: Decide outcome | |
| if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | |
| run: exit 1 | |
| - run: echo '### Good job! All the migrations passed 🚀' >> $GITHUB_STEP_SUMMARY |