1111 branches : [prod, dev]
1212
1313jobs :
14- runUnitTests :
15- name : Playwright Unit Tests
16- container :
17- image : mcr.microsoft.com/playwright:v1.61.0-noble
14+ setupCaches :
15+ name : Prepare Assetpack
1816 runs-on : ubuntu-latest
1917 defaults :
2018 run :
@@ -23,44 +21,52 @@ jobs:
2321 - name : Checkout Code
2422 uses : actions/checkout@v7
2523
26- - name : Install System Dependencies
24+ - name : Remove zstd for gzip cache compatibility with container jobs # This is super scuffed but that's just how the oil gushes
2725 run : |
28- apt-get update
29- apt-get install -y git-lfs unzip
30-
31- - name : Bun Setup
32- uses : oven-sh/setup-bun@v2
33- with :
34- bun-version : ${{ env.BUN_VERSION }}
26+ sudo apt-get remove -y zstd
27+ sudo rm /usr/local/bin/zstd
28+ zstd --help || true
3529
3630 - name : Cache Unzipped Synthesis Assets
3731 id : cache-assets
3832 uses : actions/cache@v6
3933 with :
4034 path : fission/public/Downloadables
41- key : ${{ runner.os }}- assets-${{hashFiles('fission/public/assetpack.zip')}}
35+ key : assets-${{hashFiles('fission/public/assetpack.zip')}}
4236
4337 - name : Download Synthesis assetpack if not cached
4438 if : steps.cache-assets.outputs.cache-hit != 'true'
4539 run : |
4640 cd ..
4741 git config --global --add safe.directory `pwd`
4842 git lfs pull
49-
43+
5044 cd fission
5145 unzip -o public/assetpack.zip -d public/ || echo
5246
53- - name : Cache Node Dependencies
54- uses : actions/cache@v6
55- with :
56- key : " ${{runner.os}}-npm-fission-${{hashFiles('fission/bun.lock')}}"
57- path : " fission/node_modules"
58- restore-keys : |
59- ${{runner.os}}-npm-fission-
60- ${{runner.os}}-npm
6147
62- - name : Install Dependencies
63- run : bun install --frozen-lockfile
48+ runUnitTests :
49+ name : Playwright Unit Tests
50+ needs : setupCaches
51+ container :
52+ image : mcr.microsoft.com/playwright:v1.61.0-noble
53+ runs-on : ubuntu-latest
54+ defaults :
55+ run :
56+ working-directory : " fission"
57+ steps :
58+ - name : Checkout Code
59+ uses : actions/checkout@v7
60+
61+ - name : Setup Fission Bun
62+ uses : ./.github/actions/FissionSetup
63+
64+ - name : Restore Unzipped Synthesis Assets
65+ uses : actions/cache/restore@v6
66+ with :
67+ fail-on-cache-miss : true
68+ path : fission/public/Downloadables
69+ key : assets-${{hashFiles('fission/public/assetpack.zip')}}
6470
6571 - name : Run Tests
6672 run : |
6975
7076 runAssetpackTests :
7177 name : Assetpack Tests
72- needs : runUnitTests
78+ needs : setupCaches
7379 container :
7480 image : mcr.microsoft.com/playwright:v1.61.0-noble
7581 runs-on : ubuntu-latest
@@ -80,35 +86,118 @@ jobs:
8086 - name : Checkout Code
8187 uses : actions/checkout@v7
8288
83- - name : Install System Dependencies
84- run : |
85- apt-get update
86- apt-get install -y unzip
89+ - name : Setup Fission Bun
90+ uses : ./.github/actions/FissionSetup
8791
88- - name : Bun Setup
89- uses : oven-sh/setup-bun@v2
90- with :
91- bun-version : ${{ env.BUN_VERSION }}
92-
93- - name : Cache Unzipped Synthesis Assets
92+ - name : Restore Unzipped Synthesis Assets
9493 id : cache-assets
95- uses : actions/cache@v6
94+ uses : actions/cache/restore @v6
9695 with :
96+ fail-on-cache-miss : true
9797 path : fission/public/Downloadables
98- key : ${{ runner.os }}- assets-${{hashFiles('fission/public/assetpack.zip')}}
98+ key : assets-${{hashFiles('fission/public/assetpack.zip')}}
9999
100- - name : Cache Node Dependencies
101- uses : actions/cache@v6
102- with :
103- key : " ${{runner.os}}-npm-fission-${{hashFiles('fission/bun.lock')}}"
104- path : " fission/node_modules"
105- restore-keys : |
106- ${{runner.os}}-npm-fission-
107- ${{runner.os}}-npm
108100
109101 - name : Run Assetpack Tests
110102 run : |
111103 HOME=/root bun run test src/test/mirabuf/DefaultAssets.test.ts 2>&1 | tee output.txt
112104 grep -q "GH ACTIONS VITEST PASSED" output.txt
113105 env :
114106 VITE_RUN_ASSETPACK_TEST : true
107+ runMultiplayerTests :
108+ name : Multiplayer Tests
109+ needs : setupCaches
110+ container :
111+ image : mcr.microsoft.com/playwright:v1.61.0-noble
112+ runs-on : ubuntu-latest
113+ defaults :
114+ run :
115+ working-directory : " fission"
116+ steps :
117+ - name : Checkout Code
118+ uses : actions/checkout@v7
119+
120+ - name : Setup Fission Bun
121+ uses : ./.github/actions/FissionSetup
122+
123+ - name : Restore Unzipped Synthesis Assets
124+ id : cache-assets
125+ uses : actions/cache/restore@v6
126+ with :
127+ fail-on-cache-miss : true
128+ path : fission/public/Downloadables
129+ key : assets-${{hashFiles('fission/public/assetpack.zip')}}
130+
131+
132+ - name : Install linker
133+ run :
134+ apt-get update -y &&
135+ apt-get install -y build-essential
136+
137+ - name : Setup Rust
138+ uses : actions-rust-lang/setup-rust-toolchain@v1
139+
140+ - name : Build server
141+ shell : bash
142+ working-directory : " glueball"
143+ run : cargo build
144+
145+ - name : Start server
146+ shell : bash
147+ working-directory : " glueball"
148+ run : |
149+ ./target/debug/glueball --secure --headless --permanent-room TEST01 > server.log 2>&1 &
150+ echo $! > server.pid
151+
152+ # Wait for server to start
153+ for i in {1..30}; do
154+ if curl --insecure --fail --silent https://localhost:2610/ > /dev/null; then
155+ echo "Server ready"
156+ exit 0
157+ fi
158+
159+ if ! kill -0 "$(cat server.pid)" 2>/dev/null; then
160+ echo "Server exited"
161+ cat server.log
162+ exit 1
163+ fi
164+
165+ sleep 1
166+ done
167+
168+ echo "Timed out while waiting for server startup"
169+ cat server.log
170+ exit 1
171+
172+ - name : Run Multiplayer Tests
173+ run : |
174+ HOME=/root bun run test src/test/multiplayer/ 2>&1 | tee output.txt
175+ grep -q "GH ACTIONS VITEST PASSED" output.txt
176+ env :
177+ VITE_RUN_MULTIPLAYER_TEST : true
178+
179+ - name : Stop server
180+ if : always()
181+ working-directory : " glueball"
182+ shell : bash
183+ run : |
184+ if [[ -f server.pid ]]; then
185+ PID="$(cat server.pid)"
186+
187+ if kill -0 "$PID" 2>/dev/null; then
188+ kill "$PID"
189+
190+ # Wait for clean shutdown
191+ for i in {1..10}; do
192+ kill -0 "$PID" 2>/dev/null || exit 0
193+ sleep 1
194+ done
195+
196+ kill -9 "$PID" 2>/dev/null || true
197+ fi
198+ fi
199+
200+ - name : Show server logs on failure
201+ if : failure()
202+ working-directory : " glueball"
203+ run : cat server.log || true
0 commit comments