From b5f6adc93a073d5925477d20a9669fbb111d64fe Mon Sep 17 00:00:00 2001 From: Przemek Rzad Date: Fri, 16 Aug 2024 11:15:59 +0200 Subject: [PATCH] Add a zombienet smoke test (#17) --- .../actions/ubuntu-dependencies/action.yml | 1 - .github/tests/zombienet-smoke-test.zndsl | 22 ++++++++++ .github/workflows/ci.yml | 31 ++------------ .github/workflows/test-zombienet.yml | 42 +++++++++++++++++++ 4 files changed, 68 insertions(+), 28 deletions(-) create mode 100644 .github/tests/zombienet-smoke-test.zndsl create mode 100644 .github/workflows/test-zombienet.yml diff --git a/.github/actions/ubuntu-dependencies/action.yml b/.github/actions/ubuntu-dependencies/action.yml index c577567..ed8f3a8 100644 --- a/.github/actions/ubuntu-dependencies/action.yml +++ b/.github/actions/ubuntu-dependencies/action.yml @@ -5,7 +5,6 @@ runs: using: "composite" steps: - name: Rust compilation prerequisites (Ubuntu) - if: contains(matrix.os, 'ubuntu') run: | sudo apt update sudo apt install -y \ diff --git a/.github/tests/zombienet-smoke-test.zndsl b/.github/tests/zombienet-smoke-test.zndsl new file mode 100644 index 0000000..30b2c63 --- /dev/null +++ b/.github/tests/zombienet-smoke-test.zndsl @@ -0,0 +1,22 @@ +Description: Smoke test of the network +Network: ../../zombienet.toml +Creds: config + +alice: is up +bob: is up +charlie: is up + +alice: log line matches "Imported #[0-9]+" within 20 seconds +bob: log line matches "Imported #[0-9]+" within 20 seconds + +alice: parachain 1000 is registered within 60 seconds +alice: parachain 1000 block height is at least 10 within 200 seconds + +alice: count of log lines matching "err=" is 0 within 10 seconds +alice: count of log lines matching "Error" is 0 within 10 seconds + +bob: count of log lines matching "err=" is 0 within 10 seconds +bob: count of log lines matching "Error" is 0 within 10 seconds + +charlie: count of log lines matching "err=" is 0 within 10 seconds +charlie: count of log lines matching "Error" is 0 within 10 seconds diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0dd142e..96658c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ concurrency: cancel-in-progress: true jobs: - build: + ci: runs-on: ${{ matrix.os }} strategy: matrix: @@ -45,35 +45,12 @@ jobs: run: SKIP_WASM_BUILD=1 cargo doc --workspace --no-deps timeout-minutes: 15 - run-node: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - steps: - - uses: actions/checkout@v4 - - - if: contains(matrix.os, 'ubuntu') - uses: ./.github/actions/free-disk-space - - if: contains(matrix.os, 'ubuntu') - uses: ./.github/actions/ubuntu-dependencies - - if: contains(matrix.os, 'macos') - uses: ./.github/actions/macos-dependencies - - - name: Build the node individually in release mode - run: cargo build --package parachain-template-node --release - timeout-minutes: 90 - # This test only makes sure the node got successfully built - # and can be executed without issues. - # A test including a relaychain will be done separately. + # and can be executed without issues on Ubuntu and macOS. + # Check the `test-zombienet` workflow for a parachain smoke test. - name: Check that the node starts up run: | - ./target/release/parachain-template-node --dev 2>&1 | tee out.txt & - until curl -s '127.0.0.1:9944'; do sleep 5; done - until cat out.txt | grep -s "💤 Idle"; do sleep 5; done - shell: bash - timeout-minutes: 5 + ./target/debug/parachain-template-node --help build-docker: runs-on: ubuntu-latest diff --git a/.github/workflows/test-zombienet.yml b/.github/workflows/test-zombienet.yml new file mode 100644 index 0000000..759344a --- /dev/null +++ b/.github/workflows/test-zombienet.yml @@ -0,0 +1,42 @@ +name: Test Zombienet + +on: + pull_request: + push: + branches: + - main + - master + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test-zombienet: + runs-on: ubuntu-latest + env: + POLKADOT_VERSION: stable2407 + steps: + - uses: actions/checkout@v4 + + - uses: ./.github/actions/free-disk-space + - uses: ./.github/actions/ubuntu-dependencies + + - name: Build the node individually in release mode + run: cargo build --package parachain-template-node --release + timeout-minutes: 90 + + - name: Download relaychain binaries + run: | + wget --no-verbose https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-${{ env.POLKADOT_VERSION }}/polkadot + wget --no-verbose https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-${{ env.POLKADOT_VERSION }}/polkadot-prepare-worker + wget --no-verbose https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-${{ env.POLKADOT_VERSION }}/polkadot-execute-worker + chmod +x ./polkadot* + working-directory: ./target/release + + - name: Run zombienet tests + run: | + export PATH="./target/release:$PATH" + npx --yes @zombienet/cli --provider native test .github/tests/zombienet-smoke-test.zndsl + shell: bash + timeout-minutes: 10