99jobs :
1010 test :
1111 runs-on : ubuntu-latest
12+ timeout-minutes : 3
1213
1314 steps :
14- - uses : actions/checkout@v3
15+ - name : Checkout code
16+ uses : actions/checkout@v4
1517
16- - name : Set up Docker
17- uses : docker/setup-buildx-action@v1
18+ - name : Set up Docker Buildx
19+ uses : docker/setup-buildx-action@v3
1820
19- - name : Install Docker Compose
21+ - name : Verify Docker Compose
22+ shell : bash
2023 run : |
21- sudo apt-get update
22- sudo apt-get install -y docker-compose
24+ set -euo pipefail
25+ if docker compose version >/dev/null 2>&1; then
26+ echo "Using Docker Compose plugin"
27+ docker compose version
28+ elif command -v docker-compose >/dev/null 2>&1; then
29+ echo "Using docker-compose standalone"
30+ docker-compose --version
31+ else
32+ echo "Error: Docker Compose not available"
33+ exit 1
34+ fi
2335
24- - name : Start Preprod node, wait 30s then stop node
36+ - name : Test Preprod node
2537 shell : bash
38+ timeout-minutes : 10
2639 run : |
27- printf "1\n" | /bin/bash ./start-node.sh 2>&1 | tee script_output.txt &
40+ set -euo pipefail
41+ printf "2\n1\n" | ./start-node.sh 2>&1 | tee preprod_output.txt &
42+ START_PID=$!
2843 sleep 30
29- /bin/bash ./stop-nodes.sh
44+ if ! kill -0 $START_PID 2>/dev/null; then
45+ echo "Error: start-node.sh process died unexpectedly"
46+ exit 1
47+ fi
48+ ./stop-nodes.sh
49+ wait $START_PID || true
50+ if [ -f preprod_output.txt ]; then
51+ echo "=== Preprod Node Output ==="
52+ cat preprod_output.txt
53+ fi
54+
55+ - name : Cleanup after Preprod
56+ if : always()
57+ shell : bash
58+ run : |
59+ set -euo pipefail
60+ ./stop-nodes.sh || true
61+ docker ps -a --filter "name=node-" --format "{{.Names}}" | xargs -r docker rm -f || true
3062
31- - name : Start Preview node, wait 30s then stop node
63+ - name : Test Preview node
3264 shell : bash
65+ timeout-minutes : 3
3366 run : |
34- printf "2\n" | /bin/bash ./start-node.sh 2>&1 | tee script_output.txt &
67+ set -euo pipefail
68+ printf "3\n1\n" | ./start-node.sh 2>&1 | tee preview_output.txt &
69+ START_PID=$!
3570 sleep 30
36- /bin/bash ./stop-nodes.sh
71+ if ! kill -0 $START_PID 2>/dev/null; then
72+ echo "Error: start-node.sh process died unexpectedly"
73+ exit 1
74+ fi
75+ ./stop-nodes.sh
76+ wait $START_PID || true
77+ if [ -f preview_output.txt ]; then
78+ echo "=== Preview Node Output ==="
79+ cat preview_output.txt
80+ fi
3781
38- - name : Start SanchoNet node, wait 30s then stop node
82+ - name : Cleanup after Preview
83+ if : always()
3984 shell : bash
4085 run : |
41- printf "3\n" | /bin/bash ./start-node.sh 2>&1 | tee script_output.txt &
86+ set -euo pipefail
87+ ./stop-nodes.sh || true
88+ docker ps -a --filter "name=node-" --format "{{.Names}}" | xargs -r docker rm -f || true
89+
90+ - name : Test SanchoNet node
91+ shell : bash
92+ timeout-minutes : 3
93+ run : |
94+ set -euo pipefail
95+ printf "4\n1\n" | ./start-node.sh 2>&1 | tee sancho_output.txt &
96+ START_PID=$!
4297 sleep 30
43- /bin/bash ./stop-nodes.sh
98+ if ! kill -0 $START_PID 2>/dev/null; then
99+ echo "Error: start-node.sh process died unexpectedly"
100+ exit 1
101+ fi
102+ ./stop-nodes.sh
103+ wait $START_PID || true
104+ if [ -f sancho_output.txt ]; then
105+ echo "=== SanchoNet Node Output ==="
106+ cat sancho_output.txt
107+ fi
108+
109+ - name : Final cleanup
110+ if : always()
111+ shell : bash
112+ run : |
113+ set -euo pipefail
114+ ./stop-nodes.sh || true
115+ docker ps -a --filter "name=node-" --format "{{.Names}}" | xargs -r docker rm -f || true
116+ docker system prune -f || true
117+
118+ - name : Upload logs on failure
119+ if : failure()
120+ uses : actions/upload-artifact@v4
121+ with :
122+ name : node-logs
123+ path : |
124+ *_output.txt
125+ script_output.txt
126+ retention-days : 7
0 commit comments