Skip to content

Commit 8868a9c

Browse files
committed
setup github matrix feature
1 parent 60486df commit 8868a9c

File tree

2 files changed

+64
-17
lines changed

2 files changed

+64
-17
lines changed

β€Ž.github/workflows/integration-test.ymlβ€Ž

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,28 @@ env:
2020
NODE_VERSION: 22
2121

2222
jobs:
23+
# This generates a matrix with all the required runtimes which will be run in the next step
24+
runtime-matrix:
25+
runs-on: ubuntu-latest
26+
outputs:
27+
runtime: ${{ steps.runtime.outputs.runtime }}
28+
name: Extract runtimes from matrix
29+
steps:
30+
- uses: actions/checkout@v4
31+
- id: runtime
32+
run: |
33+
TASKS=$(echo $(cat scripts/runtimes-matrix.json) | sed 's/ //g' )
34+
echo $TASKS
35+
echo "runtime=$TASKS" >> $GITHUB_OUTPUT
36+
2337
integration-tests:
24-
name: Integration Tests
38+
needs: [runtime-matrix]
39+
name: Integration Tests - ${{ matrix.runtime.name }}
2540
runs-on: ubuntu-latest
2641
timeout-minutes: 60
42+
strategy:
43+
matrix:
44+
runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }}
2745

2846
steps:
2947
- name: Checkout sources
@@ -67,8 +85,8 @@ jobs:
6785
6886
- name: Run authorize and store (PAPI, smoldot)
6987
working-directory: examples
70-
run: just run-authorize-and-store "smoldot"
88+
run: just run-authorize-and-store "smoldot" "${{ matrix.runtime.package }}"
7189

7290
- name: Run authorize and store (PAPI, RPC node)
7391
working-directory: examples
74-
run: just run-authorize-and-store "ws"
92+
run: just run-authorize-and-store "ws" "${{ matrix.runtime.package }}"

β€Žexamples/justfileβ€Ž

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
PID_DIR := "/tmp/bulletin-pids"
77

88
# Default recipe - run the complete PAPI workflow test
9-
default: run-authorize-and-store
9+
default: (run-authorize-and-store "smoldot" "bulletin-polkadot")
1010

1111
# Build the bulletin chain node in release mode
12-
build:
13-
cargo build --release -p polkadot-bulletin-chain
12+
# Parameters:
13+
# runtime - Runtime name (e.g., "bulletin-polkadot"), taken from ../scripts/runtimes-matrix.json
14+
build runtime="bulletin-polkadot":
15+
cargo build --release -p {{ runtime }}
1416

1517
# Install JavaScript dependencies
1618
npm-install:
@@ -28,14 +30,35 @@ _ipfs-cmd:
2830
exit 1
2931
fi
3032

33+
# Helper function to map runtime package name to zombienet config filename (internal use)
34+
_zombienet-config-name runtime:
35+
#!/usr/bin/env bash
36+
case "{{ runtime }}" in
37+
"bulletin-polkadot-runtime")
38+
echo "bulletin-polkadot-local.toml"
39+
;;
40+
"bulletin-westend-runtime")
41+
echo "bulletin-westend-local.toml"
42+
;;
43+
"polkadot-bulletin-chain-runtime")
44+
echo "bulletin-polkadot.toml"
45+
;;
46+
*)
47+
echo "❌ Error: Unknown runtime '{{ runtime }}'" >&2
48+
exit 1
49+
;;
50+
esac
51+
3152
# Start start solo chain with zombienet in background
32-
bulletin-solo-zombienet-start:
53+
# Parameters:
54+
# runtime - Runtime name (e.g., "bulletin-polkadot"), taken from ../scripts/runtimes-matrix.json
55+
bulletin-solo-zombienet-start runtime="bulletin-polkadot":
3356
#!/usr/bin/env bash
3457
set -e
3558

3659
mkdir -p {{ PID_DIR }}
3760

38-
echo "⚑ Starting Bulletin chain with zombienet..."
61+
echo "⚑ Starting Bulletin chain with zombienet (runtime: {{ runtime }})..."
3962

