Fix migrations and add migration CI checks #7
Workflow file for this run
This file contains 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 Migrations | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
runtime-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
runtime: ${{ steps.runtime.outputs.runtime }} | |
steps: | |
- uses: actions/checkout@v2 | |
- id: runtime | |
run: | | |
# Filter out runtimes that don't have a URI | |
TASKS=$(jq '[.[] | select(.uri != null)]' .github/workflows/runtimes-matrix.json) | |
SKIPPED_TASKS=$(jq '[.[] | select(.uri == null)]' .github/workflows/runtimes-matrix.json) | |
echo --- Running the following tasks --- | |
echo $TASKS | |
echo --- Skipping the following tasks due to not having a uri field --- | |
echo $SKIPPED_TASKS | |
# Strip whitespace from Tasks now that we've logged it | |
TASKS=$(echo $TASKS | jq -c .) | |
echo "runtime=$TASKS" >> $GITHUB_OUTPUT | |
check-migrations: | |
needs: [ runtime-matrix ] | |
continue-on-error: true | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Build ${{ matrix.runtime.name }} | |
id: srtool_build | |
uses: chevdor/[email protected] | |
env: | |
BUILD_OPTS: "--features try-runtime" | |
with: | |
chain: ${{ matrix.runtime.name }} | |
package: ${{ matrix.runtime.package }} | |
runtime_dir: ${{ matrix.runtime.path }} | |
profile: "production" | |
- name: Build Summary | |
run: | | |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > ${{ matrix.runtime.name }}-srtool-digest.json | |
cat ${{ matrix.runtime.name }}-srtool-digest.json | |
echo "Runtime location: ${{ steps.srtool_build.outputs.wasm }}" | |
- name: Download try-runtime-cli | |
run: | | |
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.3.3/try-runtime-x86_64-unknown-linux-musl -o try-runtime | |
chmod +x ./try-runtime | |
- name: Check migrations | |
run: | | |
PACKAGE_NAME=${{ matrix.runtime.package }} | |
RUNTIME_BLOB_NAME=$(echo $PACKAGE_NAME | sed 's/-/_/g').compact.wasm | |
# When running on relay, we don't need weight checks. | |
NO_WEIGHT_WARNINGS_FLAG="" | |
if [[ "${{ matrix.runtime.is_relay }}" == "true" ]]; then | |
NO_WEIGHT_WARNINGS_FLAG="--no-weight-warnings" | |
fi | |
./try-runtime \ | |
--runtime ./${{ matrix.runtime.path }}/target/srtool/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME \ | |
on-runtime-upgrade --checks=pre-and-post $NO_WEIGHT_WARNINGS_FLAG live --uri ${{ matrix.runtime.uri }} |