Skip to content
shield

GitHub Action

Try Runtime GHA

v0.2.0 Latest version

Try Runtime GHA

shield

Try Runtime GHA

Easily check runtime migrations for a Substrate-based blockchain using try-runtime-cli

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Try Runtime GHA

uses: paritytech/try-runtime-gha@v0.2.0

Learn more about this action in paritytech/try-runtime-gha

Choose a version

Try Runtime GHA

Try Runtime GHA makes it easy to add try-runtime checks to your CI.

Motivation

try-runtime enforces critical invariants such as:

  • Migrations execute correctly, including pre_upgrade and post_upgrade hooks
  • Migration execution does not exceed the block weight limit
  • Migrations are idempotent
  • Try State invariants pass
  • Post-Migration, all runtime state is decodable

Given that code changes can break any of the above invariants, running try-runtime checks is as important as regularly running cargo tests in your CI to prevent accidental regressions.

Usage

Create a new Github Action Workflow in the repo containing your runtime(s).

The simplest usage only requires two parameters runtime-package, and node-uri:

name: Check Migrations

on:
  push:
    branches: ["main"]
  pull_request:

jobs:
  check-migrations:
    steps:
      - name: Checkout sources
        uses: actions/checkout@v3

      - name: Run Try Runtime Checks
        uses: "paritytech/try-runtime-gha@v0.1.0"
        with:
          runtime-package: "my-runtime"        # The runtime package name
          node-uri: "wss://my-runtime-uri:443" # Extra args to pass to the ''on-runtime-upgrade'' subcommand. For example, "--disable-idempotency-check --no-weight-warnings". See all options at https://paritytech.github.io/try-runtime-cli/try_runtime_core/commands/on_runtime_upgrade/struct.Command.html.
          checks: "all"                        # OPTIONAL: Types of checks to run. For example, "pre-and-post". See all options at https://paritytech.github.io/try-runtime-cli/frame_support/traits/enum.UpgradeCheckSelect.html. Default: "all".
          extra-args: "--arg --other-arg"      # OPTIONAL: Extra args to pass to the 'on-runtime-upgrade' subcommand. For example, "--disable-idempotency-check --no-weight-warnings". See all options at https://paritytech.github.io/try-runtime-cli/try_runtime_core/commands/on_runtime_upgrade/struct.Command.html.

When triggered, the GHA will

  1. Build the runtime-package with flags --production and --features try-runtime
  2. Download try-runtime-cli
  3. Exec try-runtime on-runtime-upgrade --checks [checks] [extra-args] live [node-uri]

If there is an error, you can check the logs for the exact command that failed to help reproduce the issue in your local environment.

See more examples at .github/workflows/examples.yml.