Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
liamaharon committed Mar 18, 2024
1 parent 025da3f commit 1626e62
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/polkadot.yml
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."
98 changes: 98 additions & 0 deletions action.yml
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/setup-protoc@v1.3.0
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/rust-cache@v2.7.0
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

0 comments on commit 1626e62

Please sign in to comment.