diff --git a/.github/scripts/start-dev-node.sh b/.github/scripts/start-dev-node.sh new file mode 100755 index 0000000..d31e265 --- /dev/null +++ b/.github/scripts/start-dev-node.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# Starts a bizinikiwi dev node for the .slow. specs, with its RPC on the port +# the specs connect to (test-support BIZINIKIWI_PORT, 30333), and waits until +# it answers. Fails if it never does, so a spec run cannot start without it. +set -euo pipefail + +# pinned by digest: a tag can move under a run +IMAGE=pezkuwi/bizinikiwi@sha256:130e8ddd1ec36b00422fcfe565fb596d6a81889e3aeb5f45d13bd92993d09a19 +PORT=${TEST_BIZINIKIWI_PORT:-30333} + +docker run -d --name dev-node -p "$PORT:9944" "$IMAGE" --dev --rpc-external --rpc-cors all + +for _ in $(seq 1 60); do + if curl -sf -H 'Content-Type: application/json' \ + -d '{"id":1,"jsonrpc":"2.0","method":"system_chain"}' "http://127.0.0.1:$PORT" > /dev/null; then + echo "dev node answers on $PORT" + exit 0 + fi + sleep 2 +done + +echo "dev node did not answer on $PORT within 120s" +docker logs dev-node 2>&1 | tail -40 +exit 1 diff --git a/.github/workflows/pr-any.yml b/.github/workflows/pr-any.yml index 6c449c2..b751dbe 100644 --- a/.github/workflows/pr-any.yml +++ b/.github/workflows/pr-any.yml @@ -24,3 +24,22 @@ jobs: # tree it changed. The committed tree must already be what they produce. - name: tree unchanged run: git diff --exit-code --stat + + # The .slow. specs drive the UI against a live dev node; `yarn test` leaves + # them out, so they run here with one. + slow: + name: pr (test:slow) + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + - name: dev node + run: .github/scripts/start-dev-node.sh + - name: test:slow + run: | + corepack enable + yarn install --immutable + yarn test:slow diff --git a/.github/workflows/test-nightly.yml b/.github/workflows/test-nightly.yml index c3add97..d7d2ea3 100644 --- a/.github/workflows/test-nightly.yml +++ b/.github/workflows/test-nightly.yml @@ -20,6 +20,9 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 'lts/*' + # test:all includes the .slow. specs, which need a live dev node + - name: dev node + run: .github/scripts/start-dev-node.sh - name: ${{ matrix.step }} run: | yarn install --immutable