Skip to content

Commit

Permalink
Add try-runtime check in release process (#2971)
Browse files Browse the repository at this point in the history
* add standalone try-runtime

* use coverate for tests

* use name

* include it in release ci

* fix

* fix format

* try to use name

* bump version

* rename

* enable release bot

* add ci name

* revert coverage yml

* fix indention
  • Loading branch information
Kailai-Wang authored Aug 9, 2024
1 parent 1d64667 commit ea133d4
Show file tree
Hide file tree
Showing 8 changed files with 333 additions and 194 deletions.
20 changes: 20 additions & 0 deletions .github/runtime.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{
"name": "rococo",
"package": "rococo-parachain-runtime",
"path": "runtime/rococo",
"uri": "wss://rpc.rococo-parachain.litentry.io:443"
},
{
"name": "litmus",
"package": "litmus-parachain-runtime",
"path": "runtime/litmus",
"uri": "wss://rpc.litmus-parachain.litentry.io:443"
},
{
"name": "litentry",
"package": "litentry-parachain-runtime",
"path": "runtime/litentry",
"uri": "wss://rpc.litentry-parachain.litentry.io:443"
}
]
136 changes: 136 additions & 0 deletions .github/workflows/check-runtime-upgrade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Check runtime upgrade

# Check runtime upgradability of the released runtime.
# We do it in two ways:
# - by executing try-runtime-cli against the live chain
# - by simulating a runtime upgrade against the live chain

on:
release:
types: [released]

workflow_dispatch:
inputs:
release_tag:
description: runtime.wasm release_tag
required: false

env:
SUBWASM_VERSION: 0.19.1
RELEASE_TAG: ${{ github.event.inputs.release_tag || github.event.release.tag_name }}

jobs:
check-condition:
runs-on: ubuntu-latest
outputs:
skip_simulation: ${{ steps.check.outputs.skip_simulation }}
steps:
- uses: actions/checkout@v4

- id: check
run: |
if [ -z "${{ env.RELEASE_TAG }}" ]; then
skip_simulation=true
else
skip_simulation=false
fi
echo "skip_simulation=$skip_simulation" | tee -a $GITHUB_OUTPUT
runtime-matrix:
runs-on: ubuntu-latest
outputs:
runtime: ${{ steps.runtime.outputs.runtime }}
name: Parse runtime matrix
steps:
- uses: actions/checkout@v4

- id: runtime
run: |
TASKS=$(jq '[.[] | select(.uri != null)]' .github/runtime.json)
SKIPPED_TASKS=$(jq '[.[] | select(.uri == null)]' .github/runtime.json)
echo --- Running the following tasks ---
echo $TASKS
echo --- Skipping the following tasks due to not having a uri field ---
echo $SKIPPED_TASKS
TASKS=$(echo $TASKS | jq -c .)
echo "runtime=$TASKS" >> $GITHUB_OUTPUT
simulate-runtime-upgrade:
runs-on: ubuntu-latest
needs:
- check-condition
- runtime-matrix
if: needs.check-condition.outputs.skip_simulation == 'false'
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }}
name: ${{ matrix.runtime.name }}
steps:
- name: Checkout codes on ${{ github.ref }}
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Enable corepack and pnpm
run: corepack enable && corepack enable pnpm

- name: Fork ${{ matrix.runtime.name }} and launch parachain
timeout-minutes: 20
run: |
./scripts/fork-parachain-and-launch.sh ${{ matrix.runtime.name }}
- name: Install subwasm ${{ env.SUBWASM_VERSION }}
run: |
wget https://github.com/chevdor/subwasm/releases/download/v${{ env.SUBWASM_VERSION }}/subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb
sudo dpkg -i subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb
subwasm --version
- name: Test runtime upgrade
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
timeout-minutes: 10
run: |
./scripts/runtime-upgrade.sh ${{ matrix.runtime.name }}-parachain-runtime.compact.compressed.wasm ${{ env.RELEASE_TAG }}
- name: Collect docker logs if test fails
continue-on-error: true
uses: jwalton/gh-docker-logs@v2
if: failure()
with:
tail: all
dest: docker-logs

- name: Upload docker logs if test fails
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ matrix.runtime.name }}-docker-logs
path: docker-logs
if-no-files-found: ignore
retention-days: 3

try-runtime:
runs-on: ubuntu-latest
needs:
- check-condition
- runtime-matrix
strategy:
fail-fast: false
matrix:
runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }}
name: ${{ matrix.runtime.name }}
steps:
- name: Checkout codes on ${{ github.ref }}
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run ${{ matrix.runtime.name }} try-runtime check
uses: paritytech/[email protected]
with:
runtime-package: ${{ matrix.runtime.package }}
node-uri: ${{ matrix.runtime.uri }}
checks: "all"
extra-args: ""
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ jobs:
type:
- tee # TODO: switch to identity
- bitacross
name: ${{ matrix.type }}
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -609,6 +610,7 @@ jobs:
- litmus
- litentry
- rococo
name: ${{ matrix.chain }}
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -744,7 +746,7 @@ jobs:
- test_name: lit-twitter-identity-test
- test_name: lit-discord-identity-test
- test_name: lit-assertion-contracts-test

name: ${{ matrix.test_name }}
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -828,6 +830,7 @@ jobs:
- test_name: lit-di-vc-multiworker-test
- test_name: lit-dr-vc-multiworker-test
- test_name: lit-resume-worker
name: ${{ matrix.test_name }}
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -904,6 +907,7 @@ jobs:
matrix:
include:
- test_name: lit-sign-bitcoin
name: ${{ matrix.test_name }}
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ jobs:
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
verbose: true
verbose: true
3 changes: 2 additions & 1 deletion .github/workflows/release-bot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: 'Release bot'
on:
workflow_dispatch:
release:
types: [released]

jobs:
release-bot:
Expand Down
70 changes: 0 additions & 70 deletions .github/workflows/simulate-runtime-upgrade.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/try-runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Check try-runtime

on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
runtime-matrix:
runs-on: ubuntu-latest
outputs:
runtime: ${{ steps.runtime.outputs.runtime }}
name: Parse runtime matrix
steps:
- uses: actions/checkout@v4
- id: runtime
run: |
TASKS=$(jq '[.[] | select(.uri != null)]' .github/runtime.json)
SKIPPED_TASKS=$(jq '[.[] | select(.uri == null)]' .github/runtime.json)
echo --- Running the following tasks ---
echo $TASKS
echo --- Skipping the following tasks due to not having a uri field ---
echo $SKIPPED_TASKS
TASKS=$(echo $TASKS | jq -c .)
echo "runtime=$TASKS" >> $GITHUB_OUTPUT
try-runtime:
needs: [runtime-matrix]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }}
name: ${{ matrix.runtime.name }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run ${{ matrix.runtime.name }} try-runtime check
uses: paritytech/[email protected]
with:
runtime-package: ${{ matrix.runtime.package }}
node-uri: ${{ matrix.runtime.uri }}
checks: "all"
extra-args: ""
Loading

0 comments on commit ea133d4

Please sign in to comment.