Add polkadot bulletin parachain #1147
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Integration Tests | |
| # Controls when the action will run. | |
| on: | |
| # Triggers the workflow on push or pull request events but only for the master branch | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Cancel previous runs | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| env: | |
| POLKADOT_SDK_BIN_DIR: ${{ github.workspace }}/.polkadot-sdk-bin | |
| ZOMBIENET_BIN_DIR: ${{ github.workspace }}/.zombienet-bin | |
| jobs: | |
| changes: | |
| uses: ./.github/workflows/check-changed-files.yml | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| set-image: | |
| if: needs.changes.outputs.should-run == 'true' | |
| needs: [changes] | |
| uses: ./.github/workflows/set-image.yml | |
| setup: | |
| if: needs.changes.outputs.should-run == 'true' | |
| needs: [changes, set-image] | |
| name: Setup | |
| runs-on: parity-large | |
| container: | |
| image: ${{ needs.set-image.outputs.CI_IMAGE }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Load common environment variables via env file | |
| run: cat .github/env >> $GITHUB_ENV | |
| # Cache the Polkadot SDK binaries | |
| - name: Cache Polkadot SDK binaries | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5 | |
| id: polkadot-sdk-cache | |
| with: | |
| path: ${{ env.POLKADOT_SDK_BIN_DIR }} | |
| key: polkadot-sdk-${{ env.POLKADOT_SDK_VERSION }}-${{ env.POLKADOT_SDK_VERSION_WITH_BULLETIN }}-binaries | |
| # Download and extract binaries if cache missed | |
| - name: Download Polkadot SDK binaries | |
| if: steps.polkadot-sdk-cache.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir -p $POLKADOT_SDK_BIN_DIR | |
| cd $POLKADOT_SDK_BIN_DIR | |
| echo "Downloading Polkadot SDK binaries..." | |
| curl -fL -o polkadot https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/polkadot | |
| curl -fL -o polkadot-prepare-worker https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/polkadot-prepare-worker | |
| curl -fL -o polkadot-execute-worker https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/polkadot-execute-worker | |
| curl -fL -o chain-spec-builder https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/chain-spec-builder | |
| # TODO: replace POLKADOT_SDK_VERSION_WITH_BULLETIN with POLKADOT_SDK_VERSION when released: https://github.com/paritytech/polkadot-sdk/pull/10662 | |
| curl -fL -o polkadot-omni-node https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION_WITH_BULLETIN}/polkadot-omni-node | |
| echo "${POLKADOT_SHA256} polkadot" | sha256sum -c - | |
| echo "${POLKADOT_PREPARE_WORKER_SHA256} polkadot-prepare-worker" | sha256sum -c - | |
| echo "${POLKADOT_EXECUTE_WORKER_SHA256} polkadot-execute-worker" | sha256sum -c - | |
| echo "${CHAIN_SPEC_BUILDER_SHA256} chain-spec-builder" | sha256sum -c - | |
| echo "${POLKADOT_OMNI_NODE_SHA256} polkadot-omni-node" | sha256sum -c - | |
| chmod +x * | |
| # Cache the Zombienet binaries | |
| - name: Cache Zombienet | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5 | |
| id: zombienet-cache | |
| with: | |
| path: ${{ env.ZOMBIENET_BIN_DIR }} | |
| key: zombienet-${{ env.ZOMBIENET_VERSION }}-binaries | |
| # Download and extract binaries if cache missed | |
| # NOTE: zombienet releases do not publish checksums | |
| - name: Download Zombienet binaries | |
| if: steps.zombienet-cache.outputs.cache-hit != 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: | | |
| mkdir -p $ZOMBIENET_BIN_DIR | |
| cd $ZOMBIENET_BIN_DIR | |
| curl -fL \ | |
| -H "Authorization: token ${GITHUB_TOKEN}" \ | |
| -o zombienet-linux-x64 \ | |
| "https://github.com/paritytech/zombienet/releases/download/${ZOMBIENET_VERSION}/zombienet-linux-x64" | |
| chmod +x zombienet-linux-x64 | |
| # Cache the Polkadot relay runtime WASM (fast-runtime, from polkadot-fellows/runtimes) | |
| - name: Cache Polkadot relay runtime WASM | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5 | |
| id: relay-runtime-cache | |
| with: | |
| path: examples/production-runtimes | |
| key: polkadot-relay-runtime-${{ env.FELLOWS_VERSION }} | |
| - name: Build Polkadot relay runtime WASM | |
| if: steps.relay-runtime-cache.outputs.cache-hit != 'true' | |
| run: ./scripts/build_polkadot_relay_runtime.sh | |
| runtime-matrix: | |
| if: needs.changes.outputs.should-run == 'true' | |
| needs: [changes] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| runtime: ${{ steps.runtime.outputs.runtime }} | |
| name: Extract tasks from matrix | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - id: runtime | |
| run: | | |
| TASKS=$(jq '[.[] | select(.integration_tests == true)]' scripts/runtimes-matrix.json) | |
| SKIPPED=$(jq '[.[] | select(.integration_tests != true)]' scripts/runtimes-matrix.json) | |
| echo "--- Running integration tests for ---" | |
| echo "$TASKS" | |
| echo "--- Skipping integration tests for ---" | |
| echo "$SKIPPED" | |
| TASKS=$(echo "$TASKS" | jq -c .) | |
| echo "runtime=$TASKS" >> $GITHUB_OUTPUT | |
| integration-tests: | |
| needs: [set-image, setup, runtime-matrix] | |
| name: Integration Tests (${{ matrix.runtime.name }}) | |
| runs-on: parity-large | |
| container: | |
| image: ${{ needs.set-image.outputs.CI_IMAGE }} | |
| timeout-minutes: 200 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Load common environment variables via env file | |
| run: cat .github/env >> $GITHUB_ENV | |
| - name: Rust cache (Bulletin) | |
| uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | |
| with: | |
| workspaces: . | |
| shared-key: "bulletin-cache-bulletin-integration-tests" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: examples/package.json | |
| - name: Install just | |
| run: cargo install just --locked || true | |
| - name: Cache Polkadot SDK binaries | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5 | |
| id: polkadot-sdk-cache | |
| with: | |
| path: ${{ env.POLKADOT_SDK_BIN_DIR }} | |
| key: polkadot-sdk-${{ env.POLKADOT_SDK_VERSION }}-${{ env.POLKADOT_SDK_VERSION_WITH_BULLETIN }}-binaries | |
| - name: Cache Zombienet | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5 | |
| id: zombienet-cache | |
| with: | |
| path: ${{ env.ZOMBIENET_BIN_DIR }} | |
| key: zombienet-${{ env.ZOMBIENET_VERSION }}-binaries | |
| - name: Cache Polkadot relay runtime WASM | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5 | |
| id: relay-runtime-cache | |
| with: | |
| path: examples/production-runtimes | |
| key: polkadot-relay-runtime-${{ env.FELLOWS_VERSION }} | |
| - name: Add binaries to PATH | |
| run: | | |
| chmod +x "${POLKADOT_SDK_BIN_DIR}"/* | |
| ls -lrt "${POLKADOT_SDK_BIN_DIR}" | |
| chmod +x "${ZOMBIENET_BIN_DIR}"/* | |
| ls -lrt "${ZOMBIENET_BIN_DIR}" | |
| echo "${POLKADOT_SDK_BIN_DIR}" >> "$GITHUB_PATH" | |
| echo "SKIP_PARACHAIN_SETUP=1" >> "$GITHUB_ENV" | |
| echo "${ZOMBIENET_BIN_DIR}" >> "$GITHUB_PATH" | |
| echo "ZOMBIENET_BINARY=zombienet-linux-x64" >> "$GITHUB_ENV" | |
| - name: Start services | |
| working-directory: examples | |
| env: | |
| RUNTIME_PACKAGE: ${{ matrix.runtime.package }} | |
| run: | | |
| TEST_DIR="$(mktemp -d $GITHUB_WORKSPACE/bulletin-tests-run-XXXXX)/test" | |
| echo "TEST_DIR=$TEST_DIR" >> "$GITHUB_ENV" | |
| echo "RUNTIME_PACKAGE=${RUNTIME_PACKAGE}" >> "$GITHUB_ENV" | |
| just start-services "$TEST_DIR" "$RUNTIME_PACKAGE" "kubo-native" | |
| - name: Test authorize-and-store ws | |
| working-directory: examples | |
| run: just run-test-authorize-and-store "$TEST_DIR" "$RUNTIME_PACKAGE" "ws" | |
| - name: Test authorize-and-store smoldot | |
| working-directory: examples | |
| run: just run-test-authorize-and-store "$TEST_DIR" "$RUNTIME_PACKAGE" "smoldot" | |
| - name: Test store-chunked-data | |
| working-directory: examples | |
| run: just run-test-store-chunked-data "$TEST_DIR" | |
| - name: Test native-ipfs-dag-pb-chunked-data | |
| working-directory: examples | |
| run: just run-test-native-ipfs-dag-pb-chunked-data "$TEST_DIR" | |
| - name: Test store-big-data | |
| working-directory: examples | |
| run: just run-test-store-big-data "$TEST_DIR" "big32" | |
| - name: Test authorize-preimage-and-store | |
| working-directory: examples | |
| run: just run-test-authorize-preimage-and-store "$TEST_DIR" | |
| - name: Test chopsticks compatibility | |
| working-directory: examples | |
| run: just run-test-chopsticks "ws://127.0.0.1:10000" | |
| - name: Stop services | |
| if: always() | |
| working-directory: examples | |
| run: just stop-services "$TEST_DIR" "kubo-native" | |
| # Collects logs from the last failed zombienet run. | |
| - name: Upload Zombienet logs (on failure) | |
| if: failure() | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 | |
| with: | |
| name: failed-zombienet-logs-${{ matrix.runtime.name }} | |
| path: | | |
| ${{ env.TEST_DIR }}/*.log | |
| integration-tests-complete: | |
| name: All integration tests passed | |
| needs: [changes, integration-tests] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Decide outcome | |
| if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | |
| run: | | |
| echo "Integration tests failed or were cancelled" | |
| exit 1 |