From 6a6310a870062954159837fbe3e00d515616b504 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Wed, 13 Sep 2023 11:46:08 -0600 Subject: [PATCH 1/5] add try-runtime-ci --- .github/templates/setup-worker/action.yml | 19 ++++++++++ .github/workflows/try-runtime.yml | 45 +++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 .github/templates/setup-worker/action.yml create mode 100644 .github/workflows/try-runtime.yml diff --git a/.github/templates/setup-worker/action.yml b/.github/templates/setup-worker/action.yml new file mode 100644 index 0000000..381feac --- /dev/null +++ b/.github/templates/setup-worker/action.yml @@ -0,0 +1,19 @@ +name: setup-worker +description: | + This action sets up a worker for use in other actions. It installs the + necessary dependencies for building the project. + +runs: + using: "composite" + + steps: + - name: Setup Ubuntu dependencies + shell: bash + run: sudo apt update && sudo apt install -y git clang curl libssl-dev llvm libudev-dev cmake protobuf-compiler + + - name: Install Rust nightly + shell: bash + run: | + rustup toolchain install nightly-2023-01-01 --profile minimal --component rustfmt + rustup default nightly-2023-01-01 + rustup target add wasm32-unknown-unknown \ No newline at end of file diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml new file mode 100644 index 0000000..e23f442 --- /dev/null +++ b/.github/workflows/try-runtime.yml @@ -0,0 +1,45 @@ +# Test storage migration using try-runtime on PRs with label "migration" +name: Test storage migration + +on: + pull_request: + types: [labeled, synchronize] + push: + branches: [ main ] + +jobs: + try_runtime: + if: contains(github.event.pull_request.labels.*.name, 'migration') + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Setup worker + uses: "./.github/templates/setup-worker" + + - name: Cache Build artefacts + uses: actions/cache/restore@v3 + id: cargo-cache + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }} + + - name: Install try-runtime + run: cargo install --git https://github.com/paritytech/try-runtime-cli --locked + + # a live RPC node is required for the below work + - run: | + echo "Found label runtime_migration. Running tests" + echo "---------- Running try-runtime for extended-parachain-template ----------" + cargo build -p parachain-template-node --locked --release --no-default-features --features parachain-template-node/mainnet-runtime,try-runtime && \ + try-runtime --runtime ./target/release/wbuild/mainnet-runtime/target/wasm32-unknown-unknown/release/mainnet_runtime.wasm \ + on-runtime-upgrade live --uri wss://mainnet-try-runtime-node.parity.io:443 + env: + RUST_LOG: remote-ext=debug,runtime=debug \ No newline at end of file From 6332b53c8c11969e20e5c8c72b63abfafc91b3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Molina=20Colmenero?= Date: Thu, 14 Sep 2023 19:03:03 +0200 Subject: [PATCH 2/5] Use Rust stable in CI (#82) * feat: make default image work with stable Rust * fix: label name --- .github/templates/setup-worker/action.yml | 8 ++++---- .github/workflows/try-runtime.yml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/templates/setup-worker/action.yml b/.github/templates/setup-worker/action.yml index 381feac..4b62f98 100644 --- a/.github/templates/setup-worker/action.yml +++ b/.github/templates/setup-worker/action.yml @@ -11,9 +11,9 @@ runs: shell: bash run: sudo apt update && sudo apt install -y git clang curl libssl-dev llvm libudev-dev cmake protobuf-compiler - - name: Install Rust nightly + - name: Install Rust stable shell: bash run: | - rustup toolchain install nightly-2023-01-01 --profile minimal --component rustfmt - rustup default nightly-2023-01-01 - rustup target add wasm32-unknown-unknown \ No newline at end of file + rustup toolchain install stable --profile minimal --component rustfmt + rustup default stable + rustup target add wasm32-unknown-unknown diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index e23f442..429a097 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -36,10 +36,10 @@ jobs: # a live RPC node is required for the below work - run: | - echo "Found label runtime_migration. Running tests" + echo "Found label migration. Running tests" echo "---------- Running try-runtime for extended-parachain-template ----------" cargo build -p parachain-template-node --locked --release --no-default-features --features parachain-template-node/mainnet-runtime,try-runtime && \ try-runtime --runtime ./target/release/wbuild/mainnet-runtime/target/wasm32-unknown-unknown/release/mainnet_runtime.wasm \ on-runtime-upgrade live --uri wss://mainnet-try-runtime-node.parity.io:443 env: - RUST_LOG: remote-ext=debug,runtime=debug \ No newline at end of file + RUST_LOG: remote-ext=debug,runtime=debug From bb9ace97e4e07d8d70d517e3231199b2b8cc1c3a Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Fri, 15 Sep 2023 11:13:21 -0600 Subject: [PATCH 3/5] create a try-runtime worflow for mainnest and devnet --- .github/workflows/try-runtime-devnet.yml | 45 +++++++++++++++++++ ...ry-runtime.yml => try-runtime-mainnet.yml} | 12 ++--- 2 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/try-runtime-devnet.yml rename .github/workflows/{try-runtime.yml => try-runtime-mainnet.yml} (81%) diff --git a/.github/workflows/try-runtime-devnet.yml b/.github/workflows/try-runtime-devnet.yml new file mode 100644 index 0000000..60382c2 --- /dev/null +++ b/.github/workflows/try-runtime-devnet.yml @@ -0,0 +1,45 @@ +# Test storage migration using try-runtime on PRs with label "migration-devnet" +name: Test storage migration for devnet + +on: + pull_request: + types: [labeled, synchronize] + push: + branches: [ main ] + +jobs: + try_runtime: + if: contains(github.event.pull_request.labels.*.name, 'migration-devnet') + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Setup worker + uses: "./.github/templates/setup-worker" + + - name: Cache Build artefacts + uses: actions/cache/restore@v3 + id: cargo-cache + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }} + + - name: Install try-runtime + run: cargo install --git https://github.com/paritytech/try-runtime-cli --locked + + # a live RPC node is required for the below work + - run: | + echo "Found label migration. Running tests" + echo "---------- Running try-runtime for devnet extended-parachain-template ----------" + cargo build -p parachain-template-node --locked --release --no-default-features --features try-runtime && \ + try-runtime --runtime ./target/release/wbuild/devnet-runtime/target/wasm32-unknown-unknown/release/devnet_runtime.wasm \ + on-runtime-upgrade live --uri wss://dev-try-runtime-rpc-node.parity.io:443 + env: + RUST_LOG: remote-ext=debug,runtime=debug diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime-mainnet.yml similarity index 81% rename from .github/workflows/try-runtime.yml rename to .github/workflows/try-runtime-mainnet.yml index 429a097..33d9f04 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime-mainnet.yml @@ -1,5 +1,5 @@ -# Test storage migration using try-runtime on PRs with label "migration" -name: Test storage migration +# Test storage migration using try-runtime on PRs with label "migration-mainnet" +name: Test storage migration for mainnet on: pull_request: @@ -9,7 +9,7 @@ on: jobs: try_runtime: - if: contains(github.event.pull_request.labels.*.name, 'migration') + if: contains(github.event.pull_request.labels.*.name, 'migration-mainnet') runs-on: ubuntu-latest steps: - name: Check out the repo @@ -37,9 +37,9 @@ jobs: # a live RPC node is required for the below work - run: | echo "Found label migration. Running tests" - echo "---------- Running try-runtime for extended-parachain-template ----------" - cargo build -p parachain-template-node --locked --release --no-default-features --features parachain-template-node/mainnet-runtime,try-runtime && \ + echo "---------- Running try-runtime for mainnet extended-parachain-template ----------" + cargo build -p parachain-template-node --locked --release --no-default-features --features try-runtime && \ try-runtime --runtime ./target/release/wbuild/mainnet-runtime/target/wasm32-unknown-unknown/release/mainnet_runtime.wasm \ - on-runtime-upgrade live --uri wss://mainnet-try-runtime-node.parity.io:443 + on-runtime-upgrade live --uri wss://try-runtime-rpc-node.parity.io:443 env: RUST_LOG: remote-ext=debug,runtime=debug From eab8605bb22703559ba0ee6f1c3f91f2fce6be37 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Tue, 19 Sep 2023 08:58:32 -0600 Subject: [PATCH 4/5] specify migration label --- .github/workflows/try-runtime-devnet.yml | 2 +- .github/workflows/try-runtime-mainnet.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/try-runtime-devnet.yml b/.github/workflows/try-runtime-devnet.yml index 60382c2..989703a 100644 --- a/.github/workflows/try-runtime-devnet.yml +++ b/.github/workflows/try-runtime-devnet.yml @@ -36,7 +36,7 @@ jobs: # a live RPC node is required for the below work - run: | - echo "Found label migration. Running tests" + echo "Found label "migration-devnet". Running tests" echo "---------- Running try-runtime for devnet extended-parachain-template ----------" cargo build -p parachain-template-node --locked --release --no-default-features --features try-runtime && \ try-runtime --runtime ./target/release/wbuild/devnet-runtime/target/wasm32-unknown-unknown/release/devnet_runtime.wasm \ diff --git a/.github/workflows/try-runtime-mainnet.yml b/.github/workflows/try-runtime-mainnet.yml index 33d9f04..f55d0e5 100644 --- a/.github/workflows/try-runtime-mainnet.yml +++ b/.github/workflows/try-runtime-mainnet.yml @@ -36,7 +36,7 @@ jobs: # a live RPC node is required for the below work - run: | - echo "Found label migration. Running tests" + echo "Found label "migration-mainnet". Running tests" echo "---------- Running try-runtime for mainnet extended-parachain-template ----------" cargo build -p parachain-template-node --locked --release --no-default-features --features try-runtime && \ try-runtime --runtime ./target/release/wbuild/mainnet-runtime/target/wasm32-unknown-unknown/release/mainnet_runtime.wasm \ From 70dcacede81df94411b9be26b25c69912b60676f Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Fri, 29 Sep 2023 21:13:29 -0400 Subject: [PATCH 5/5] simplify workflow with actions (#88) * simplify workflow with actions --- .github/actions/setup-try-runtime/action.yml | 39 +++++++++++++++++++ .github/templates/setup-worker/action.yml | 19 --------- ...time-devnet.yml => try-runtime.devnet.yml} | 27 +++---------- ...me-mainnet.yml => try-runtime.mainnet.yml} | 25 +++--------- 4 files changed, 50 insertions(+), 60 deletions(-) create mode 100644 .github/actions/setup-try-runtime/action.yml delete mode 100644 .github/templates/setup-worker/action.yml rename .github/workflows/{try-runtime-devnet.yml => try-runtime.devnet.yml} (51%) rename .github/workflows/{try-runtime-mainnet.yml => try-runtime.mainnet.yml} (56%) diff --git a/.github/actions/setup-try-runtime/action.yml b/.github/actions/setup-try-runtime/action.yml new file mode 100644 index 0000000..d251c2b --- /dev/null +++ b/.github/actions/setup-try-runtime/action.yml @@ -0,0 +1,39 @@ +# Install try-runtime +name: Install try-runtime +description: | + This action sets up the rust toolchain, installs the protoc compiler + dependency, rust-cache and try-runtime. + +runs: + using: "composite" + steps: + - name: Free up space on runner + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf "/usr/local/share/boost" + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + shell: bash + + - name: Rust Setup + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + target: wasm32-unknown-unknown + override: true + components: rustfmt, clippy + + - name: Install protoc + run: sudo apt-get install -y protobuf-compiler && protoc --version + shell: bash + + - name: Rust Cache + uses: Swatinem/rust-cache@v2.5.0 + with: + cache-on-failure: true + cache-all-crates: true + + - name: Install try-runtime + run: cargo install --git https://github.com/paritytech/try-runtime-cli --locked + shell: bash \ No newline at end of file diff --git a/.github/templates/setup-worker/action.yml b/.github/templates/setup-worker/action.yml deleted file mode 100644 index 4b62f98..0000000 --- a/.github/templates/setup-worker/action.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: setup-worker -description: | - This action sets up a worker for use in other actions. It installs the - necessary dependencies for building the project. - -runs: - using: "composite" - - steps: - - name: Setup Ubuntu dependencies - shell: bash - run: sudo apt update && sudo apt install -y git clang curl libssl-dev llvm libudev-dev cmake protobuf-compiler - - - name: Install Rust stable - shell: bash - run: | - rustup toolchain install stable --profile minimal --component rustfmt - rustup default stable - rustup target add wasm32-unknown-unknown diff --git a/.github/workflows/try-runtime-devnet.yml b/.github/workflows/try-runtime.devnet.yml similarity index 51% rename from .github/workflows/try-runtime-devnet.yml rename to .github/workflows/try-runtime.devnet.yml index 989703a..b407293 100644 --- a/.github/workflows/try-runtime-devnet.yml +++ b/.github/workflows/try-runtime.devnet.yml @@ -1,5 +1,5 @@ # Test storage migration using try-runtime on PRs with label "migration-devnet" -name: Test storage migration for devnet +name: Test storage migration (devnet) on: pull_request: @@ -12,27 +12,11 @@ jobs: if: contains(github.event.pull_request.labels.*.name, 'migration-devnet') runs-on: ubuntu-latest steps: - - name: Check out the repo + - name: Checkout Repository uses: actions/checkout@v4 - - name: Setup worker - uses: "./.github/templates/setup-worker" - - - name: Cache Build artefacts - uses: actions/cache/restore@v3 - id: cargo-cache - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }} - - - name: Install try-runtime - run: cargo install --git https://github.com/paritytech/try-runtime-cli --locked + - name: Setup try-runtime + uses: ./.github/actions/setup-try-runtime # a live RPC node is required for the below work - run: | @@ -40,6 +24,7 @@ jobs: echo "---------- Running try-runtime for devnet extended-parachain-template ----------" cargo build -p parachain-template-node --locked --release --no-default-features --features try-runtime && \ try-runtime --runtime ./target/release/wbuild/devnet-runtime/target/wasm32-unknown-unknown/release/devnet_runtime.wasm \ - on-runtime-upgrade live --uri wss://dev-try-runtime-rpc-node.parity.io:443 + on-runtime-upgrade live --uri wss://try-runtime-rpc-node.parity.io:443 env: RUST_LOG: remote-ext=debug,runtime=debug + diff --git a/.github/workflows/try-runtime-mainnet.yml b/.github/workflows/try-runtime.mainnet.yml similarity index 56% rename from .github/workflows/try-runtime-mainnet.yml rename to .github/workflows/try-runtime.mainnet.yml index f55d0e5..76ee590 100644 --- a/.github/workflows/try-runtime-mainnet.yml +++ b/.github/workflows/try-runtime.mainnet.yml @@ -1,5 +1,5 @@ # Test storage migration using try-runtime on PRs with label "migration-mainnet" -name: Test storage migration for mainnet +name: Test storage migration (mainnet) on: pull_request: @@ -12,27 +12,11 @@ jobs: if: contains(github.event.pull_request.labels.*.name, 'migration-mainnet') runs-on: ubuntu-latest steps: - - name: Check out the repo + - name: Checkout Repository uses: actions/checkout@v4 - - name: Setup worker - uses: "./.github/templates/setup-worker" - - - name: Cache Build artefacts - uses: actions/cache/restore@v3 - id: cargo-cache - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }} - - - name: Install try-runtime - run: cargo install --git https://github.com/paritytech/try-runtime-cli --locked + - name: Setup try-runtime + uses: ./.github/actions/setup-try-runtime # a live RPC node is required for the below work - run: | @@ -43,3 +27,4 @@ jobs: on-runtime-upgrade live --uri wss://try-runtime-rpc-node.parity.io:443 env: RUST_LOG: remote-ext=debug,runtime=debug +