|
| 1 | +name: Check Migrations |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["develop", "ajuna-stable" ] |
| 6 | + pull_request: |
| 7 | + branches: ["develop", "ajuna-stable"] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +# Cancel a currently running workflow from the same PR, branch or tag when a new workflow is |
| 11 | +# triggered (ref https://stackoverflow.com/a/72408109) |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + runtime-matrix: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + outputs: |
| 20 | + runtime: ${{ steps.runtime.outputs.runtime }} |
| 21 | + name: Extract tasks from matrix |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v3 |
| 24 | + - id: runtime |
| 25 | + run: | |
| 26 | + # Filter out runtimes that don't have a URI |
| 27 | + TASKS=$(jq '[.[] | select(.uri != null)]' .github/workflows/runtimes-matrix.json) |
| 28 | + SKIPPED_TASKS=$(jq '[.[] | select(.uri == null)]' .github/workflows/runtimes-matrix.json) |
| 29 | + echo --- Running the following tasks --- |
| 30 | + echo $TASKS |
| 31 | + echo --- Skipping the following tasks due to not having a uri field --- |
| 32 | + echo $SKIPPED_TASKS |
| 33 | + # Strip whitespace from Tasks now that we've logged it |
| 34 | + TASKS=$(echo $TASKS | jq -c .) |
| 35 | + echo "runtime=$TASKS" >> $GITHUB_OUTPUT |
| 36 | +
|
| 37 | + check-migrations: |
| 38 | + needs: [runtime-matrix] |
| 39 | + continue-on-error: true |
| 40 | + runs-on: ubuntu-latest |
| 41 | + strategy: |
| 42 | + matrix: |
| 43 | + runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }} |
| 44 | + steps: |
| 45 | + - name: Checkout sources |
| 46 | + uses: actions/checkout@v3 |
| 47 | + |
| 48 | + - name: Download try-runtime-cli |
| 49 | + run: | |
| 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 |
| 51 | + chmod +x ./try-runtime |
| 52 | +
|
| 53 | + - name: Install Protoc |
| 54 | + uses: arduino/setup-protoc@v1 |
| 55 | + with: |
| 56 | + version: "3.6.1" |
| 57 | + |
| 58 | + - name: Add wasm32-unknown-unknown target |
| 59 | + run: rustup target add wasm32-unknown-unknown |
| 60 | + |
| 61 | + - name: Build ${{ matrix.runtime.name }} |
| 62 | + run: | |
| 63 | + cargo build --release -p ${{ matrix.runtime.package }} --features try-runtime -q --locked |
| 64 | +
|
| 65 | + - name: Check migrations |
| 66 | + # Todo: enable spec-version-check dynamically if we are releasing |
| 67 | + run: | |
| 68 | + PACKAGE_NAME=${{ matrix.runtime.package }} |
| 69 | + RUNTIME_BLOB_NAME=$(echo $PACKAGE_NAME | sed 's/-/_/g').compact.compressed.wasm |
| 70 | + RUNTIME_BLOB_PATH=./target/release/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME |
| 71 | +
|
| 72 | + ./try-runtime \ |
| 73 | + --runtime $RUNTIME_BLOB_PATH \ |
| 74 | + on-runtime-upgrade --checks=pre-and-post \ |
| 75 | + --disable-spec-version-check --disable-idempotency-checks \ |
| 76 | + live --uri ${{ matrix.runtime.uri }} |
0 commit comments