4063
# Find zombienet binary (use env var if set, otherwise search)
4164
if [ -n "$ZOMBIENET_BINARY" ]; then
@@ -54,8 +77,11 @@ bulletin-solo-zombienet-start:
5477
echo " Using zombienet: $ZOMBIENET_BIN"
5578

5679
# Get absolute paths for bulletin binary and config
57-
BULLETIN_BINARY=$(cd .. && pwd)/target/release/polkadot-bulletin-chain
58-
ZOMBIENET_CONFIG=$(cd .. && pwd)/zombienet/bulletin-polkadot-local.toml
80+
BULLETIN_BINARY=$(cd .. && pwd)/target/release/{{ runtime }}
81+
ZOMBIENET_TOML=$(just _zombienet-config-name {{ runtime }})
82+
ZOMBIENET_CONFIG=$(cd .. && pwd)/zombienet/$ZOMBIENET_TOML
83+
84+
echo " Using config: $ZOMBIENET_CONFIG"
5985

6086
POLKADOT_BULLETIN_BINARY_PATH=$BULLETIN_BINARY $ZOMBIENET_BIN -p native spawn $ZOMBIENET_CONFIG > /tmp/zombienet.log 2>&1 &
6187
ZOMBIENET_PID=$!
@@ -167,18 +193,20 @@ papi-generate:
167193
npm run papi:generate
168194

169195
# Setup all services using Docker for IPFS
170-
setup-services:
196+
# Parameters:
197+
# runtime - Runtime to build and run (e.g., "bulletin-polkadot-runtime", "bulletin-westend-runtime", "polkadot-bulletin-chain-runtime")
198+
setup-services runtime="bulletin-polkadot":
171199
#!/usr/bin/env bash
172200
set -e
173201

174202
echo "πŸ”§ Tearing down Docker services if they are running..."
175203
just ipfs-shutdown
176204

177-
echo "🐳 Setting up services with Docker IPFS..."
205+
echo "🐳 Setting up services with Docker IPFS (runtime: {{ runtime }})..."
178206

179207
# Start services with Docker
180208
just ipfs-start
181-
just bulletin-solo-zombienet-start
209+
just bulletin-solo-zombienet-start "{{ runtime }}"
182210

183211
# Wait a bit longer and verify zombienet is running
184212
echo "πŸ” Verifying zombienet is ready..."
@@ -229,23 +257,24 @@ teardown-services:
229257
# Run authorize and store example with Docker IPFS
230258
# Parameters:
231259
# mode - Connection mode: "ws" (WebSocket RPC node) or "smoldot" (light client)
232-
run-authorize-and-store mode="ws": build npm-install
260+
# runtime - Runtime name (e.g., "bulletin-polkadot", "bulletin-westend", "bulletin-rococo")
261+
run-authorize-and-store mode="ws" runtime="bulletin-polkadot": (build runtime) npm-install
233262
#!/usr/bin/env bash
234263
set -e
235264

236265
if [ "{{ mode }}" = "smoldot" ]; then
237-
echo "πŸš€ Starting authorize and store workflow test (mode: smoldot)..."
266+
echo "πŸš€ Starting authorize and store workflow test (mode: smoldot, runtime: {{ runtime }})..."
238267
SCRIPT_NAME="authorize_and_store_papi_smoldot.js"
239268
elif [ "{{ mode }}" = "ws" ]; then
240-
echo "πŸš€ Starting authorize and store workflow test (mode: ws)..."
269+
echo "πŸš€ Starting authorize and store workflow test (mode: ws, runtime: {{ runtime }})..."
241270
SCRIPT_NAME="authorize_and_store_papi.js"
242271
else
243272
echo "❌ Error: Invalid mode '{{ mode }}'. Must be 'ws' or 'smoldot'"
244273
exit 1
245274
fi
246275
echo ""
247276

248-
just setup-services
277+
just setup-services "{{ runtime }}"
249278
node $SCRIPT_NAME
250279
EXAMPLE_EXIT=$?
251280

0 commit comments

Comments
Β (0)