Skip to content

HOP nit

HOP nit #2478

name: Integration Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
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
# Pre-warm the binary cache once before the matrix fan-out so all matrix
# legs hit the cache instead of racing to download/build.
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: Set up Polkadot binaries
uses: ./.github/actions/use-polkadot-binaries
with:
groups: polkadot-node chain-spec-builder zombienet
mode: prepare
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: Set up Polkadot binaries
uses: ./.github/actions/use-polkadot-binaries
with:
groups: polkadot-node chain-spec-builder zombienet
mode: consume
- name: Rust cache (Bulletin)
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
workspaces: .
shared-key: "bulletin-cache-bulletin-integration-tests"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: |
examples/package.json
console-ui/package-lock.json
- name: Install subxt-cli
run: |
if ! command -v subxt &> /dev/null; then
cargo install subxt-cli --locked
else
echo "subxt-cli already installed"
fi
- 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 KUBO_VERSION="${KUBO_VERSION}" 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 HOP round trip
working-directory: examples
run: just run-test-hop-round-trip "$TEST_DIR"
- name: Test chopsticks compatibility
working-directory: examples
run: just run-test-chopsticks "ws://127.0.0.1:10000"
# SDK Client Tests
- name: Test Rust SDK
working-directory: examples
run: just test-rust-sdk "${{ env.TEST_DIR }}" "$RUNTIME_PACKAGE"
- name: Test TypeScript SDK
working-directory: examples
run: just test-ts-sdk "${{ env.TEST_DIR }}"
- name: Test TypeScript SDK (vitest integration)
working-directory: examples
# TODO: https://github.com/paritytech/polkadot-bulletin-chain/issues/443
# Flaky chunked-store tests hit the per-tx timeout under CI load.
# Remove `continue-on-error` once the vitest integration suite is
# stabilized.
continue-on-error: true
run: just test-ts-sdk-vitest
- name: Run console-ui tests
working-directory: console-ui
run: just test
- name: Upload console-ui tests report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: playwright-report-${{ matrix.runtime.name }}
path: console-ui/playwright-report/
retention-days: 14
- name: Stop services
if: always()
working-directory: examples
run: just KUBO_VERSION="${KUBO_VERSION}" stop-services "$TEST_DIR" "kubo-native"
- name: Upload Zombienet logs (on failure)
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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