Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1824: try-runtime ci checks: Migrations #2023

Merged
merged 29 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8ce12e3
update make file and add a job
saraswatpuneet Jun 12, 2024
3325528
try runtime check job
saraswatpuneet Jun 12, 2024
f0aece8
extract pieces from try-runtime
saraswatpuneet Jun 13, 2024
2d85190
fixes
saraswatpuneet Jun 13, 2024
3aacf6e
fix
saraswatpuneet Jun 13, 2024
e65a14f
remove sudo
saraswatpuneet Jun 13, 2024
c50636c
set production profil
saraswatpuneet Jun 13, 2024
8f4e5fe
fix production profile
saraswatpuneet Jun 13, 2024
6de859b
extra args for better debuggin
saraswatpuneet Jun 13, 2024
a371101
update spec version
saraswatpuneet Jun 13, 2024
b28ebdb
add make target for testing migrations
saraswatpuneet Jun 13, 2024
63fe220
fix makefile
saraswatpuneet Jun 13, 2024
b618895
Merge branch 'main' into try_runtime_migrations
saraswatpuneet Jun 13, 2024
77834b4
update spec version
saraswatpuneet Jun 13, 2024
e8853fd
separate workflow with trigger
saraswatpuneet Jun 13, 2024
6bd531b
Merge branch 'main' into try_runtime_migrations
saraswatpuneet Jun 13, 2024
a70a287
add a dispatch option
saraswatpuneet Jun 13, 2024
0fa35d1
temp: test the flow
saraswatpuneet Jun 14, 2024
ef48c8b
for testing
saraswatpuneet Jun 14, 2024
7c7f38a
revert post testing
saraswatpuneet Jun 14, 2024
6294d2a
add a helper check if try-runtime is not installed
saraswatpuneet Jun 17, 2024
00016d7
Merge branch 'main' into try_runtime_migrations
saraswatpuneet Jun 17, 2024
72fe100
update version
saraswatpuneet Jun 17, 2024
8e1ed4b
Update .github/workflows/check-migrations.yml
saraswatpuneet Jun 25, 2024
386fa52
Update .github/workflows/common/try-runtime-migrations/action.yml
saraswatpuneet Jun 25, 2024
81d679f
address feedback
saraswatpuneet Jun 25, 2024
3067dff
set vars for wss://0.rpc.testnet.amplica.io:443
saraswatpuneet Jun 25, 2024
56acf55
Merge branch 'main' into try_runtime_migrations
saraswatpuneet Jun 25, 2024
f55099f
Merge branch 'main' into try_runtime_migrations
saraswatpuneet Jun 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/check-migrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check Migrations on Paseo

on:
pull_request_target:
types:
- labeled
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Triggers the workflow when a PR is labeled

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any label applied to the PR will trigger the workflow? Nice.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below we check for two conditions

`if: github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'change/storage-migration')`

So lable should be change/storage-migration for the job to be triggered

workflow_dispatch:
inputs:
runtime-package:
saraswatpuneet marked this conversation as resolved.
Show resolved Hide resolved
description: 'Runtime package to check migrations for'
required: true
default: 'frequency-runtime'
runtime-uri:
description: 'URI of the runtime to check migrations for'
required: true
default: 'wss://0.rpc.testnet.amplica.io:443'
saraswatpuneet marked this conversation as resolved.
Show resolved Hide resolved


jobs:
check-migrations:
if: contains(github.event.pull_request.labels.*.name, 'change/storage-migration')
saraswatpuneet marked this conversation as resolved.
Show resolved Hide resolved
name: Check Migrations on Paseo
continue-on-error: false
runs-on: ubicloud-standard-8
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1
steps:
- name: Checkout sources
uses: actions/checkout@v3
saraswatpuneet marked this conversation as resolved.
Show resolved Hide resolved

- name: Run Check Migrations Action
uses: ./.github/workflows/common/try-runtime-migrations
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
runtime-package: "frequency-runtime"
runtime-uri: "wss://0.rpc.testnet.amplica.io:443"
saraswatpuneet marked this conversation as resolved.
Show resolved Hide resolved
32 changes: 32 additions & 0 deletions .github/workflows/common/try-runtime-migrations/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Check Migrations Paseo"
saraswatpuneet marked this conversation as resolved.
Show resolved Hide resolved
description: "An action to check runtime migrations"
inputs:
github-token:
description: "GitHub token"
required: true
runtime-package:
description: "The package name of the runtime"
required: true
runtime-uri:
description: "The URI of the runtime"
required: true

runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@v2
saraswatpuneet marked this conversation as resolved.
Show resolved Hide resolved

- name: Install required packages
run: |
apt-get update
apt install -y protobuf-compiler libclang-dev clang cmake unzip
shell: bash

- name: Run runtime checks
uses: paritytech/try-runtime-gha@v0.1.0
with:
runtime-package: ${{ inputs.runtime-package }}
node-uri: ${{ inputs.runtime-uri }}
checks: "pre-and-post"
extra-args: "--disable-spec-version-check --no-weight-warnings"
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ lto = true
codegen-units = 1
strip = true

