Skip to content

Commit 67a2a29

Browse files
committed
parametrized run-authorize-and-store
1 parent 6945ee7 commit 67a2a29

File tree

2 files changed

+21
-27
lines changed

2 files changed

+21
-27
lines changed

.github/workflows/integration-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ jobs:
6161
6262
- name: Run authorize and store (PAPI, smoldot)
6363
working-directory: examples
64-
run: just run-authorize-and-store-smoldot
64+
run: just run-authorize-and-store "smoldot"
6565

6666
- name: Run authorize and store (PAPI, RPC node)
6767
working-directory: examples
68-
run: just run-authorize-and-store
68+
run: just run-authorize-and-store "ws"

examples/justfile

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -230,39 +230,27 @@ teardown-services:
230230

231231
echo "✅ Docker services stopped"
232232

233-
# Run RPC node example with Docker IPFS
234-
run-authorize-and-store: build npm-install
233+
# Run authorize and store example with Docker IPFS
234+
# Parameters:
235+
# mode - Connection mode: "ws" (WebSocket RPC node) or "smoldot" (light client)
236+
run-authorize-and-store mode="ws": build npm-install
235237
#!/usr/bin/env bash
236238
set -e
237239

238-
echo "🚀 Starting RPC node workflow test with Docker..."
239-
echo ""
240-
241-
just setup-services
242-
node authorize_and_store_papi.js
243-
EXAMPLE_EXIT=$?
244-
245-
echo ""
246-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
247-
if [ $EXAMPLE_EXIT -eq 0 ]; then
248-
echo "✅ Example completed successfully!"
240+
if [ "{{ mode }}" = "smoldot" ]; then
241+
echo "🚀 Starting authorize and store workflow test (mode: smoldot)..."
242+
SCRIPT_NAME="authorize_and_store_papi_smoldot.js"
243+
elif [ "{{ mode }}" = "ws" ]; then
244+
echo "🚀 Starting authorize and store workflow test (mode: ws)..."
245+
SCRIPT_NAME="authorize_and_store_papi.js"
249246
else
250-
echo "❌ Example failed with exit code $EXAMPLE_EXIT"
247+
echo "❌ Error: Invalid mode '{{ mode }}'. Must be 'ws' or 'smoldot'"
248+
exit 1
251249
fi
252-
253-
just teardown-services
254-
exit $EXAMPLE_EXIT
255-
256-
# Run smoldot example with Docker IPFS
257-
run-authorize-and-store-smoldot: build npm-install
258-
#!/usr/bin/env bash
259-
set -e
260-
261-
echo "🚀 Starting smoldot workflow test with Docker..."
262250
echo ""
263251

264252
just setup-services
265-
node authorize_and_store_papi_smoldot.js
253+
node $SCRIPT_NAME
266254
EXAMPLE_EXIT=$?
267255

268256
echo ""
@@ -275,3 +263,9 @@ run-authorize-and-store-smoldot: build npm-install
275263

276264
just teardown-services
277265
exit $EXAMPLE_EXIT
266+
267+
# Alias: Run with WebSocket RPC node
268+
run-authorize-and-store-ws: (run-authorize-and-store "ws")
269+
270+
# Alias: Run with smoldot light client
271+
run-authorize-and-store-smoldot: (run-authorize-and-store "smoldot")

0 commit comments

Comments
 (0)