Skip to content

Commit 9213cab

Browse files
committed
Check on CI demo sanity on Mac and Linux
1 parent a308f41 commit 9213cab

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/demo-test.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: "Demo Sanity Check"
2+
3+
on:
4+
merge_group:
5+
push:
6+
branches:
7+
- master
8+
- release
9+
pull_request:
10+
workflow_dispatch:
11+
12+
jobs:
13+
demo-test:
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, macos-latest]
17+
runs-on: ${{ matrix.os }}
18+
name: "Test demo on ${{ matrix.os }}"
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
submodules: true
23+
24+
- name: ❄ Setup Nix/Cachix
25+
uses: ./.github/actions/nix-cachix-setup
26+
with:
27+
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
28+
29+
- name: Modify demo to run headlessly
30+
run: |
31+
sed -i.bak 's/is_foreground = true/is_foreground = false/g' nix/hydra/demo.nix
32+
33+
- name: Run demo in background
34+
run: |
35+
nix run .#demo &
36+
echo $! > process-compose.pid
37+
38+
- name: Wait for hydra nodes to be ready
39+
run: |
40+
set -e
41+
echo "Waiting for hydra nodes to start..."
42+
nix shell nixpkgs#coreutils -c timeout 300s bash -c '
43+
until [ $(grep -c "hydra-node-.* is ready" devnet/logs/process-compose.log 2>/dev/null || echo 0) -ge 3 ]; do
44+
echo -n "."
45+
sleep 5
46+
if ! ps -p $(cat process-compose.pid) > /dev/null; then
47+
echo "Process-compose exited prematurely."
48+
cat devnet/logs/process-compose.log
49+
exit 1
50+
fi
51+
done
52+
echo "All hydra nodes are ready!"
53+
'
54+
- name: Stop demo
55+
if: always()
56+
run: |
57+
kill $(cat process-compose.pid)

0 commit comments

Comments
 (0)