[profile.production]
inherits = "release"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gh action paritytech/try-runtime-gha@v0.1.0 looks for production profile, added production to inherit release

# Faster build for bench-dev
[profile.bench-dev]
inherits = "release"
Expand Down
29 changes: 12 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -282,41 +282,36 @@ e2e-tests-testnet-paseo:
e2e-tests-paseo-local:
./scripts/run_e2e_tests.sh -c paseo_local

.PHONY: try-runtime-create-snapshot-rococo, try-runtime-create-snapshot-mainnet, try-runtime-upgrade-rococo, try-runtime-upgrade-mainnet, try-runtime-use-snapshot-rococo, try-runtime-use-snapshot-mainnet, try-runtime-create-snapshot-paseo-testnet, try-runtime-use-snapshot-paseo-testnet, try-runtime-upgrade-paseo-testnet
try-runtime-create-snapshot-rococo:
try-runtime create-snapshot --uri wss://rpc.rococo.frequency.xyz:443 rococo-all-pallets.state
check-try-runtime-installed:
@which try-runtime > /dev/null || (echo "try-runtime is not installed. Please install it" && exit 1)
.PHONY: try-runtime-create-snapshot-mainnet, try-runtime-upgrade-mainnet, try-runtime-use-snapshot-mainnet, try-runtime-create-snapshot-paseo-testnet, try-runtime-use-snapshot-paseo-testnet, try-runtime-upgrade-paseo-testnet

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed rococo related try-runtime stuff

try-runtime-create-snapshot-paseo-testnet:
try-runtime-create-snapshot-paseo-testnet: check-try-runtime-installed
try-runtime create-snapshot --uri wss://0.rpc.testnet.amplica.io:443 testnet-paseo-all-pallets.state

# mainnet snapshot takes as many as 24 hours to complete
try-runtime-create-snapshot-mainnet:
try-runtime-create-snapshot-mainnet: check-try-runtime-installed
try-runtime create-snapshot --uri wss://1.rpc.frequency.xyz:443 mainnet-all-pallets.state

try-runtime-upgrade-rococo:
cargo build --release --features frequency-testnet,try-runtime && \
try-runtime --runtime ./target/release/wbuild/frequency-runtime/frequency_runtime.wasm on-runtime-upgrade live --uri wss://rpc.rococo.frequency.xyz:443

try-runtime-upgrade-paseo-testnet:
try-runtime-upgrade-paseo-testnet: check-try-runtime-installed
cargo build --release --features frequency-testnet,try-runtime && \
try-runtime --runtime ./target/release/wbuild/frequency-runtime/frequency_runtime.wasm on-runtime-upgrade live --uri wss://0.rpc.testnet.amplica.io:443

try-runtime-upgrade-mainnet:
try-runtime-upgrade-mainnet: check-try-runtime-installed
cargo build --release --features frequency,try-runtime && \
try-runtime --runtime ./target/release/wbuild/frequency-runtime/frequency_runtime.wasm on-runtime-upgrade live --uri wss://1.rpc.frequency.xyz:443

try-runtime-use-snapshot-rococo:
cargo build --release --features frequency-testnet,try-runtime && \
try-runtime --runtime ./target/release/wbuild/frequency-runtime/frequency_runtime.wasm on-runtime-upgrade snap --path rococo-all-pallets.state

try-runtime-use-snapshot-paseo-testnet:
try-runtime-use-snapshot-paseo-testnet: check-try-runtime-installed
cargo build --release --features frequency-testnet,try-runtime && \
try-runtime --runtime ./target/release/wbuild/frequency-runtime/frequency_runtime.wasm on-runtime-upgrade snap --path testnet-paseo-all-pallets.state

try-runtime-use-snapshot-mainnet:
try-runtime-use-snapshot-mainnet: check-try-runtime-installed
cargo build --release --features frequency,try-runtime && \
try-runtime --runtime ./target/release/wbuild/frequency-runtime/frequency_runtime.wasm on-runtime-upgrade snap --path mainnet-all-pallets.state

try-runtime-check-migrations-paseo-testnet: check-try-runtime-installed
cargo build --release --features frequency-testnet,try-runtime -q --locked && \
try-runtime --runtime ./target/release/wbuild/frequency-runtime/frequency_runtime.wasm on-runtime-upgrade --checks="pre-and-post" --disable-spec-version-check --no-weight-warnings live --uri wss://0.rpc.testnet.amplica.io:443
# Pull the Polkadot version from the polkadot-cli package in the Cargo.lock file.
# This will break if the lock file format changes
POLKADOT_VERSION=$(shell awk -F "=" '/name = "polkadot-cli"/,/version = ".*"/{ print $2 }' Cargo.lock | tail -n 1 | cut -d " " -f 3 | tr -d \")
Expand Down
4 changes: 2 additions & 2 deletions runtime/frequency/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("frequency"),
impl_name: create_runtime_str!("frequency"),
authoring_version: 1,
spec_version: 84,
spec_version: 85,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand All @@ -345,7 +345,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("frequency-testnet"),
impl_name: create_runtime_str!("frequency"),
authoring_version: 1,
spec_version: 84,
spec_version: 85,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down
Loading