-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
025da3f
commit 1626e62
Showing
2 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
run-polkadot: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Polkadot | ||
uses: ../.. | ||
with: | ||
runtime-package: "polkadot-runtime" | ||
extra-args: "--disable-idempotency-check --no-weight-warnings" | ||
node-uri: "wss://polkadot-try-runtime-node.parity-chains.parity.io:443" | ||
repository: "polkadot-fellows/runtimes" | ||
# ref: | ||
# description: "The branch, tag or SHA to checkout. When checking out the repository that triggered a workflow, this defaults to the reference or SHA for that event. Otherwise, uses the default branch." | ||
# token: | ||
# description: "Personal access token (PAT) used to fetch the repository." |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: "Try Runtime GHA" | ||
description: "Easily check runtime migrations for a Substrate-based blockchain using try-runtime-cli" | ||
author: "Parity Tech" | ||
branding: | ||
icon: "shield" | ||
color: "green" | ||
|
||
inputs: | ||
runtime-package: | ||
description: "The runtime package name" | ||
required: true | ||
extra-args: | ||
description: 'Extra args to pass to the ''on-runtime-upgrade'' subcommand. For example, "--disable-idempotency-check --no-weight-warnings"' | ||
required: true | ||
default: "" | ||
node-uri: | ||
description: "URI of a node to scrape state" | ||
required: true | ||
shared-cache-key: | ||
description: "The shared cache key" | ||
required: true | ||
default: "try-runtime-gha" | ||
repository: | ||
description: 'Repository name with owner. For example, "paritytech/polkadot-sdk". Default: ${{ github.repository }}' | ||
ref: | ||
description: "The branch, tag or SHA to checkout. When checking out the repository that triggered a workflow, this defaults to the reference or SHA for that event. Otherwise, uses the default branch." | ||
token: | ||
description: "Personal access token (PAT) used to fetch the repository." | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ inputs.repository }} | ||
ref: ${{ inputs.ref }} | ||
token: ${{ inputs.token }} | ||
|
||
- 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 | ||
shell: bash | ||
|
||
- name: Install Protoc | ||
uses: arduino/[email protected] | ||
with: | ||
version: "3.6.1" | ||
|
||
- name: Add wasm32-unknown-unknown target | ||
run: rustup target add wasm32-unknown-unknown | ||
shell: bash | ||
|
||
- name: Add rust-src component | ||
run: rustup component add rust-src | ||
shell: bash | ||
|
||
- name: Fetch cache | ||
uses: Swatinem/[email protected] | ||
with: | ||
shared-key: ${{ inputs.shared-cache-key }} | ||
|
||
- name: Build ${{ inputs.runtime-name }} | ||
run: | | ||
cargo build --profile production -p ${{ inputs.runtime-package }} --features try-runtime -q --locked | ||
shell: bash | ||
|
||
- name: Check migrations | ||
run: | | ||
PACKAGE_NAME=${{ inputs.runtime-package }} | ||
RUNTIME_BLOB_NAME=$(echo $PACKAGE_NAME | sed 's/-/_/g').compact.compressed.wasm | ||
RUNTIME_BLOB_PATH=./target/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME | ||
EXTRA_FLAGS="${{ inputs.extra-flags }}" | ||
if [[ "${{ inputs.runtime-is-relay }}" == "true" ]]; then | ||
EXTRA_FLAGS+="--no-weight-warnings" | ||
echo "Disabling weight checks since we are on a relay chain" | ||
fi | ||
echo "Extra flags: $EXTRA_FLAGS" | ||
# Store the command in a variable so we can log it | ||
COMMAND="./try-runtime \ | ||
--runtime $RUNTIME_BLOB_PATH \ | ||
on-runtime-upgrade --checks=pre-and-post \ | ||
$EXTRA_FLAGS \ | ||
live --uri ${{ inputs.runtime-uri }}" | ||
# Echo the command | ||
echo "Running command:" | ||
echo "$COMMAND" | ||
# Run the command | ||
eval "$COMMAND" | ||
shell: bash |