Skip to content

Commit 36e187c

Browse files
committed
removed local set-up
1 parent 395be51 commit 36e187c

File tree

2 files changed

+19
-197
lines changed

2 files changed

+19
-197
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-docker
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-docker
68+
run: just run-authorize-and-store

examples/justfile

Lines changed: 17 additions & 195 deletions
Original file line numberDiff line numberDiff line change
@@ -28,58 +28,6 @@ _ipfs-cmd:
2828
exit 1
2929
fi
3030

31-
# Initialize IPFS if not already initialized
32-
ipfs-init:
33-
#!/usr/bin/env bash
34-
set -e
35-
IPFS_CMD=$(just _ipfs-cmd)
36-
echo "🔧 Using IPFS: $IPFS_CMD"
37-
38-
if [ ! -d ~/.ipfs ]; then
39-
echo "📦 Initializing IPFS..."
40-
$IPFS_CMD init
41-
else
42-
echo "✅ IPFS already initialized"
43-
fi
44-
45-
# Start IPFS daemon in background
46-
ipfs-start:
47-
#!/usr/bin/env bash
48-
set -e
49-
mkdir -p {{ PID_DIR }}
50-
IPFS_CMD=$(just _ipfs-cmd)
51-
52-
echo "🔧 Using IPFS: $IPFS_CMD"
53-
echo "📡 Starting IPFS daemon..."
54-
$IPFS_CMD daemon > /tmp/ipfs-daemon.log 2>&1 &
55-
echo $! > {{ PID_DIR }}/ipfs.pid
56-
echo " IPFS PID: $!"
57-
echo " Log: /tmp/ipfs-daemon.log"
58-
sleep 2
59-
60-
# Connect to IPFS nodes
61-
ipfs-connect:
62-
#!/usr/bin/env bash
63-
set -e
64-
IPFS_CMD=$(just _ipfs-cmd)
65-
66-
echo "🔧 Using IPFS: $IPFS_CMD"
67-
echo "🔗 Connecting IPFS nodes..."
68-
$IPFS_CMD swarm connect /ip4/127.0.0.1/tcp/12347/ws/p2p/12D3KooWRkZhiRhsqmrQ28rt73K7V3aCBpqKrLGSXmZ99PTcTZby || true
69-
$IPFS_CMD swarm connect /ip4/127.0.0.1/tcp/10001/ws/p2p/12D3KooWQCkBm1BYtkHpocxCwMgR8yjitEeHGx8spzcDLGt2gkBm || true
70-
71-
# Shutdown IPFS daemon
72-
ipfs-shutdown:
73-
#!/usr/bin/env bash
74-
IPFS_CMD=$(just _ipfs-cmd)
75-
76-
echo "🔧 Using IPFS: $IPFS_CMD"
77-
echo "🛑 Shutting down IPFS daemon..."
78-
$IPFS_CMD shutdown 2>/dev/null || echo " ⚠ IPFS not running or already stopped"
79-
80-
# Clean up PID file if it exists
81-
[ -f "{{ PID_DIR }}/ipfs.pid" ] && rm "{{ PID_DIR }}/ipfs.pid" && echo " ✓ Cleaned up PID file" || true
82-
8331
# Start start solo chain with zombienet in background
8432
bulletin-solo-zombienet-start:
8533
#!/usr/bin/env bash
@@ -117,132 +65,6 @@ bulletin-solo-zombienet-start:
11765
echo " Waiting for chain to start (15 seconds)..."
11866
sleep 15
11967

