|
| 1 | +name: Integration Tests |
| 2 | + |
| 3 | +# Controls when the action will run. |
| 4 | +on: |
| 5 | + # Triggers the workflow on push or pull request events but only for the master branch |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | + pull_request: |
| 9 | + branches: [main] |
| 10 | + |
| 11 | + # Allows you to run this workflow manually from the Actions tab |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +# Cancel previous runs |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +env: |
| 20 | + NODE_VERSION: 22 |
| 21 | + POLKADOT_SDK_VERSION: polkadot-stable2512 |
| 22 | + POLKADOT_SDK_BIN_DIR: ${{ github.workspace }}/.polkadot-sdk-bin |
| 23 | + ZOMBIENET_VERSION: v1.3.138 |
| 24 | + ZOMBIENET_BIN_DIR: ${{ github.workspace }}/.zombienet-bin |
| 25 | + |
| 26 | +jobs: |
| 27 | + setup: |
| 28 | + name: Setup |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - name: Free Disk Space (Ubuntu) |
| 32 | + if: ${{ runner.environment == 'github-hosted' }} |
| 33 | + uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 |
| 34 | + with: |
| 35 | + tool-cache: false |
| 36 | + |
| 37 | + # TODO: remove when released: https://github.com/paritytech/polkadot-sdk/pull/10662 |
| 38 | + - name: Install Rust toolchain |
| 39 | + uses: dtolnay/rust-toolchain@stable |
| 40 | + with: |
| 41 | + targets: wasm32-unknown-unknown |
| 42 | + components: rust-src |
| 43 | + - name: Install system dependencies |
| 44 | + run: | |
| 45 | + sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list /etc/apt/sources.list.d/azure-cli.list |
| 46 | + sudo apt-get update |
| 47 | + sudo apt-get install -y protobuf-compiler libclang-dev |
| 48 | +
|
| 49 | + # Cache the Polkadot SDK binaries |
| 50 | + - name: Cache Polkadot SDK binaries |
| 51 | + uses: actions/cache@v3 |
| 52 | + id: polkadot-sdk-cache |
| 53 | + with: |
| 54 | + path: ${{ env.POLKADOT_SDK_BIN_DIR }} |
| 55 | + key: polkadot-sdk-${{ env.POLKADOT_SDK_VERSION }}-binaries |
| 56 | + # Download and extract binaries if cache missed |
| 57 | + - name: Download Polkadot SDK binaries |
| 58 | + if: steps.polkadot-sdk-cache.outputs.cache-hit != 'true' |
| 59 | + run: | |
| 60 | + mkdir -p $POLKADOT_SDK_BIN_DIR |
| 61 | + cd $POLKADOT_SDK_BIN_DIR |
| 62 | + echo "Downloading Polkadot SDK binaries..." |
| 63 | + curl -L -o polkadot https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/polkadot |
| 64 | + curl -L -o polkadot-prepare-worker https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/polkadot-prepare-worker |
| 65 | + curl -L -o polkadot-execute-worker https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/polkadot-execute-worker |
| 66 | + curl -L -o chain-spec-builder https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/chain-spec-builder |
| 67 | + # TODO: remove when released: https://github.com/paritytech/polkadot-sdk/pull/10662 |
| 68 | + # curl -L -o polkadot-omni-node https://github.com/paritytech/polkadot-sdk/releases/download/${POLKADOT_SDK_VERSION}/polkadot-omni-node |
| 69 | + chmod +x * |
| 70 | + # TODO: remove when released: https://github.com/paritytech/polkadot-sdk/pull/10662 |
| 71 | + git clone https://github.com/paritytech/polkadot-sdk.git |
| 72 | + cd polkadot-sdk |
| 73 | + git reset --hard b2bcb74b13f1a1e082f701e3e05ce1be44d16790 |
| 74 | + cargo build -p polkadot-omni-node -r |
| 75 | + cd .. |
| 76 | + cp polkadot-sdk/target/release/polkadot-omni-node . |
| 77 | + rm -R polkadot-sdk |
| 78 | +
|
| 79 | + # Cache the Zombienet binaries |
| 80 | + - name: Cache Zombienet |
| 81 | + uses: actions/cache@v3 |
| 82 | + id: zombienet-cache |
| 83 | + with: |
| 84 | + path: ${{ env.ZOMBIENET_BIN_DIR }} |
| 85 | + key: zombienet-${{ env.ZOMBIENET_VERSION }}-binaries |
| 86 | + # Download and extract binaries if cache missed |
| 87 | + - name: Download Zombienet binaries |
| 88 | + if: steps.zombienet-cache.outputs.cache-hit != 'true' |
| 89 | + run: | |
| 90 | + mkdir -p $ZOMBIENET_BIN_DIR |
| 91 | + cd $ZOMBIENET_BIN_DIR |
| 92 | + curl -L \ |
| 93 | + -H "Authorization: token ${{ github.token }}" \ |
| 94 | + -o zombienet-linux-x64 \ |
| 95 | + "https://github.com/paritytech/zombienet/releases/download/${ZOMBIENET_VERSION}/zombienet-linux-x64" |
| 96 | + chmod +x zombienet-linux-x64 |
| 97 | +
|
| 98 | + integration-tests: |
| 99 | + needs: [setup] |
| 100 | + name: Integration Tests |
| 101 | + runs-on: ubuntu-latest |
| 102 | + timeout-minutes: 200 |
| 103 | + |
| 104 | + steps: |
| 105 | + - name: Checkout sources |
| 106 | + uses: actions/checkout@v4 |
| 107 | + |
| 108 | + - name: Install Rust toolchain |
| 109 | + uses: dtolnay/rust-toolchain@stable |
| 110 | + with: |
| 111 | + targets: wasm32-unknown-unknown |
| 112 | + components: rust-src |
| 113 | + |
| 114 | + - name: Install system dependencies |
| 115 | + run: | |
| 116 | + sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list /etc/apt/sources.list.d/azure-cli.list |
| 117 | + sudo apt-get update |
| 118 | + sudo apt-get install -y protobuf-compiler libclang-dev |
| 119 | +
|
| 120 | + - name: Rust cache (Bulletin) |
| 121 | + uses: Swatinem/rust-cache@v2 |
| 122 | + with: |
| 123 | + workspaces: . |
| 124 | + shared-key: "bulletin-cache-bulletin-integration-tests" |
| 125 | + save-if: ${{ github.ref == 'refs/heads/main' }} |
| 126 | + |
| 127 | + - name: Setup Node.js |
| 128 | + uses: actions/setup-node@v4 |
| 129 | + with: |
| 130 | + node-version: ${{ env.NODE_VERSION }} |
| 131 | + cache: 'npm' |
| 132 | + cache-dependency-path: examples/package.json |
| 133 | + |
| 134 | + - name: Install just |
| 135 | + run: cargo install just --locked || true |
| 136 | + |
| 137 | + - name: Cache Polkadot SDK binaries |
| 138 | + uses: actions/cache@v3 |
| 139 | + id: polkadot-sdk-cache |
| 140 | + with: |
| 141 | + path: ${{ env.POLKADOT_SDK_BIN_DIR }} |
| 142 | + key: polkadot-sdk-${{ env.POLKADOT_SDK_VERSION }}-binaries |
| 143 | + - name: Cache Zombienet |
| 144 | + uses: actions/cache@v3 |
| 145 | + id: zombienet-cache |
| 146 | + with: |
| 147 | + path: ${{ env.ZOMBIENET_BIN_DIR }} |
| 148 | + key: zombienet-${{ env.ZOMBIENET_VERSION }}-binaries |
| 149 | + - name: Add binaries to PATH |
| 150 | + run: | |
| 151 | + ls -lrt "${POLKADOT_SDK_BIN_DIR}" |
| 152 | + ls -lrt "${ZOMBIENET_BIN_DIR}" |
| 153 | + echo "${POLKADOT_SDK_BIN_DIR}" >> "$GITHUB_PATH" |
| 154 | + echo "SKIP_PARACHAIN_SETUP=1" >> "$GITHUB_ENV" |
| 155 | + echo "${ZOMBIENET_BIN_DIR}" >> "$GITHUB_PATH" |
| 156 | + echo "ZOMBIENET_BINARY=zombienet-linux-x64" >> "$GITHUB_ENV" |
| 157 | +
|
| 158 | + # ======================================================================== |
| 159 | + # Westend parachain tests |
| 160 | + # ======================================================================== |
| 161 | + - name: Start services (Westend parachain) |
| 162 | + working-directory: examples |
| 163 | + run: | |
| 164 | + TEST_DIR="$(mktemp -d $GITHUB_WORKSPACE/bulletin-tests-run-XXXXX)/test" |
| 165 | + echo "TEST_DIR=$TEST_DIR" >> "$GITHUB_ENV" |
| 166 | + just start-services "$TEST_DIR" "bulletin-westend-runtime" |
| 167 | +
|
| 168 | + - name: Test authorize-and-store ws (Westend parachain) |
| 169 | + working-directory: examples |
| 170 | + run: just run-test-authorize-and-store "${{ env.TEST_DIR }}" "bulletin-westend-runtime" "ws" |
| 171 | + |
| 172 | + - name: Test authorize-and-store smoldot (Westend parachain) |
| 173 | + working-directory: examples |
| 174 | + run: just run-test-authorize-and-store "${{ env.TEST_DIR }}" "bulletin-westend-runtime" "smoldot" |
| 175 | + |
| 176 | + - name: Test store-chunked-data (Westend parachain) |
| 177 | + working-directory: examples |
| 178 | + run: just run-test-store-chunked-data "${{ env.TEST_DIR }}" |
| 179 | + |
| 180 | + - name: Test store-big-data (Westend parachain) |
| 181 | + working-directory: examples |
| 182 | + run: just run-test-store-big-data "${{ env.TEST_DIR }}" |
| 183 | + |
| 184 | + - name: Stop services (Westend parachain) |
| 185 | + if: always() |
| 186 | + working-directory: examples |
| 187 | + run: just stop-services "${{ env.TEST_DIR }}" |
| 188 | + |
| 189 | + # ======================================================================== |
| 190 | + # Polkadot solochain tests |
| 191 | + # ======================================================================== |
| 192 | + - name: Start services (Polkadot solochain) |
| 193 | + working-directory: examples |
| 194 | + run: | |
| 195 | + TEST_DIR="$(mktemp -d $GITHUB_WORKSPACE/bulletin-tests-run-XXXXX)/test" |
| 196 | + echo "TEST_DIR=$TEST_DIR" >> "$GITHUB_ENV" |
| 197 | + just start-services "$TEST_DIR" "bulletin-polkadot-runtime" |
| 198 | +
|
| 199 | + - name: Test authorize-and-store ws (Polkadot solochain) |
| 200 | + working-directory: examples |
| 201 | + run: just run-test-authorize-and-store "${{ env.TEST_DIR }}" "bulletin-polkadot-runtime" "ws" |
| 202 | + |
| 203 | + - name: Test authorize-and-store smoldot (Polkadot solochain) |
| 204 | + working-directory: examples |
| 205 | + run: just run-test-authorize-and-store "${{ env.TEST_DIR }}" "bulletin-polkadot-runtime" "smoldot" |
| 206 | + |
| 207 | + - name: Test store-chunked-data (Polkadot solochain) |
| 208 | + working-directory: examples |
| 209 | + run: just run-test-store-chunked-data "${{ env.TEST_DIR }}" |
| 210 | + |
| 211 | + - name: Test store-big-data (Polkadot solochain) |
| 212 | + working-directory: examples |
| 213 | + run: just run-test-store-big-data "${{ env.TEST_DIR }}" |
| 214 | + |
| 215 | + - name: Stop services (Polkadot solochain) |
| 216 | + if: always() |
| 217 | + working-directory: examples |
| 218 | + run: just stop-services "${{ env.TEST_DIR }}" |
| 219 | + |
| 220 | + # Collects logs from the last failed zombienet run. |
| 221 | + - name: Upload Zombienet logs (on failure) |
| 222 | + if: failure() |
| 223 | + uses: actions/upload-artifact@v4 |
| 224 | + with: |
| 225 | + name: failed-zombienet-logs |
| 226 | + path: | |
| 227 | + ${{ env.TEST_DIR }}/*.log |
0 commit comments