From 6096d06cf66c716fc47a9510875d023dca05c676 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Wed, 24 Jul 2024 12:49:29 +0200 Subject: [PATCH 01/30] Add zombie_flashbox moonwall suite, not enabled in CI --- test/configs/zombieFlashbox.json | 152 +++++++++++++++++++++ test/moonwall.config.json | 56 ++++++++ test/scripts/build-spec-flashbox.sh | 13 ++ test/suites/para/test_tanssi_containers.ts | 6 +- 4 files changed, 225 insertions(+), 2 deletions(-) create mode 100644 test/configs/zombieFlashbox.json create mode 100755 test/scripts/build-spec-flashbox.sh diff --git a/test/configs/zombieFlashbox.json b/test/configs/zombieFlashbox.json new file mode 100644 index 000000000..9d7973dec --- /dev/null +++ b/test/configs/zombieFlashbox.json @@ -0,0 +1,152 @@ +{ + "settings": { + "timeout": 1000, + "provider": "native" + }, + "relaychain": { + "chain": "rococo-local", + "default_command": "tmp/polkadot", + "default_args": ["--no-hardware-benchmarks", "-lparachain=debug", "--database=paritydb", "--no-beefy"], + "genesis": { + "runtimeGenesis": { + "patch": { + "configuration": { + "config": { + "async_backing_params": { + "allowed_ancestry_len": 2, + "max_candidate_depth": 3 + }, + "scheduler_params": { + "scheduling_lookahead": 2 + } + } + } + } + } + }, + "nodes": [ + { + "name": "alice", + "ws_port": "9947", + "validator": true + }, + { + "name": "bob", + "validator": true + }, + { + "name": "charlie", + "validator": true + }, + { + "name": "dave", + "validator": true + } + ] + }, + "parachains": [ + { + "id": 1000, + "chain_spec_path": "specs/flashbox-1000.json", + "COMMENT": "Important: these collators will not be injected to pallet-invulnerables because zombienet does not support that. When changing the collators list, make sure to update `scripts/build-spec-flashbox.sh`", + "collators": [ + { + "name": "FullNode-1000", + "validator": false, + "command": "../target/release/tanssi-node", + "args": ["--no-hardware-benchmarks", "--database=paritydb", "--wasmtime-precompiled=wasm"], + "ws_port": 9948 + }, + { + "name": "Collator1000-01", + "command": "../target/release/tanssi-node", + "args": ["--no-hardware-benchmarks", "--database=paritydb", "--wasmtime-precompiled=wasm"] + }, + { + "name": "Collator1000-02", + "command": "../target/release/tanssi-node", + "args": ["--no-hardware-benchmarks", "--database=paritydb", "--wasmtime-precompiled=wasm"] + }, + { + "name": "Collator2000-01", + "command": "../target/release/tanssi-node", + "args": ["--no-hardware-benchmarks", "--database=paritydb", "--wasmtime-precompiled=wasm"] + }, + { + "name": "Collator2000-02", + "command": "../target/release/tanssi-node", + "args": ["--no-hardware-benchmarks", "--database=paritydb", "--wasmtime-precompiled=wasm"] + }, + { + "name": "Collator2001-01", + "command": "../target/release/tanssi-node", + "args": ["--no-hardware-benchmarks", "--database=paritydb", "--wasmtime-precompiled=wasm"] + }, + { + "name": "Collator2001-02", + "command": "../target/release/tanssi-node", + "args": ["--no-hardware-benchmarks", "--database=paritydb", "--wasmtime-precompiled=wasm"] + }, + { + "name": "Collator2002-01", + "command": "../target/release/tanssi-node", + "args": ["--no-hardware-benchmarks", "--database=paritydb", "--wasmtime-precompiled=wasm"] + }, + { + "name": "Collator2002-02", + "command": "../target/release/tanssi-node", + "args": ["--no-hardware-benchmarks", "--database=paritydb", "--wasmtime-precompiled=wasm"] + } + ] + }, + { + "id": 2000, + "chain_spec_path": "specs/template-container-2000.json", + "collators": [ + { + "name": "FullNode-2000", + "validator": false, + "command": "../target/release/container-chain-simple-node", + "args": ["--no-hardware-benchmarks", "--database=paritydb", "--wasmtime-precompiled=wasm"], + "ws_port": 9949, + "p2p_port": 33049 + } + ] + }, + { + "id": 2001, + "chain_spec_path": "specs/template-container-2001.json", + "collators": [ + { + "name": "FullNode-2001", + "validator": false, + "command": "../target/release/container-chain-frontier-node", + "args": ["--no-hardware-benchmarks", "--database=paritydb", "--wasmtime-precompiled=wasm"], + "ws_port": 9950, + "p2p_port": 33050 + } + ] + }, + { + "id": 2002, + "chain_spec_path": "specs/template-container-2002.json", + "collators": [ + { + "name": "FullNode-2002", + "validator": false, + "command": "../target/release/container-chain-simple-node", + "args": ["--no-hardware-benchmarks", "--database=paritydb", "--wasmtime-precompiled=wasm"], + "ws_port": 9951, + "p2p_port": 33051 + } + ] + } + ], + "types": { + "Header": { + "number": "u64", + "parent_hash": "Hash", + "post_state": "Hash" + } + } +} diff --git a/test/moonwall.config.json b/test/moonwall.config.json index 8d1f180f6..d1caebdcf 100644 --- a/test/moonwall.config.json +++ b/test/moonwall.config.json @@ -168,6 +168,62 @@ ] } }, + { + "name": "zombie_flashbox", + "timeout": 600000, + "testFileDir": ["suites/para"], + "runScripts": [ + "build-spec-flashbox.sh", + "download-polkadot.sh", + "compile-wasm.ts compile -b ../target/release/tanssi-node -o wasm -c specs/tanssi-1000.json", + "compile-wasm.ts compile -b ../target/release/container-chain-simple-node -o wasm -c specs/template-container-2000.json", + "compile-wasm.ts compile -b ../target/release/container-chain-frontier-node -o wasm -c specs/template-container-2001.json" + ], + "foundation": { + "type": "zombie", + "zombieSpec": { + "configPath": "./configs/zombieFlashbox.json", + "skipBlockCheck": ["Container2002"] + } + }, + "connections": [ + { + "name": "Relay", + "type": "polkadotJs", + "endpoints": ["ws://127.0.0.1:9947"] + }, + { + "name": "Tanssi", + "type": "polkadotJs", + "endpoints": ["ws://127.0.0.1:9948"] + }, + { + "name": "Container2000", + "type": "polkadotJs", + "endpoints": ["ws://127.0.0.1:9949"] + }, + { + "name": "Container2001", + "type": "polkadotJs", + "endpoints": ["ws://127.0.0.1:9950"] + }, + { + "name": "Container2002", + "type": "polkadotJs", + "endpoints": ["ws://127.0.0.1:9951"] + }, + { + "name": "ethers", + "type": "ethers", + "endpoints": ["ws://127.0.0.1:9950"] + }, + { + "name": "w3", + "type": "web3", + "endpoints": ["ws://127.0.0.1:9950"] + } + ] + }, { "name": "zombie_tanssi", "timeout": 600000, diff --git a/test/scripts/build-spec-flashbox.sh b/test/scripts/build-spec-flashbox.sh new file mode 100755 index 000000000..52c72d558 --- /dev/null +++ b/test/scripts/build-spec-flashbox.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Exit on any error +set -e + +# Always run the commands from the "test" dir +cd $(dirname $0)/.. + +mkdir -p specs +../target/release/container-chain-simple-node build-spec --disable-default-bootnode --add-bootnode "/ip4/127.0.0.1/tcp/33049/ws/p2p/12D3KooWHVMhQDHBpj9vQmssgyfspYecgV6e3hH1dQVDUkUbCYC9" --parachain-id 2000 --raw > specs/template-container-2000.json +../target/release/container-chain-frontier-node build-spec --disable-default-bootnode --add-bootnode "/ip4/127.0.0.1/tcp/33050/ws/p2p/12D3KooWFGaw1rxB6MSuN3ucuBm7hMq5pBFJbEoqTyth4cG483Cc" --parachain-id 2001 --raw > specs/template-container-2001.json +../target/release/container-chain-simple-node build-spec --disable-default-bootnode --parachain-id 2002 --raw > specs/template-container-2002.json +../target/release/tanssi-node build-spec --chain flashbox-local --parachain-id 1000 --add-container-chain specs/template-container-2000.json --add-container-chain specs/template-container-2001.json --invulnerable "Collator1000-01" --invulnerable "Collator1000-02" --invulnerable "Collator2002-01" --invulnerable "Collator2002-02" --invulnerable "Collator2000-01" --invulnerable "Collator2000-02" --invulnerable "Collator2001-01" --invulnerable "Collator2001-02" > specs/flashbox-1000.json diff --git a/test/suites/para/test_tanssi_containers.ts b/test/suites/para/test_tanssi_containers.ts index d09c9015b..505eb11f4 100644 --- a/test/suites/para/test_tanssi_containers.ts +++ b/test/suites/para/test_tanssi_containers.ts @@ -36,10 +36,12 @@ describeSuite({ const relayNetwork = relayApi.consts.system.version.specName.toString(); expect(relayNetwork, "Relay API incorrect").to.contain("rococo"); - const paraNetwork = paraApi.consts.system.version.specName.toString(); const paraId1000 = (await paraApi.query.parachainInfo.parachainId()).toString(); - expect(paraNetwork, "Para API incorrect").to.contain("dancebox"); expect(paraId1000, "Para API incorrect").to.be.equal("1000"); + const paraNetwork = paraApi.consts.system.version.specName.toString(); + expect(paraNetwork, "Para API incorrect").to.satisfy( + (network) => network.includes("dancebox") || network.includes("flashbox") + ); const container2000Network = container2000Api.consts.system.version.specName.toString(); const paraId2000 = (await container2000Api.query.parachainInfo.parachainId()).toString(); From 3f71ecd972a29704f8645e400d71c1fa63eec06b Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Wed, 24 Jul 2024 15:49:23 +0200 Subject: [PATCH 02/30] Allow manual running of all zombienet tests in ci --- .github/workflows/run-zombienet-tests.yml | 176 ++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 .github/workflows/run-zombienet-tests.yml diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml new file mode 100644 index 000000000..d2700bb7a --- /dev/null +++ b/.github/workflows/run-zombienet-tests.yml @@ -0,0 +1,176 @@ +name: Manually run all zombienet tests + +on: + workflow_dispatch: + inputs: + test_name: + description: "Name of the test suite to be run (default: \"*\", supports regex)" + required: true + type: string + default: "*" + foundation_type: + description: Foundation type to filter tests, select zombie to run all zombienet tests + required: true + type: choice + options: + - "*" + - zombie + - dev + - chopsticks + - read_only + +jobs: + # Preliminary job to get the list of tests + get-tests: + runs-on: self-hosted + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Pnpm + uses: pnpm/action-setup@v3.0.0 + with: + version: 8 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: "pnpm" + + - name: Get test names + id: get_tests + run: | + # Read and filter the tests from the config file + if [ "${{ github.event.inputs.foundation_type }}" = "*" ]; then + tests=$(jq -r --arg regex "${{ github.event.inputs.test_name }}" ' + .environments + | map(select(.name | test($regex))) + | map(.name) + ' test/moonwall.config.json | jq -c '.') + else + tests=$(jq -r --arg type "${{ github.event.inputs.foundation_type }}" --arg regex "${{ github.event.inputs.test_name }}" ' + .environments + | map(select(.foundation.type == $type)) + | map(select(.name | test($regex))) + | map(.name) + ' test/moonwall.config.json | jq -c '.') + fi + echo "Will run tests: $tests" + echo "::set-output name=tests::$tests" + ####### Building binaries ####### + build: + runs-on: self-hosted + env: + TMP_TARGET: "/tmp/target" + CARGO_TARGET_DIR: "target" + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.set-tags.outputs.git_ref }} + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.4 + - name: Setup Variables + shell: bash + run: | + echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV + echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV + echo "SCCACHE_CACHE_SIZE=100GB" >> $GITHUB_ENV + # Set RUSTFLAGS if not already set + if [ -z "$RUSTFLAGS" ]; then + echo "RUSTFLAGS=-C opt-level=3 -D warnings -C linker=clang -C link-arg=-fuse-ld=$(pwd)/mold/bin/mold" >> $GITHUB_ENV + fi + - name: Setup Mold Linker + shell: bash + run: | + mkdir -p mold + curl -L --retry 10 --silent --show-error https://github.com/rui314/mold/releases/download/v2.30.0/mold-2.30.0-$(uname -m)-linux.tar.gz | tar -C $(realpath mold) --strip-components=1 -xzf - + - name: Setup Rust toolchain + run: rustup show + - name: Build + run: cargo build --features=fast-runtime --release --all + - name: Save runtime wasm + run: | + mkdir -p runtimes + cp $CARGO_TARGET_DIR/release/wbuild/container-chain-template-simple-runtime/container_chain_template_simple_runtime.compact.compressed.wasm runtimes/; + cp $CARGO_TARGET_DIR/release/wbuild/container-chain-template-frontier-runtime/container_chain_template_frontier_runtime.compact.compressed.wasm runtimes/; + cp $CARGO_TARGET_DIR/release/wbuild/dancebox-runtime/dancebox_runtime.compact.compressed.wasm runtimes/; + cp $CARGO_TARGET_DIR/release/wbuild/flashbox-runtime/flashbox_runtime.compact.compressed.wasm runtimes/; + - name: Upload runtimes + uses: actions/upload-artifact@v4 + with: + name: runtimes + path: runtimes + - name: Save tanssi and template binaries + run: | + mkdir -p binaries + cp $CARGO_TARGET_DIR/release/tanssi-node binaries/tanssi-node; + cp $CARGO_TARGET_DIR/release/tanssi-relay binaries/tanssi-relay; + cp $CARGO_TARGET_DIR/release/tanssi-relay-prepare-worker binaries/tanssi-relay-prepare-worker; + cp $CARGO_TARGET_DIR/release/tanssi-relay-execute-worker binaries/tanssi-relay-execute-worker; + cp $CARGO_TARGET_DIR/release/container-chain-frontier-node binaries/container-chain-frontier-node; + cp $CARGO_TARGET_DIR/release/container-chain-simple-node binaries/container-chain-simple-node; + - name: Upload binary + uses: actions/upload-artifact@v4 + with: + name: binaries + path: binaries + + # Run each test as a separate job using a matrix strategy + run-tests: + runs-on: self-hosted + needs: ["get-tests", "build"] + strategy: + matrix: + test_name: ${{ fromJson(needs.get-tests.outputs.tests) }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.set-tags.outputs.git_ref }} + + - name: Pnpm + uses: pnpm/action-setup@v3.0.0 + with: + version: 8 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: "pnpm" + + - name: "Download binaries" + uses: actions/download-artifact@v4 + with: + name: binaries + path: target/release + + - name: "Run zombie test" + run: | + chmod uog+x target/release/tanssi-node + chmod uog+x target/release/tanssi-relay tanssi-relay-prepare-worker tanssi-relay-execute-worker + chmod uog+x target/release/container-chain-simple-node + chmod uog+x target/release/container-chain-frontier-node + + cd test + pnpm install + + ## Run the specific test + pnpm moonwall test "${{ matrix.test_name }}" + + - name: "Gather zombie logs" + if: failure() + run: | + ls -ltr /tmp + latest_zombie_dir=$(find /tmp -type d -iname "*zombie*" -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ") + logs_dir="logs" + mkdir -p "$logs_dir" + find "$latest_zombie_dir" -type f -name "*.log" -exec cp {} "$logs_dir" \; + + - name: "Upload zombie logs" + uses: actions/upload-artifact@v4 + with: + name: logs-${{ matrix.test_name }} + path: logs \ No newline at end of file From 0d0d98bc5f7c0093bb63e0b1cf78f35c02821906 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Wed, 24 Jul 2024 16:06:52 +0200 Subject: [PATCH 03/30] Test workflow by running in this branch --- .github/workflows/run-zombienet-tests.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index d2700bb7a..d52088c23 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -1,6 +1,9 @@ name: Manually run all zombienet tests on: + pull_request: + branches: + - * workflow_dispatch: inputs: test_name: @@ -12,6 +15,7 @@ on: description: Foundation type to filter tests, select zombie to run all zombienet tests required: true type: choice + default: "zombie" options: - "*" - zombie @@ -42,14 +46,14 @@ jobs: id: get_tests run: | # Read and filter the tests from the config file - if [ "${{ github.event.inputs.foundation_type }}" = "*" ]; then - tests=$(jq -r --arg regex "${{ github.event.inputs.test_name }}" ' + if [ "${{ github.event.inputs.foundation_type || 'zombie' }}" = "*" ]; then + tests=$(jq -r --arg regex "${{ github.event.inputs.test_name || '*' }}" ' .environments | map(select(.name | test($regex))) | map(.name) ' test/moonwall.config.json | jq -c '.') else - tests=$(jq -r --arg type "${{ github.event.inputs.foundation_type }}" --arg regex "${{ github.event.inputs.test_name }}" ' + tests=$(jq -r --arg type "${{ github.event.inputs.foundation_type || 'zombie' }}" --arg regex "${{ github.event.inputs.test_name || '*' }}" ' .environments | map(select(.foundation.type == $type)) | map(select(.name | test($regex))) From a2a751fe6c50922695b738121abeeca516730839 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Wed, 24 Jul 2024 16:09:26 +0200 Subject: [PATCH 04/30] Try again --- .github/workflows/run-zombienet-tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index d52088c23..9bab9529d 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -2,8 +2,6 @@ name: Manually run all zombienet tests on: pull_request: - branches: - - * workflow_dispatch: inputs: test_name: From 48ea403a8423145346938d50a013781cd21a2574 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Wed, 24 Jul 2024 16:11:24 +0200 Subject: [PATCH 05/30] Fix regex --- .github/workflows/run-zombienet-tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 9bab9529d..8e64872e5 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -5,10 +5,10 @@ on: workflow_dispatch: inputs: test_name: - description: "Name of the test suite to be run (default: \"*\", supports regex)" + description: "Name of the test suite to be run (e.g. zombie_flashbox, supports regex)" required: true type: string - default: "*" + default: ".*" foundation_type: description: Foundation type to filter tests, select zombie to run all zombienet tests required: true @@ -45,13 +45,13 @@ jobs: run: | # Read and filter the tests from the config file if [ "${{ github.event.inputs.foundation_type || 'zombie' }}" = "*" ]; then - tests=$(jq -r --arg regex "${{ github.event.inputs.test_name || '*' }}" ' + tests=$(jq -r --arg regex "${{ github.event.inputs.test_name || '.*' }}" ' .environments | map(select(.name | test($regex))) | map(.name) ' test/moonwall.config.json | jq -c '.') else - tests=$(jq -r --arg type "${{ github.event.inputs.foundation_type || 'zombie' }}" --arg regex "${{ github.event.inputs.test_name || '*' }}" ' + tests=$(jq -r --arg type "${{ github.event.inputs.foundation_type || 'zombie' }}" --arg regex "${{ github.event.inputs.test_name || '.*' }}" ' .environments | map(select(.foundation.type == $type)) | map(select(.name | test($regex))) From 1dca77bee2a1eb6b027045827a936d8484cdb48d Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Wed, 24 Jul 2024 17:47:47 +0200 Subject: [PATCH 06/30] Try fix --- .github/workflows/run-zombienet-tests.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 8e64872e5..ebbdc2999 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -59,10 +59,17 @@ jobs: ' test/moonwall.config.json | jq -c '.') fi echo "Will run tests: $tests" - echo "::set-output name=tests::$tests" + if [ -z "$tests" ]; then + echo "No tests found. Exiting." + exit 1 + fi + + echo "tests=$(echo $tests | jq -c)" >> $GITHUB_ENV + ####### Building binaries ####### build: runs-on: self-hosted + needs: [ "get-tests" ] env: TMP_TARGET: "/tmp/target" CARGO_TARGET_DIR: "target" @@ -125,7 +132,7 @@ jobs: needs: ["get-tests", "build"] strategy: matrix: - test_name: ${{ fromJson(needs.get-tests.outputs.tests) }} + test_name: ${{ fromJson(env.tests) }} steps: - name: Checkout uses: actions/checkout@v4 @@ -175,4 +182,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: logs-${{ matrix.test_name }} - path: logs \ No newline at end of file + path: logs From 62e7834ec6f9bf3f2476406f7904148fc9e32401 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Wed, 24 Jul 2024 17:51:23 +0200 Subject: [PATCH 07/30] syntax --- .github/workflows/run-zombienet-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index ebbdc2999..53d28152a 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -63,7 +63,6 @@ jobs: echo "No tests found. Exiting." exit 1 fi - echo "tests=$(echo $tests | jq -c)" >> $GITHUB_ENV ####### Building binaries ####### From 086c6eb52da1559c73583aa0d70ed7dc807a0f22 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Wed, 24 Jul 2024 17:55:48 +0200 Subject: [PATCH 08/30] Fix --- .github/workflows/run-zombienet-tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 53d28152a..260c71e0a 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -25,6 +25,8 @@ jobs: # Preliminary job to get the list of tests get-tests: runs-on: self-hosted + outputs: + tests: ${{ steps.get_tests.outputs.tests }} steps: - name: Checkout uses: actions/checkout@v4 @@ -57,7 +59,7 @@ jobs: | map(select(.name | test($regex))) | map(.name) ' test/moonwall.config.json | jq -c '.') - fi + fi echo "Will run tests: $tests" if [ -z "$tests" ]; then echo "No tests found. Exiting." @@ -131,7 +133,7 @@ jobs: needs: ["get-tests", "build"] strategy: matrix: - test_name: ${{ fromJson(env.tests) }} + test_name: ${{ fromJson(needs.get-tests.outputs.tests) }} steps: - name: Checkout uses: actions/checkout@v4 From e207c14d16c3531bb666ef1e4c4e1f6abd76336f Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Wed, 24 Jul 2024 18:15:01 +0200 Subject: [PATCH 09/30] Maybe fix --- .github/workflows/run-zombienet-tests.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 260c71e0a..7ec0ab180 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -26,7 +26,7 @@ jobs: get-tests: runs-on: self-hosted outputs: - tests: ${{ steps.get_tests.outputs.tests }} + tests: ${{ steps.set_tests.outputs.tests }} steps: - name: Checkout uses: actions/checkout@v4 @@ -65,7 +65,11 @@ jobs: echo "No tests found. Exiting." exit 1 fi - echo "tests=$(echo $tests | jq -c)" >> $GITHUB_ENV + echo "tests=$tests" >> $GITHUB_ENV + + - name: Set tests output + id: set_tests + run: echo "tests=${{ env.tests }}" >> $GITHUB_ENV ####### Building binaries ####### build: From c4a3daa972a648666ea6dc45ed28783e6485e360 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Wed, 24 Jul 2024 18:27:49 +0200 Subject: [PATCH 10/30] Refactor all zombienet actions --- .../zombienet-tests/action.yml | 63 ++++ .github/workflows/release.yml | 279 +----------------- .github/workflows/run-zombienet-tests.yml | 53 +--- 3 files changed, 74 insertions(+), 321 deletions(-) create mode 100644 .github/workflow-templates/zombienet-tests/action.yml diff --git a/.github/workflow-templates/zombienet-tests/action.yml b/.github/workflow-templates/zombienet-tests/action.yml new file mode 100644 index 000000000..889688d1a --- /dev/null +++ b/.github/workflow-templates/zombienet-tests/action.yml @@ -0,0 +1,63 @@ +name: Zombienet Tests +description: | + Downloads tanssi binaries compiled in previous step, and executes zombienet test suite using moonwall. + Uploads zombienet logs as an artifact in case of failure. + +inputs: + test_name: + description: Zombienet suite to run + required: true + +runs: + using: "composite" + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.set-tags.outputs.git_ref }} + + - name: Pnpm + uses: pnpm/action-setup@v3.0.0 + with: + version: 8 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: "pnpm" + + - name: "Download binaries" + uses: actions/download-artifact@v4 + with: + name: binaries + path: target/release + + - name: "Run zombie test" + run: | + chmod uog+x target/release/tanssi-node + chmod uog+x target/release/tanssi-relay tanssi-relay-prepare-worker tanssi-relay-execute-worker + chmod uog+x target/release/container-chain-simple-node + chmod uog+x target/release/container-chain-frontier-node + + cd test + pnpm install + + ## Run tests + pnpm moonwall test ${{ inputs.test_name }} + + - name: "Gather zombie logs" + if: failure() + run: | + ls -ltr /tmp + latest_zombie_dir=$(find /tmp -type d -iname "*zombie*" -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ") + logs_dir="logs" + mkdir -p "$logs_dir" + find "$latest_zombie_dir" -type f -name "*.log" -exec cp {} "$logs_dir" \; + + - name: "Upload zombie logs" + if: failure() + uses: actions/upload-artifact@v4 + with: + name: logs-${{ inputs.test_name }} + path: logs \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3a32f5e75..64e9f6d2f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -552,222 +552,14 @@ jobs: zombienet-tests: runs-on: self-hosted needs: ["set-tags", "build"] + strategy: + matrix: + test_name: [zombie_tanssi, zombie_tanssi_parathreads, zombie_tanssi_rotation, zombie_tanssi_warp_sync, zombie_tanssi_relay] steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ needs.set-tags.outputs.git_ref }} - - - name: Pnpm - uses: pnpm/action-setup@v3.0.0 - with: - version: 8 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20.x - cache: "pnpm" - - - name: "Download binaries" - uses: actions/download-artifact@v4 - with: - name: binaries - path: target/release - - - name: "Run zombie test" - run: | - chmod uog+x target/release/tanssi-node - chmod uog+x target/release/container-chain-simple-node - chmod uog+x target/release/container-chain-frontier-node - - cd test - pnpm install - - ## Run tests - - pnpm moonwall test zombie_tanssi - - - name: "Gather zombie logs" - if: failure() - run: | - ls -ltr /tmp - latest_zombie_dir=$(find /tmp -type d -iname "*zombie*" -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ") - logs_dir="logs" - mkdir -p "$logs_dir" - find "$latest_zombie_dir" -type f -name "*.log" -exec cp {} "$logs_dir" \; - - - name: "Upload zombie logs" - if: failure() - uses: actions/upload-artifact@v4 - with: - name: logs - path: logs - - zombienet-tests-parathreads: - runs-on: ubuntu-latest - needs: ["set-tags", "build"] - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ needs.set-tags.outputs.git_ref }} - - - name: Pnpm - uses: pnpm/action-setup@v3.0.0 - with: - version: 8 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20.x - cache: "pnpm" - - - name: "Download binaries" - uses: actions/download-artifact@v4 - with: - name: binaries - path: target/release - - - name: "Run zombie test" - run: | - chmod uog+x target/release/tanssi-node - chmod uog+x target/release/container-chain-simple-node - chmod uog+x target/release/container-chain-frontier-node - - cd test - pnpm install - - ## Run tests - - pnpm moonwall test zombie_tanssi_parathreads - - - name: "Gather zombie logs" - if: failure() - run: | - ls -ltr /tmp - latest_zombie_dir=$(find /tmp -type d -iname "*zombie*" -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ") - logs_dir="logs" - mkdir -p "$logs_dir" - find "$latest_zombie_dir" -type f -name "*.log" -exec cp {} "$logs_dir" \; - - - name: "Upload zombie logs" - if: failure() - uses: actions/upload-artifact@v4 - with: - name: logs-parathreads - path: logs - - zombienet-tests-rotation: - runs-on: self-hosted - needs: ["set-tags", "build"] - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ needs.set-tags.outputs.git_ref }} - - - name: Pnpm - uses: pnpm/action-setup@v3.0.0 - with: - version: 8 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20.x - cache: "pnpm" - - - name: "Download binaries" - uses: actions/download-artifact@v4 - with: - name: binaries - path: target/release - - - name: "Run zombie test" - run: | - chmod uog+x target/release/tanssi-node - chmod uog+x target/release/container-chain-simple-node - chmod uog+x target/release/container-chain-frontier-node - - cd test - pnpm install - - ## Run tests - - pnpm moonwall test zombie_tanssi_rotation - - - name: "Gather zombie logs" - if: failure() - run: | - ls -ltr /tmp - latest_zombie_dir=$(find /tmp -type d -iname "*zombie*" -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ") - logs_dir="logs" - mkdir -p "$logs_dir" - find "$latest_zombie_dir" -type f -name "*.log" -exec cp {} "$logs_dir" \; - - - name: "Upload zombie logs" - if: failure() - uses: actions/upload-artifact@v4 - with: - name: logs-rotation - path: logs - - zombienet-tests-warp-sync: - runs-on: ubuntu-latest - needs: ["set-tags", "build"] - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ needs.set-tags.outputs.git_ref }} - - - name: Pnpm - uses: pnpm/action-setup@v3.0.0 - with: - version: 8 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20.x - cache: "pnpm" - - - name: "Download binaries" - uses: actions/download-artifact@v4 - with: - name: binaries - path: target/release - - - name: "Run zombie test" - run: | - chmod uog+x target/release/tanssi-node - chmod uog+x target/release/container-chain-simple-node - chmod uog+x target/release/container-chain-frontier-node - - cd test - pnpm install - - ## Run tests - - pnpm moonwall test zombie_tanssi_warp_sync - - - name: "Gather zombie logs" - if: failure() - run: | - ls -ltr /tmp - latest_zombie_dir=$(find /tmp -type d -iname "*zombie*" -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ") - logs_dir="logs" - mkdir -p "$logs_dir" - find "$latest_zombie_dir" -type f -name "*.log" -exec cp {} "$logs_dir" \; - - - name: "Upload zombie logs" - if: failure() - uses: actions/upload-artifact@v4 - with: - name: logs-warp-sync - path: logs + - name: Run Zombienet Test ${{ matrix.test_name }} + uses: ./.github/workflow-templates/zombienet-tests/action.yml + with: + test_name: ${{ matrix.test_name }} chopsticks-upgrade-test: runs-on: @@ -937,63 +729,6 @@ jobs: pnpm install pnpm moonwall test zombie_${{ matrix.chains.chain }}_upgrade - zombienet-tests-tanssi-relay: - runs-on: self-hosted - needs: ["set-tags", "build"] - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ needs.set-tags.outputs.git_ref }} - - - name: Pnpm - uses: pnpm/action-setup@v3.0.0 - with: - version: 8 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20.x - cache: "pnpm" - - - name: "Download binaries" - uses: actions/download-artifact@v4 - with: - name: binaries - path: target/release - - - name: "Run zombie test" - run: | - chmod uog+x target/release/tanssi-node - chmod uog+x target/release/tanssi-relay - chmod uog+x target/release/tanssi-relay-execute-worker - chmod uog+x target/release/tanssi-relay-prepare-worker - chmod uog+x target/release/container-chain-simple-node - - cd test - pnpm install - - ## Run tests - - pnpm moonwall test zombie_tanssi_relay - - - name: "Gather zombie logs" - if: failure() - run: | - ls -ltr /tmp - latest_zombie_dir=$(find /tmp -type d -iname "*zombie*" -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ") - logs_dir="logs" - mkdir -p "$logs_dir" - find "$latest_zombie_dir" -type f -name "*.log" -exec cp {} "$logs_dir" \; - - - name: "Upload zombie logs" - if: failure() - uses: actions/upload-artifact@v4 - with: - name: logs-tanssi-relay - path: logs - docker-tanssi: runs-on: ubuntu-latest needs: ["set-tags", "build"] diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 7ec0ab180..b8a9aa2f5 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -134,57 +134,12 @@ jobs: # Run each test as a separate job using a matrix strategy run-tests: runs-on: self-hosted - needs: ["get-tests", "build"] + needs: [ "set-tags", "build" ] strategy: matrix: test_name: ${{ fromJson(needs.get-tests.outputs.tests) }} steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ needs.set-tags.outputs.git_ref }} - - - name: Pnpm - uses: pnpm/action-setup@v3.0.0 - with: - version: 8 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20.x - cache: "pnpm" - - - name: "Download binaries" - uses: actions/download-artifact@v4 - with: - name: binaries - path: target/release - - - name: "Run zombie test" - run: | - chmod uog+x target/release/tanssi-node - chmod uog+x target/release/tanssi-relay tanssi-relay-prepare-worker tanssi-relay-execute-worker - chmod uog+x target/release/container-chain-simple-node - chmod uog+x target/release/container-chain-frontier-node - - cd test - pnpm install - - ## Run the specific test - pnpm moonwall test "${{ matrix.test_name }}" - - - name: "Gather zombie logs" - if: failure() - run: | - ls -ltr /tmp - latest_zombie_dir=$(find /tmp -type d -iname "*zombie*" -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ") - logs_dir="logs" - mkdir -p "$logs_dir" - find "$latest_zombie_dir" -type f -name "*.log" -exec cp {} "$logs_dir" \; - - - name: "Upload zombie logs" - uses: actions/upload-artifact@v4 + - name: Run Zombienet Test ${{ matrix.test_name }} + uses: ./.github/workflow-templates/zombienet-tests/action.yml with: - name: logs-${{ matrix.test_name }} - path: logs + test_name: ${{ matrix.test_name }} From e965037366961f404f35a272e8124d691696d364 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Wed, 24 Jul 2024 18:31:11 +0200 Subject: [PATCH 11/30] fix --- .github/workflows/run-zombienet-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index b8a9aa2f5..3b0eb95e6 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -134,7 +134,7 @@ jobs: # Run each test as a separate job using a matrix strategy run-tests: runs-on: self-hosted - needs: [ "set-tags", "build" ] + needs: [ "get-tests", "build" ] strategy: matrix: test_name: ${{ fromJson(needs.get-tests.outputs.tests) }} From c9a066e3bef68e4e0859918ce3d2466ec8a3e442 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Wed, 24 Jul 2024 18:50:49 +0200 Subject: [PATCH 12/30] github output --- .github/workflows/run-zombienet-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 3b0eb95e6..1d2dd65d7 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -69,7 +69,7 @@ jobs: - name: Set tests output id: set_tests - run: echo "tests=${{ env.tests }}" >> $GITHUB_ENV + run: echo "tests=${{ env.tests }}" >> $GITHUB_OUTPUT ####### Building binaries ####### build: From bc2002b61b8eab46880997de74a74bba4b8d9718 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 12:25:39 +0200 Subject: [PATCH 13/30] Fix workflow add missing checkout --- .github/workflow-templates/zombienet-tests/action.yml | 5 ----- .github/workflows/release.yml | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflow-templates/zombienet-tests/action.yml b/.github/workflow-templates/zombienet-tests/action.yml index 889688d1a..83bd12249 100644 --- a/.github/workflow-templates/zombienet-tests/action.yml +++ b/.github/workflow-templates/zombienet-tests/action.yml @@ -11,11 +11,6 @@ inputs: runs: using: "composite" steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ needs.set-tags.outputs.git_ref }} - - name: Pnpm uses: pnpm/action-setup@v3.0.0 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 64e9f6d2f..68be1c7b1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -556,6 +556,10 @@ jobs: matrix: test_name: [zombie_tanssi, zombie_tanssi_parathreads, zombie_tanssi_rotation, zombie_tanssi_warp_sync, zombie_tanssi_relay] steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.set-tags.outputs.git_ref }} - name: Run Zombienet Test ${{ matrix.test_name }} uses: ./.github/workflow-templates/zombienet-tests/action.yml with: From ca7a1dae079a0235b38f2c1a57c84a063e7fa455 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 12:31:48 +0200 Subject: [PATCH 14/30] Fix chmod tanssi-relay --- .github/workflow-templates/zombienet-tests/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflow-templates/zombienet-tests/action.yml b/.github/workflow-templates/zombienet-tests/action.yml index 83bd12249..bf89d311e 100644 --- a/.github/workflow-templates/zombienet-tests/action.yml +++ b/.github/workflow-templates/zombienet-tests/action.yml @@ -31,7 +31,9 @@ runs: - name: "Run zombie test" run: | chmod uog+x target/release/tanssi-node - chmod uog+x target/release/tanssi-relay tanssi-relay-prepare-worker tanssi-relay-execute-worker + chmod uog+x target/release/tanssi-relay + chmod uog+x target/release/tanssi-relay-prepare-worker + chmod uog+x target/release/tanssi-relay-execute-worker chmod uog+x target/release/container-chain-simple-node chmod uog+x target/release/container-chain-frontier-node From b346ee0404e141dbf30b83b21eec79dd980aa306 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 13:43:30 +0200 Subject: [PATCH 15/30] Fix use of workflow template --- .github/workflows/release.yml | 2 +- .github/workflows/run-zombienet-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68be1c7b1..9958a5d05 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -561,7 +561,7 @@ jobs: with: ref: ${{ needs.set-tags.outputs.git_ref }} - name: Run Zombienet Test ${{ matrix.test_name }} - uses: ./.github/workflow-templates/zombienet-tests/action.yml + uses: ./.github/workflow-templates/zombienet-tests with: test_name: ${{ matrix.test_name }} diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 1d2dd65d7..249dd786c 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -140,6 +140,6 @@ jobs: test_name: ${{ fromJson(needs.get-tests.outputs.tests) }} steps: - name: Run Zombienet Test ${{ matrix.test_name }} - uses: ./.github/workflow-templates/zombienet-tests/action.yml + uses: ./.github/workflow-templates/zombienet-tests with: test_name: ${{ matrix.test_name }} From f6d9a7a119ffcb4399dd9610955a55056e505139 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 14:36:27 +0200 Subject: [PATCH 16/30] shell: bash --- .github/workflow-templates/zombienet-tests/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflow-templates/zombienet-tests/action.yml b/.github/workflow-templates/zombienet-tests/action.yml index bf89d311e..9b3d80cc5 100644 --- a/.github/workflow-templates/zombienet-tests/action.yml +++ b/.github/workflow-templates/zombienet-tests/action.yml @@ -29,6 +29,7 @@ runs: path: target/release - name: "Run zombie test" + shell: bash run: | chmod uog+x target/release/tanssi-node chmod uog+x target/release/tanssi-relay @@ -45,6 +46,7 @@ runs: - name: "Gather zombie logs" if: failure() + shell: bash run: | ls -ltr /tmp latest_zombie_dir=$(find /tmp -type d -iname "*zombie*" -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ") @@ -57,4 +59,4 @@ runs: uses: actions/upload-artifact@v4 with: name: logs-${{ inputs.test_name }} - path: logs \ No newline at end of file + path: logs From 3a2a79b2d36a71081c05a03ec279d14d00817f25 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 15:23:07 +0200 Subject: [PATCH 17/30] Change JSON format to matrix compatible one --- .github/workflows/run-zombienet-tests.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 249dd786c..fb34a80a5 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -26,7 +26,7 @@ jobs: get-tests: runs-on: self-hosted outputs: - tests: ${{ steps.set_tests.outputs.tests }} + matrix: ${{ steps.set_tests.outputs.tests }} steps: - name: Checkout uses: actions/checkout@v4 @@ -69,7 +69,9 @@ jobs: - name: Set tests output id: set_tests - run: echo "tests=${{ env.tests }}" >> $GITHUB_OUTPUT + run: | + include_tests=$(jq -c --argjson tests "${{ env.tests }}" '{include: $tests | map({test_name: .})}') + echo "tests=$include_tests" >> $GITHUB_OUTPUT ####### Building binaries ####### build: @@ -137,9 +139,19 @@ jobs: needs: [ "get-tests", "build" ] strategy: matrix: - test_name: ${{ fromJson(needs.get-tests.outputs.tests) }} + test_name: ${{ fromJSON(needs.get-tests.outputs.matrix) }} steps: - name: Run Zombienet Test ${{ matrix.test_name }} uses: ./.github/workflow-templates/zombienet-tests with: test_name: ${{ matrix.test_name }} + + # Debugging outputs and fromJSON + # TODO: remove before merging + job2: + needs: [ "get-tests" ] + runs-on: self-hosted + strategy: + matrix: ${{ fromJSON(needs.get-tests.outputs.matrix) }} + steps: + - run: echo "Matrix - Test ${{ matrix.test_name }}" From b930814952925541d5ae4f7960932906b9efc73a Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 15:25:35 +0200 Subject: [PATCH 18/30] JSON errors --- .github/workflows/run-zombienet-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index fb34a80a5..7f888575a 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -70,7 +70,7 @@ jobs: - name: Set tests output id: set_tests run: | - include_tests=$(jq -c --argjson tests "${{ env.tests }}" '{include: $tests | map({test_name: .})}') + include_tests=$(echo "${{ env.tests }}" | jq -c '{include: . | map({test_name: .})}') echo "tests=$include_tests" >> $GITHUB_OUTPUT ####### Building binaries ####### From c0f4807195918bb21f048e425ed645381e825374 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 15:39:43 +0200 Subject: [PATCH 19/30] Fix JSON? --- .github/workflows/run-zombienet-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 7f888575a..768d7b63d 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -71,6 +71,7 @@ jobs: id: set_tests run: | include_tests=$(echo "${{ env.tests }}" | jq -c '{include: . | map({test_name: .})}') + echo "Formatted tests JSON: $include_tests" echo "tests=$include_tests" >> $GITHUB_OUTPUT ####### Building binaries ####### From abfa8fb368e0ad6d43128ee4145090ae02808733 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 15:43:42 +0200 Subject: [PATCH 20/30] Escape JSON? --- .github/workflows/run-zombienet-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 768d7b63d..31f6d6df9 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -70,7 +70,8 @@ jobs: - name: Set tests output id: set_tests run: | - include_tests=$(echo "${{ env.tests }}" | jq -c '{include: . | map({test_name: .})}') + tests_escaped=$(echo "${{ env.tests }}" | jq @json) + include_tests=$(echo "$tests_escaped" | jq -nc --argjson tests "$tests_escaped" '{include: $tests | map({test_name: .})}') echo "Formatted tests JSON: $include_tests" echo "tests=$include_tests" >> $GITHUB_OUTPUT From 9214b3cdf80a7d0042114cefaf7881278763964a Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 15:46:00 +0200 Subject: [PATCH 21/30] please --- .github/workflows/run-zombienet-tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 31f6d6df9..963094432 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -70,8 +70,7 @@ jobs: - name: Set tests output id: set_tests run: | - tests_escaped=$(echo "${{ env.tests }}" | jq @json) - include_tests=$(echo "$tests_escaped" | jq -nc --argjson tests "$tests_escaped" '{include: $tests | map({test_name: .})}') + include_tests=$(echo "${{ env.tests }}" | jq -R -s '. | {include: (fromjson | map({test_name: .}))}') echo "Formatted tests JSON: $include_tests" echo "tests=$include_tests" >> $GITHUB_OUTPUT From b58355d39516d5debdb557115ab3a4e1b9b3fb02 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 15:52:41 +0200 Subject: [PATCH 22/30] Revert "please" This reverts commit 9214b3cdf80a7d0042114cefaf7881278763964a. --- .github/workflows/run-zombienet-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 963094432..31f6d6df9 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -70,7 +70,8 @@ jobs: - name: Set tests output id: set_tests run: | - include_tests=$(echo "${{ env.tests }}" | jq -R -s '. | {include: (fromjson | map({test_name: .}))}') + tests_escaped=$(echo "${{ env.tests }}" | jq @json) + include_tests=$(echo "$tests_escaped" | jq -nc --argjson tests "$tests_escaped" '{include: $tests | map({test_name: .})}') echo "Formatted tests JSON: $include_tests" echo "tests=$include_tests" >> $GITHUB_OUTPUT From 892f8405e90b836486f65af589cfae17b24fc9ce Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 15:53:01 +0200 Subject: [PATCH 23/30] Revert "Escape JSON?" This reverts commit abfa8fb368e0ad6d43128ee4145090ae02808733. --- .github/workflows/run-zombienet-tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 31f6d6df9..768d7b63d 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -70,8 +70,7 @@ jobs: - name: Set tests output id: set_tests run: | - tests_escaped=$(echo "${{ env.tests }}" | jq @json) - include_tests=$(echo "$tests_escaped" | jq -nc --argjson tests "$tests_escaped" '{include: $tests | map({test_name: .})}') + include_tests=$(echo "${{ env.tests }}" | jq -c '{include: . | map({test_name: .})}') echo "Formatted tests JSON: $include_tests" echo "tests=$include_tests" >> $GITHUB_OUTPUT From ced29aff3e42dfe46e585baeb8b16356d508271e Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 15:53:23 +0200 Subject: [PATCH 24/30] Maybe this? --- .github/workflows/run-zombienet-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 768d7b63d..1633caf20 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -70,7 +70,7 @@ jobs: - name: Set tests output id: set_tests run: | - include_tests=$(echo "${{ env.tests }}" | jq -c '{include: . | map({test_name: .})}') + include_tests=$(echo '${{ env.tests }}' | jq -c '{include: . | map({test_name: .})}') echo "Formatted tests JSON: $include_tests" echo "tests=$include_tests" >> $GITHUB_OUTPUT From 9c0ea6abdc76a5bd1d4aa2a11e9c180d0c7f8dc5 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 15:55:34 +0200 Subject: [PATCH 25/30] Remove debugging stuff --- .github/workflows/run-zombienet-tests.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 1633caf20..de8008c49 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -71,7 +71,6 @@ jobs: id: set_tests run: | include_tests=$(echo '${{ env.tests }}' | jq -c '{include: . | map({test_name: .})}') - echo "Formatted tests JSON: $include_tests" echo "tests=$include_tests" >> $GITHUB_OUTPUT ####### Building binaries ####### @@ -146,13 +145,3 @@ jobs: uses: ./.github/workflow-templates/zombienet-tests with: test_name: ${{ matrix.test_name }} - - # Debugging outputs and fromJSON - # TODO: remove before merging - job2: - needs: [ "get-tests" ] - runs-on: self-hosted - strategy: - matrix: ${{ fromJSON(needs.get-tests.outputs.matrix) }} - steps: - - run: echo "Matrix - Test ${{ matrix.test_name }}" From f9b0b9543dc4c836d34b89d71d0c4b3990633f9c Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 16:16:12 +0200 Subject: [PATCH 26/30] Fix matrix key --- .github/workflows/run-zombienet-tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index de8008c49..d77680ce4 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -138,8 +138,7 @@ jobs: runs-on: self-hosted needs: [ "get-tests", "build" ] strategy: - matrix: - test_name: ${{ fromJSON(needs.get-tests.outputs.matrix) }} + matrix: ${{ fromJSON(needs.get-tests.outputs.matrix) }} steps: - name: Run Zombienet Test ${{ matrix.test_name }} uses: ./.github/workflow-templates/zombienet-tests From f13cb4398eaa8d6ae80d606114c1b9d35dc09649 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 16:50:05 +0200 Subject: [PATCH 27/30] Exclude upgrade tests --- .github/workflows/run-zombienet-tests.yml | 27 ++++++++++------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index d77680ce4..466905e00 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -45,21 +45,18 @@ jobs: - name: Get test names id: get_tests run: | - # Read and filter the tests from the config file - if [ "${{ github.event.inputs.foundation_type || 'zombie' }}" = "*" ]; then - tests=$(jq -r --arg regex "${{ github.event.inputs.test_name || '.*' }}" ' - .environments - | map(select(.name | test($regex))) - | map(.name) - ' test/moonwall.config.json | jq -c '.') - else - tests=$(jq -r --arg type "${{ github.event.inputs.foundation_type || 'zombie' }}" --arg regex "${{ github.event.inputs.test_name || '.*' }}" ' - .environments - | map(select(.foundation.type == $type)) - | map(select(.name | test($regex))) - | map(.name) - ' test/moonwall.config.json | jq -c '.') - fi + foundation_type=${{ github.event.inputs.foundation_type || 'zombie' }} + test_name=${{ github.event.inputs.test_name || '.*' }} + + # Read and filter the tests from the config file using regex and foundation type + # Exclude zombie upgrade tests because they need more complex logic, using docker + tests=$(jq -r --arg type "$foundation_type" --arg regex "$test_name" ' + .environments + | map(select((.foundation.type == $type or $type == "*") and (.name | test($regex)))) + | map(.name) + | if $type == "zombie" then map(select(test("_upgrade$") | not)) else . end # Exclude upgrade tests only if foundation type is zombie + ' test/moonwall.config.json | jq -c '.') + echo "Will run tests: $tests" if [ -z "$tests" ]; then echo "No tests found. Exiting." From 1b6b854055cfb62b23e7f0465a3d9edb644229ae Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 30 Jul 2024 18:16:22 +0200 Subject: [PATCH 28/30] Fix wasm precompile for flashbox --- test/moonwall.config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/moonwall.config.json b/test/moonwall.config.json index 2677cc343..c7b295b31 100644 --- a/test/moonwall.config.json +++ b/test/moonwall.config.json @@ -175,7 +175,7 @@ "runScripts": [ "build-spec-flashbox.sh", "download-polkadot.sh", - "compile-wasm.ts compile -b ../target/release/tanssi-node -o wasm -c specs/tanssi-1000.json", + "compile-wasm.ts compile -b ../target/release/tanssi-node -o wasm -c specs/flashbox-1000.json", "compile-wasm.ts compile -b ../target/release/container-chain-simple-node -o wasm -c specs/template-container-2000.json", "compile-wasm.ts compile -b ../target/release/container-chain-frontier-node -o wasm -c specs/template-container-2001.json" ], From 00bf5c508a6a6ad9ad6f775087ebcc1aa81f9ca1 Mon Sep 17 00:00:00 2001 From: tmpolaczyk <44604217+tmpolaczyk@users.noreply.github.com> Date: Wed, 31 Jul 2024 10:36:51 +0200 Subject: [PATCH 29/30] Update .github/workflows/run-zombienet-tests.yml --- .github/workflows/run-zombienet-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 466905e00..916f08391 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -1,7 +1,6 @@ name: Manually run all zombienet tests on: - pull_request: workflow_dispatch: inputs: test_name: From b996f6bb3ae21b5b8b308065386c75e7b4e1ab9c Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Wed, 31 Jul 2024 11:50:10 +0200 Subject: [PATCH 30/30] Add fail-fast: false to matrix jobs --- .github/workflows/release.yml | 5 +++++ .github/workflows/run-zombienet-tests.yml | 1 + 2 files changed, 6 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9958a5d05..7ee29a61c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -553,6 +553,7 @@ jobs: runs-on: self-hosted needs: ["set-tags", "build"] strategy: + fail-fast: false matrix: test_name: [zombie_tanssi, zombie_tanssi_parathreads, zombie_tanssi_rotation, zombie_tanssi_warp_sync, zombie_tanssi_relay] steps: @@ -570,6 +571,7 @@ jobs: labels: ubuntu-latest needs: ["set-tags", "build"] strategy: + fail-fast: false matrix: chains: [ { chain: "stagenet_dancebox", runtime: "dancebox" }, @@ -611,6 +613,7 @@ jobs: runs-on: self-hosted needs: ["set-tags", "build"] strategy: + fail-fast: false matrix: chain: ["dancebox"] steps: @@ -690,6 +693,7 @@ jobs: runs-on: self-hosted needs: ["set-tags", "build"] strategy: + fail-fast: false matrix: chains: [ { chain: "frontier_template", runtime: "container-chain-template-frontier" }, @@ -737,6 +741,7 @@ jobs: runs-on: ubuntu-latest needs: ["set-tags", "build"] strategy: + fail-fast: false matrix: image: ["tanssi", "container-chain-simple-template", "container-chain-evm-template"] if: ${{ (needs.set-tags.outputs.image_exists == 'false') && (github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push') }} diff --git a/.github/workflows/run-zombienet-tests.yml b/.github/workflows/run-zombienet-tests.yml index 916f08391..cf6f2229c 100644 --- a/.github/workflows/run-zombienet-tests.yml +++ b/.github/workflows/run-zombienet-tests.yml @@ -134,6 +134,7 @@ jobs: runs-on: self-hosted needs: [ "get-tests", "build" ] strategy: + fail-fast: false matrix: ${{ fromJSON(needs.get-tests.outputs.matrix) }} steps: - name: Run Zombienet Test ${{ matrix.test_name }}