-
Notifications
You must be signed in to change notification settings - Fork 62
203 lines (169 loc) · 5.42 KB
/
Copy pathFissionUnitTest.yml
File metadata and controls
203 lines (169 loc) · 5.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: Fission - Unit Test
env:
BUN_VERSION: "1.3.14"
on:
workflow_dispatch: {}
push:
branches: [prod, dev]
pull_request:
branches: [prod, dev]
jobs:
setupCaches:
name: Prepare Assetpack
runs-on: ubuntu-latest
defaults:
run:
working-directory: "fission"
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Remove zstd for gzip cache compatibility with container jobs # This is super scuffed but that's just how the oil gushes
run: |
sudo apt-get remove -y zstd
sudo rm /usr/local/bin/zstd
zstd --help || true
- name: Cache Unzipped Synthesis Assets
id: cache-assets
uses: actions/cache@v6
with:
path: fission/public/Downloadables
key: assets-${{hashFiles('fission/public/assetpack.zip')}}
- name: Download Synthesis assetpack if not cached
if: steps.cache-assets.outputs.cache-hit != 'true'
run: |
cd ..
git config --global --add safe.directory `pwd`
git lfs pull
cd fission
unzip -o public/assetpack.zip -d public/ || echo
runUnitTests:
name: Playwright Unit Tests
needs: setupCaches
container:
image: mcr.microsoft.com/playwright:v1.61.0-noble
runs-on: ubuntu-latest
defaults:
run:
working-directory: "fission"
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Setup Fission Bun
uses: ./.github/actions/FissionSetup
- name: Restore Unzipped Synthesis Assets
uses: actions/cache/restore@v6
with:
fail-on-cache-miss: true
path: fission/public/Downloadables
key: assets-${{hashFiles('fission/public/assetpack.zip')}}
- name: Run Tests
run: |
HOME=/root bun run test 2>&1 | tee output.txt
grep -q "GH ACTIONS VITEST PASSED" output.txt
runAssetpackTests:
name: Assetpack Tests
needs: setupCaches
container:
image: mcr.microsoft.com/playwright:v1.61.0-noble
runs-on: ubuntu-latest
defaults:
run:
working-directory: "fission"
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Setup Fission Bun
uses: ./.github/actions/FissionSetup
- name: Restore Unzipped Synthesis Assets
id: cache-assets
uses: actions/cache/restore@v6
with:
fail-on-cache-miss: true
path: fission/public/Downloadables
key: assets-${{hashFiles('fission/public/assetpack.zip')}}
- name: Run Assetpack Tests
run: |
HOME=/root bun run test src/test/mirabuf/DefaultAssets.test.ts 2>&1 | tee output.txt
grep -q "GH ACTIONS VITEST PASSED" output.txt
env:
VITE_RUN_ASSETPACK_TEST: true
runMultiplayerTests:
name: Multiplayer Tests
needs: setupCaches
container:
image: mcr.microsoft.com/playwright:v1.61.0-noble
runs-on: ubuntu-latest
defaults:
run:
working-directory: "fission"
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Setup Fission Bun
uses: ./.github/actions/FissionSetup
- name: Restore Unzipped Synthesis Assets
id: cache-assets
uses: actions/cache/restore@v6
with:
fail-on-cache-miss: true
path: fission/public/Downloadables
key: assets-${{hashFiles('fission/public/assetpack.zip')}}
- name: Install linker
run:
apt-get update -y &&
apt-get install -y build-essential
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build server
shell: bash
working-directory: "glueball"
run: cargo build
- name: Start server
shell: bash
working-directory: "glueball"
run: |
./target/debug/glueball --secure --headless --permanent-room TEST01 > server.log 2>&1 &
echo $! > server.pid
# Wait for server to start
for i in {1..30}; do
if curl --insecure --fail --silent https://localhost:2610/ > /dev/null; then
echo "Server ready"
exit 0
fi
if ! kill -0 "$(cat server.pid)" 2>/dev/null; then
echo "Server exited"
cat server.log
exit 1
fi
sleep 1
done
echo "Timed out while waiting for server startup"
cat server.log
exit 1
- name: Run Multiplayer Tests
run: |
HOME=/root bun run test src/test/multiplayer/ 2>&1 | tee output.txt
grep -q "GH ACTIONS VITEST PASSED" output.txt
env:
VITE_RUN_MULTIPLAYER_TEST: true
- name: Stop server
if: always()
working-directory: "glueball"
shell: bash
run: |
if [[ -f server.pid ]]; then
PID="$(cat server.pid)"
if kill -0 "$PID" 2>/dev/null; then
kill "$PID"
# Wait for clean shutdown
for i in {1..10}; do
kill -0 "$PID" 2>/dev/null || exit 0
sleep 1
done
kill -9 "$PID" 2>/dev/null || true
fi
fi
- name: Show server logs on failure
if: failure()
working-directory: "glueball"
run: cat server.log || true