120-
# Start IPFS reconnect script in background
121-
ipfs-reconnect-start:
122-
#!/usr/bin/env bash
123-
set -e
124-
125-
mkdir -p {{ PID_DIR }}
126-
127-
echo "🔄 Starting IPFS reconnect script..."
128-
./scripts/ipfs-reconnect-solo.sh > /tmp/ipfs-reconnect.log 2>&1 &
129-
RECONNECT_PID=$!
130-
echo $RECONNECT_PID > {{ PID_DIR }}/ipfs-reconnect.pid
131-
echo " Reconnect PID: $RECONNECT_PID"
132-
echo " Log: /tmp/ipfs-reconnect.log"
133-
sleep 2
134-
135-
# Generate PAPI descriptors
136-
papi-generate:
137-
#!/usr/bin/env bash
138-
set -e
139-
140-
echo "🔧 Generating PAPI descriptors..."
141-
npm run papi:generate
142-
143-
# Setup all services needed for testing (IPFS, zombienet, IPFS reconnect, PAPI)
144-
# Parameters: api=[papi|pjs] - choose between Polkadot API (papi) or Polkadot JS (pjs)
145-
setup-services api="papi":
146-
#!/usr/bin/env bash
147-
set -e
148-
149-
API_TYPE="{{ api }}"
150-
151-
echo "🔧 Tearing down services if they are running..."
152-
just ipfs-shutdown
153-
154-
echo "🔧 Setting up services for $API_TYPE..."
155-
156-
# Initialize IPFS
157-
just ipfs-init
158-
159-
# Start services
160-
just ipfs-start
161-
just bulletin-solo-zombienet-start
162-
just ipfs-connect
163-
just ipfs-reconnect-start
164-
165-
# Generate PAPI descriptors if needed
166-
if [ "$API_TYPE" == "papi" ]; then
167-
just papi-generate
168-
fi
169-
170-
echo "✅ Services setup complete"
171-
172-
# Stop all running services (IPFS, zombienet, reconnect script)
173-
teardown-services:
174-
#!/usr/bin/env bash
175-
176-
echo "🧹 Stopping all services..."
177-
178-
# Stop services by reading PIDs from files
179-
if [ -d {{ PID_DIR }} ]; then
180-
for pidfile in {{ PID_DIR }}/*.pid; do
181-
if [ -f "$pidfile" ]; then
182-
PID=$(cat "$pidfile")
183-
SERVICE=$(basename "$pidfile" .pid)
184-
if kill $PID 2>/dev/null; then
185-
echo " ✓ Stopped $SERVICE (PID: $PID)"
186-
else
187-
echo " ⚠ $SERVICE (PID: $PID) not running or already stopped"
188-
fi
189-
rm "$pidfile"
190-
fi
191-
done
192-
rmdir {{ PID_DIR }} 2>/dev/null || true
193-
else
194-
echo " No running services found"
195-
fi
196-
197-
echo "✅ Services stopped"
198-
199-
# Test the complete workflow (builds, starts services, runs example, shuts down services)
200-
# Parameters: api=[papi|pjs] - choose between Polkadot API (papi) or Polkadot JS (pjs)
201-
run-authorize-and-store api="papi": build npm-install
202-
#!/usr/bin/env bash
203-
set -e
204-
205-
API_TYPE="{{ api }}"
206-
207-
if [[ "$API_TYPE" != "papi" && "$API_TYPE" != "pjs" ]]; then
208-
echo "❌ Error: api parameter must be 'papi' or 'pjs'"
209-
exit 1
210-
fi
211-
212-
echo "🚀 Starting $API_TYPE workflow test..."
213-
echo ""
214-
215-
# Setup all services
216-
just setup-services $API_TYPE
217-
218-
# Run the example
219-
if [ "$API_TYPE" == "papi" ]; then
220-
EXAMPLE_FILE="authorize_and_store_papi.js"
221-
else
222-
EXAMPLE_FILE="authorize_and_store.js"
223-
fi
224-
node $EXAMPLE_FILE
225-
EXAMPLE_EXIT=$?
226-
227-
echo ""
228-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
229-
if [ $EXAMPLE_EXIT -eq 0 ]; then
230-
echo "✅ Example completed successfully!"
231-
else
232-
echo "❌ Example failed with exit code $EXAMPLE_EXIT"
233-
fi
234-
235-
echo ""
236-
echo "📝 Logs available at:"
237-
echo " /tmp/ipfs-daemon.log"
238-
echo " /tmp/zombienet.log"
239-
echo " /tmp/ipfs-reconnect.log"
240-
241-
# Clean up background processes
242-
just teardown-services
243-
244-
exit $EXAMPLE_EXIT
245-
24668
# Run smoldot example with local Kubo
24769
run-authorize-and-store-smoldot: build npm-install
24870
#!/usr/bin/env bash
@@ -272,7 +94,7 @@ _check-docker:
27294
fi
27395

27496
# Start IPFS Docker container
275-
ipfs-docker-start: _check-docker
97+
ipfs-start: _check-docker
27698
#!/usr/bin/env bash
27799
set -e
278100
mkdir -p {{ PID_DIR }}
@@ -301,7 +123,7 @@ ipfs-docker-start: _check-docker
301123
echo "ipfs-node" > {{ PID_DIR }}/ipfs-docker.container
302124

303125
# Connect to IPFS nodes using Docker
304-
ipfs-docker-connect:
126+
ipfs-connect:
305127
#!/usr/bin/env bash
306128
set -e
307129

@@ -323,7 +145,7 @@ ipfs-docker-connect:
323145
docker exec ipfs-node ipfs swarm connect /$PROTOCOL/$DOCKER_HOST/tcp/12347/ws/p2p/12D3KooWRkZhiRhsqmrQ28rt73K7V3aCBpqKrLGSXmZ99PTcTZby || true
324146

325147
# Shutdown IPFS Docker container
326-
ipfs-docker-shutdown:
148+
ipfs-shutdown:
327149
#!/usr/bin/env bash
328150

329151
echo "🛑 Shutting down IPFS Docker container..."
@@ -334,7 +156,7 @@ ipfs-docker-shutdown:
334156
[ -f "{{ PID_DIR }}/ipfs-docker.container" ] && rm "{{ PID_DIR }}/ipfs-docker.container" && echo " ✓ Cleaned up container file" || true
335157

336158
# Start IPFS reconnect script in background (Docker mode)
337-
ipfs-reconnect-docker-start:
159+
ipfs-reconnect-start:
338160
#!/usr/bin/env bash
339161
set -e
340162

@@ -349,17 +171,17 @@ ipfs-reconnect-docker-start:
349171
sleep 2
350172

351173
# Setup all services using Docker for IPFS
352-
setup-services-docker:
174+
setup-services:
353175
#!/usr/bin/env bash
354176
set -e
355177

356178
echo "🔧 Tearing down Docker services if they are running..."
357-
just ipfs-docker-shutdown
179+
just ipfs-shutdown
358180

359181
echo "🐳 Setting up services with Docker IPFS..."
360182

361183
# Start services with Docker
362-
just ipfs-docker-start
184+
just ipfs-start
363185
just bulletin-solo-zombienet-start
364186

365187
# Wait a bit longer and verify zombienet is running
@@ -370,14 +192,14 @@ setup-services-docker:
370192
echo " Checking zombienet log:"
371193
tail -20 /tmp/zombienet.log || echo " ⚠ Could not read zombienet log"
372194

373-
just ipfs-docker-connect
374-
just ipfs-reconnect-docker-start
195+
just ipfs-connect
196+
just ipfs-reconnect-start
375197
just papi-generate
376198

377199
echo "✅ Services setup complete (Docker mode)"
378200

379201
# Stop all Docker services
380-
teardown-services-docker:
202+
teardown-services:
381203
#!/usr/bin/env bash
382204

383205
echo "🧹 Stopping all Docker services..."
@@ -399,7 +221,7 @@ teardown-services-docker:
399221
fi
400222

401223
# Stop Docker container
402-
just ipfs-docker-shutdown
224+
just ipfs-shutdown
403225

404226
# Clean up PID directory
405227
if [ -d {{ PID_DIR }} ]; then
@@ -409,14 +231,14 @@ teardown-services-docker:
409231
echo "✅ Docker services stopped"
410232

411233
# Run RPC node example with Docker IPFS
412-
run-authorize-and-store-docker: build npm-install
234+
run-authorize-and-store: build npm-install
413235
#!/usr/bin/env bash
414236
set -e
415237

416238
echo "🚀 Starting RPC node workflow test with Docker..."
417239
echo ""
418240

419-
just setup-services-docker
241+
just setup-services
420242
node authorize_and_store_papi.js
421243
EXAMPLE_EXIT=$?
422244

@@ -428,18 +250,18 @@ run-authorize-and-store-docker: build npm-install
428250
echo "❌ Example failed with exit code $EXAMPLE_EXIT"
429251
fi
430252

431-
just teardown-services-docker
253+
just teardown-services
432254
exit $EXAMPLE_EXIT
433255

434256
# Run smoldot example with Docker IPFS
435-
run-authorize-and-store-smoldot-docker: build npm-install
257+
run-authorize-and-store-smoldot: build npm-install
436258
#!/usr/bin/env bash
437259
set -e
438260

439261
echo "🚀 Starting smoldot workflow test with Docker..."
440262
echo ""
441263

442-
just setup-services-docker
264+
just setup-services
443265
node authorize_and_store_papi_smoldot.js
444266
EXAMPLE_EXIT=$?
445267

@@ -451,5 +273,5 @@ run-authorize-and-store-smoldot-docker: build npm-install
451273
echo "❌ Example failed with exit code $EXAMPLE_EXIT"
452274
fi
453275

454-
just teardown-services-docker
276+
just teardown-services
455277
exit $EXAMPLE_EXIT

0 commit comments

Comments
 (0)