Skip to content

Enhance CI

Enhance CI #213

Workflow file for this run

name: Check Migrations
on:
push:
branches: ["develop"]
pull_request:
branches: ["develop"]
workflow_dispatch:
# Cancel a currently running workflow from the same PR, branch or tag when a new workflow is
# triggered (ref https://stackoverflow.com/a/72408109)
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
runtime-matrix:
runs-on: ubuntu-latest
outputs:
runtime: ${{ steps.runtime.outputs.runtime }}
name: Extract tasks from matrix
steps:
- uses: actions/checkout@v4
- 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@v4
- name: Download try-runtime-cli
run: |
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.6.1/try-runtime-x86_64-unknown-linux-musl -o try-runtime
chmod +x ./try-runtime
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: "3.6.1"
- name: Install rust toolchain from toolchain.toml
run: rustup show
- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
with:
shared-key: "check-migrations-cache"
cache-on-failure: true
- name: Build ${{ matrix.runtime.name }}
run: |
cargo build --release -p ${{ matrix.runtime.package }} --features try-runtime --locked
- name: Build EXTRA_ARGS
run: |
EXTRA_FLAGS=""
# Disable the spec version check when we dont want to release.
if [[ $GITHUB_REF =~ ^refs/heads/release/.*$ ]]; then
echo "On a release branch"
else
EXTRA_FLAGS+=" --disable-spec-version-check"
echo "Not on a release branch"
fi
echo "Flags: $EXTRA_FLAGS"
echo "EXTRA_ARGS=$EXTRA_FLAGS" >> $GITHUB_ENV
- name: Check migrations
run: |
PACKAGE_NAME=${{ matrix.runtime.package }}
RUNTIME_BLOB_NAME=$(echo $PACKAGE_NAME | sed 's/-/_/g').compact.compressed.wasm
RUNTIME_BLOB_PATH=./target/release/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME
./try-runtime \
--runtime $RUNTIME_BLOB_PATH \
on-runtime-upgrade --checks=pre-and-post \
${{ env.EXTRA_ARGS }} --disable-idempotency-checks \
live --uri ${{ matrix.runtime.uri }}