-
Notifications
You must be signed in to change notification settings - Fork 6
Added a github workflow for running examples as integration tests #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
08242d4
added CI for docker workflow
x3c41a 805a5b2
simplified workflow, reused just commands
x3c41a 464dd44
doubled timeout
x3c41a 8db6577
use ubuntu-latest directly for Docker suppor
x3c41a 3ac97ff
added docker check
x3c41a 675b40b
simplify docker verification
x3c41a 3aff147
trigger workflow on ci_cd branch pushes
x3c41a 47cf3d6
add protobuf-compiler dependency
x3c41a b85e4e6
add libclang dependency
x3c41a 0b777e4
add wasm32 target for runtime compilation
x3c41a f6a0e53
add rust-src component for wasm compilation
x3c41a 64264d5
use host networking for IPFS Docker on Linux/CI
x3c41a ca12545
fix Docker networking and add zombienet debugging
x3c41a a5e204c
fix: use absolute paths for zombienet and bulletin binary
x3c41a 310a547
renamed
x3c41a c03485f
removed docker verification step - not needed anymore
x3c41a 8bd3e97
Merge branch 'just_docker' into ci_cd
x3c41a 99cbf16
Update .github/workflows/integration-test.yml
x3c41a eafe553
Update .github/workflows/integration-test.yml
x3c41a 39f13fa
added another test as step
x3c41a fe9dbdf
updated on push branches
x3c41a 093055d
removed branhces from on pull_request
x3c41a bf10520
added ci_cd back, modified network_args (added ports)
x3c41a dd19e8f
removed flag in wget
x3c41a 589bea6
added docker setup
x3c41a 913d51a
added missing dependency
x3c41a 9916426
commented out first test - debugging second
x3c41a 500e522
fixed commit
x3c41a 1a6af76
reverted import, increased node version to 22
x3c41a 5a66383
uncommented first test
x3c41a 2a28be5
reverted branches
x3c41a 395be51
Update .github/workflows/integration-test.yml
x3c41a 36e187c
removed local set-up
x3c41a 6945ee7
Update examples/justfile
bkontur 67a2a29
parametrized run-authorize-and-store
x3c41a c23ec0e
removed duplicate
x3c41a d2a6cd4
Update examples/justfile
x3c41a 4fab99c
Removed older TODO
bkontur 4586875
Extract node version
bkontur aac0a2a
Actually use CI_IMAGE and align with check.yml
bkontur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,58 +28,6 @@ _ipfs-cmd: | |
| exit 1 | ||
| fi | ||
|
|
||
| # Initialize IPFS if not already initialized | ||
| ipfs-init: | ||
| #!/usr/bin/env bash | ||
| set -e | ||
| IPFS_CMD=$(just _ipfs-cmd) | ||
| echo "🔧 Using IPFS: $IPFS_CMD" | ||
|
|
||
| if [ ! -d ~/.ipfs ]; then | ||
| echo "📦 Initializing IPFS..." | ||
| $IPFS_CMD init | ||
| else | ||
| echo "✅ IPFS already initialized" | ||
| fi | ||
|
|
||
| # Start IPFS daemon in background | ||
| ipfs-start: | ||
| #!/usr/bin/env bash | ||
| set -e | ||
| mkdir -p {{ PID_DIR }} | ||
| IPFS_CMD=$(just _ipfs-cmd) | ||
|
|
||
| echo "🔧 Using IPFS: $IPFS_CMD" | ||
| echo "📡 Starting IPFS daemon..." | ||
| $IPFS_CMD daemon > /tmp/ipfs-daemon.log 2>&1 & | ||
| echo $! > {{ PID_DIR }}/ipfs.pid | ||
| echo " IPFS PID: $!" | ||
| echo " Log: /tmp/ipfs-daemon.log" | ||
| sleep 2 | ||
|
|
||
| # Connect to IPFS nodes | ||
| ipfs-connect: | ||
| #!/usr/bin/env bash | ||
| set -e | ||
| IPFS_CMD=$(just _ipfs-cmd) | ||
|
|
||
| echo "🔧 Using IPFS: $IPFS_CMD" | ||
| echo "🔗 Connecting IPFS nodes..." | ||
| $IPFS_CMD swarm connect /ip4/127.0.0.1/tcp/12347/ws/p2p/12D3KooWRkZhiRhsqmrQ28rt73K7V3aCBpqKrLGSXmZ99PTcTZby || true | ||
| $IPFS_CMD swarm connect /ip4/127.0.0.1/tcp/10001/ws/p2p/12D3KooWQCkBm1BYtkHpocxCwMgR8yjitEeHGx8spzcDLGt2gkBm || true | ||
|
|
||
| # Shutdown IPFS daemon | ||
| ipfs-shutdown: | ||
| #!/usr/bin/env bash | ||
| IPFS_CMD=$(just _ipfs-cmd) | ||
|
|
||
| echo "🔧 Using IPFS: $IPFS_CMD" | ||
| echo "🛑 Shutting down IPFS daemon..." | ||
| $IPFS_CMD shutdown 2>/dev/null || echo " ⚠ IPFS not running or already stopped" | ||
|
|
||
| # Clean up PID file if it exists | ||
| [ -f "{{ PID_DIR }}/ipfs.pid" ] && rm "{{ PID_DIR }}/ipfs.pid" && echo " ✓ Cleaned up PID file" || true | ||
|
|
||
| # Start start solo chain with zombienet in background | ||
| bulletin-solo-zombienet-start: | ||
| #!/usr/bin/env bash | ||
|
|
@@ -117,132 +65,6 @@ bulletin-solo-zombienet-start: | |
| echo " Waiting for chain to start (15 seconds)..." | ||
| sleep 15 | ||
|
|
||
| # Start IPFS reconnect script in background | ||
| ipfs-reconnect-start: | ||
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
| mkdir -p {{ PID_DIR }} | ||
|
|
||
| echo "🔄 Starting IPFS reconnect script..." | ||
| ./scripts/ipfs-reconnect-solo.sh > /tmp/ipfs-reconnect.log 2>&1 & | ||
| RECONNECT_PID=$! | ||
| echo $RECONNECT_PID > {{ PID_DIR }}/ipfs-reconnect.pid | ||
| echo " Reconnect PID: $RECONNECT_PID" | ||
| echo " Log: /tmp/ipfs-reconnect.log" | ||
| sleep 2 | ||
|
|
||
| # Generate PAPI descriptors | ||
| papi-generate: | ||
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
| echo "🔧 Generating PAPI descriptors..." | ||
| npm run papi:generate | ||
|
|
||
| # Setup all services needed for testing (IPFS, zombienet, IPFS reconnect, PAPI) | ||
| # Parameters: api=[papi|pjs] - choose between Polkadot API (papi) or Polkadot JS (pjs) | ||
| setup-services api="papi": | ||
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
| API_TYPE="{{ api }}" | ||
|
|
||
| echo "🔧 Tearing down services if they are running..." | ||
| just ipfs-shutdown | ||
|
|
||
| echo "🔧 Setting up services for $API_TYPE..." | ||
|
|
||
| # Initialize IPFS | ||
| just ipfs-init | ||
|
|
||
| # Start services | ||
| just ipfs-start | ||
| just bulletin-solo-zombienet-start | ||
| just ipfs-connect | ||
| just ipfs-reconnect-start | ||
|
|
||
| # Generate PAPI descriptors if needed | ||
| if [ "$API_TYPE" == "papi" ]; then | ||
| just papi-generate | ||
| fi | ||
|
|
||
| echo "✅ Services setup complete" | ||
|
|
||
| # Stop all running services (IPFS, zombienet, reconnect script) | ||
| teardown-services: | ||
| #!/usr/bin/env bash | ||
|
|
||
| echo "🧹 Stopping all services..." | ||
|
|
||
| # Stop services by reading PIDs from files | ||
| if [ -d {{ PID_DIR }} ]; then | ||
| for pidfile in {{ PID_DIR }}/*.pid; do | ||
| if [ -f "$pidfile" ]; then | ||
| PID=$(cat "$pidfile") | ||
| SERVICE=$(basename "$pidfile" .pid) | ||
| if kill $PID 2>/dev/null; then | ||
| echo " ✓ Stopped $SERVICE (PID: $PID)" | ||
| else | ||
| echo " ⚠ $SERVICE (PID: $PID) not running or already stopped" | ||
| fi | ||
| rm "$pidfile" | ||
| fi | ||
| done | ||
| rmdir {{ PID_DIR }} 2>/dev/null || true | ||
| else | ||
| echo " No running services found" | ||
| fi | ||
|
|
||
| echo "✅ Services stopped" | ||
|
|
||
| # Test the complete workflow (builds, starts services, runs example, shuts down services) | ||
| # Parameters: api=[papi|pjs] - choose between Polkadot API (papi) or Polkadot JS (pjs) | ||
| run-authorize-and-store api="papi": build npm-install | ||
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
| API_TYPE="{{ api }}" | ||
|
|
||
| if [[ "$API_TYPE" != "papi" && "$API_TYPE" != "pjs" ]]; then | ||
| echo "❌ Error: api parameter must be 'papi' or 'pjs'" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "🚀 Starting $API_TYPE workflow test..." | ||
| echo "" | ||
|
|
||
| # Setup all services | ||
| just setup-services $API_TYPE | ||
|
|
||
| # Run the example | ||
| if [ "$API_TYPE" == "papi" ]; then | ||
| EXAMPLE_FILE="authorize_and_store_papi.js" | ||
| else | ||
| EXAMPLE_FILE="authorize_and_store.js" | ||
| fi | ||
| node $EXAMPLE_FILE | ||
| EXAMPLE_EXIT=$? | ||
|
|
||
| echo "" | ||
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | ||
| if [ $EXAMPLE_EXIT -eq 0 ]; then | ||
| echo "✅ Example completed successfully!" | ||
| else | ||
| echo "❌ Example failed with exit code $EXAMPLE_EXIT" | ||
| fi | ||
|
|
||
| echo "" | ||
| echo "📝 Logs available at:" | ||
| echo " /tmp/ipfs-daemon.log" | ||
| echo " /tmp/zombienet.log" | ||
| echo " /tmp/ipfs-reconnect.log" | ||
|
|
||
| # Clean up background processes | ||
| just teardown-services | ||
|
|
||
| exit $EXAMPLE_EXIT | ||
|
|
||
| # Run smoldot example with local Kubo | ||
| run-authorize-and-store-smoldot: build npm-install | ||
| #!/usr/bin/env bash | ||
|
|
@@ -272,7 +94,7 @@ _check-docker: | |
| fi | ||
|
|
||
| # Start IPFS Docker container | ||
| ipfs-docker-start: _check-docker | ||
| ipfs-start: _check-docker | ||
| #!/usr/bin/env bash | ||
| set -e | ||
| mkdir -p {{ PID_DIR }} | ||
|
|
@@ -301,7 +123,7 @@ ipfs-docker-start: _check-docker | |
| echo "ipfs-node" > {{ PID_DIR }}/ipfs-docker.container | ||
|
|
||
| # Connect to IPFS nodes using Docker | ||
| ipfs-docker-connect: | ||
| ipfs-connect: | ||
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
|
|
@@ -323,7 +145,7 @@ ipfs-docker-connect: | |
| docker exec ipfs-node ipfs swarm connect /$PROTOCOL/$DOCKER_HOST/tcp/12347/ws/p2p/12D3KooWRkZhiRhsqmrQ28rt73K7V3aCBpqKrLGSXmZ99PTcTZby || true | ||
|
|
||
| # Shutdown IPFS Docker container | ||
| ipfs-docker-shutdown: | ||
| ipfs-shutdown: | ||
| #!/usr/bin/env bash | ||
|
|
||
| echo "🛑 Shutting down IPFS Docker container..." | ||
|
|
@@ -334,7 +156,7 @@ ipfs-docker-shutdown: | |
| [ -f "{{ PID_DIR }}/ipfs-docker.container" ] && rm "{{ PID_DIR }}/ipfs-docker.container" && echo " ✓ Cleaned up container file" || true | ||
|
|
||
| # Start IPFS reconnect script in background (Docker mode) | ||
| ipfs-reconnect-docker-start: | ||
| ipfs-reconnect-start: | ||
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
|
|
@@ -349,17 +171,17 @@ ipfs-reconnect-docker-start: | |
| sleep 2 | ||
|
|
||
| # Setup all services using Docker for IPFS | ||
| setup-services-docker: | ||
| setup-services: | ||
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
| echo "🔧 Tearing down Docker services if they are running..." | ||
| just ipfs-docker-shutdown | ||
| just ipfs-shutdown | ||
|
|
||
| echo "🐳 Setting up services with Docker IPFS..." | ||
|
|
||
| # Start services with Docker | ||
| just ipfs-docker-start | ||
| just ipfs-start | ||
| just bulletin-solo-zombienet-start | ||
|
|
||
| # Wait a bit longer and verify zombienet is running | ||
|
|
@@ -370,14 +192,14 @@ setup-services-docker: | |
| echo " Checking zombienet log:" | ||
| tail -20 /tmp/zombienet.log || echo " ⚠ Could not read zombienet log" | ||
|
|
||
| just ipfs-docker-connect | ||
| just ipfs-reconnect-docker-start | ||
| just ipfs-connect | ||
| just ipfs-reconnect-start | ||
| just papi-generate | ||
|
|
||
| echo "✅ Services setup complete (Docker mode)" | ||
|
|
||
| # Stop all Docker services | ||
| teardown-services-docker: | ||
| teardown-services: | ||
| #!/usr/bin/env bash | ||
|
|
||
| echo "🧹 Stopping all Docker services..." | ||
|
|
@@ -399,7 +221,7 @@ teardown-services-docker: | |
| fi | ||
|
|
||
| # Stop Docker container | ||
| just ipfs-docker-shutdown | ||
| just ipfs-shutdown | ||
|
|
||
| # Clean up PID directory | ||
| if [ -d {{ PID_DIR }} ]; then | ||
|
|
@@ -409,14 +231,14 @@ teardown-services-docker: | |
| echo "✅ Docker services stopped" | ||
|
|
||
| # Run RPC node example with Docker IPFS | ||
| run-authorize-and-store-docker: build npm-install | ||
| run-authorize-and-store: build npm-install | ||
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
| echo "🚀 Starting RPC node workflow test with Docker..." | ||
| echo "" | ||
|
|
||
| just setup-services-docker | ||
| just setup-services | ||
| node authorize_and_store_papi.js | ||
| EXAMPLE_EXIT=$? | ||
|
|
||
|
|
@@ -428,18 +250,18 @@ run-authorize-and-store-docker: build npm-install | |
| echo "❌ Example failed with exit code $EXAMPLE_EXIT" | ||
| fi | ||
|
|
||
| just teardown-services-docker | ||
| just teardown-services | ||
| exit $EXAMPLE_EXIT | ||
|
|
||
| # Run smoldot example with Docker IPFS | ||
| run-authorize-and-store-smoldot-docker: build npm-install | ||
| run-authorize-and-store-smoldot: build npm-install | ||
|
||
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
| echo "🚀 Starting smoldot workflow test with Docker..." | ||
| echo "" | ||
|
|
||
| just setup-services-docker | ||
| just setup-services | ||
| node authorize_and_store_papi_smoldot.js | ||
| EXAMPLE_EXIT=$? | ||
|
|
||
|
|
@@ -451,5 +273,5 @@ run-authorize-and-store-smoldot-docker: build npm-install | |
| echo "❌ Example failed with exit code $EXAMPLE_EXIT" | ||
| fi | ||
|
|
||
| just teardown-services-docker | ||
| just teardown-services | ||
| exit $EXAMPLE_EXIT | ||
bkontur marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.