-
Notifications
You must be signed in to change notification settings - Fork 65
289 lines (289 loc) · 11 KB
/
Copy pathci.yml
File metadata and controls
289 lines (289 loc) · 11 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
name: CI
permissions:
contents: read
actions: read
packages: read
statuses: write
checks: write
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-ffi:
name: Rebuild FFI (Linux)
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
rebuilt: ${{ steps.check.outputs.changed }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: false
submodules: recursive
fetch-depth: 0
# Decide whether to rebuild the Linux FFI lib.
# Label overrides (PRs only) take priority over submodule diff:
# - `release` → skip rebuild (test against the committed prebuilt .so)
# - `rust-dependency` → force rebuild (escape hatch / explicit opt-in)
# If neither label is set, fall back to diffing client-sdk-rust~ against the base ref.
- name: Check for Rust submodule changes
id: check
env:
PR_LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }}
run: |
BASE_REF="${{ github.event.pull_request.base.ref || 'main' }}"
HAS_RELEASE_LABEL=$(echo "$PR_LABELS" | jq -r '(. // []) | any(. == "release")')
HAS_REBUILD_LABEL=$(echo "$PR_LABELS" | jq -r '(. // []) | any(. == "rust-dependency")')
if [ "$HAS_RELEASE_LABEL" = "true" ]; then
echo "'release' label set — skipping rebuild (testing against committed prebuilt lib)"
echo "changed=false" >> $GITHUB_OUTPUT
elif [ "$HAS_REBUILD_LABEL" = "true" ]; then
echo "'rust-dependency' label set — forcing rebuild"
echo "changed=true" >> $GITHUB_OUTPUT
elif git diff --name-only "origin/$BASE_REF"...HEAD | grep -q "^client-sdk-rust~" ; then
echo "Rust submodule has changes — will rebuild"
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "No Rust submodule changes — skipping build"
echo "changed=false" >> $GITHUB_OUTPUT
fi
# Mirrors the Linux build from the upstream Rust SDK's ffi-builds.yml.
# If this breaks after an upstream change, check for updates there:
# https://github.com/livekit/client-sdk-rust/blob/main/.github/workflows/ffi-builds.yml
- name: Build liblivekit_ffi.so
if: steps.check.outputs.changed == 'true'
run: |
docker run --rm -v $PWD/client-sdk-rust~:/workspace -w /workspace \
sameli/manylinux_2_28_x86_64_cuda_12.3 bash -c "\
export PATH=/root/.cargo/bin:\$PATH && \
yum install -y llvm llvm-libs lld clang protobuf-compiler && \
yum groupinstall -y 'Development Tools' && \
yum install -y openssl-devel libX11-devel mesa-libGL-devel libXext-devel && \
curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
cd livekit-ffi && cargo build --release --target x86_64-unknown-linux-gnu"
sudo cp client-sdk-rust~/target/x86_64-unknown-linux-gnu/release/liblivekit_ffi.so \
Runtime/Plugins/ffi-linux-x86_64/liblivekit_ffi.so
- name: Upload rebuilt library
if: steps.check.outputs.changed == 'true'
uses: actions/upload-artifact@v4
with:
name: ffi-linux-x86_64
path: Runtime/Plugins/ffi-linux-x86_64/liblivekit_ffi.so
test:
name: Test (${{ matrix.unityVersion }})
needs: build-ffi
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
unityVersion: [6000.0.49f1, 2023.2.20f1]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
- name: Download rebuilt FFI library
if: needs.build-ffi.outputs.rebuilt == 'true'
uses: actions/download-artifact@v4
with:
name: ffi-linux-x86_64
path: Runtime/Plugins/ffi-linux-x86_64/
# Required when using package mode, see open issue:
# https://github.com/game-ci/unity-test-runner/issues/223
- name: Move Into Subdirectory
shell: bash
run: |
mkdir root
shopt -s dotglob extglob
mv !(root) root/
# Required for E2E tests
- name: Run LiveKit Server
uses: livekit/dev-server-action@61e2b4dcb170dd3591e0c9b0db3c3fe5db93b500
with:
github-token: ${{ github.token }}
- name: Run Tests
uses: game-ci/unity-test-runner@v4
id: testRunner
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: root
unityVersion: ${{ matrix.unityVersion }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
checkName: Test Results (${{ matrix.unityVersion }})
packageMode: true
useHostNetwork: true
- name: Generate HTML Test Report
if: always()
run: |
ARTIFACTS="${{ steps.testRunner.outputs.artifactsPath || 'artifacts' }}"
python3 root/Scripts~/unity_test_results_utils.py \
"$ARTIFACTS/editmode-results.xml" \
"$ARTIFACTS/playmode-results.xml" \
-o test-results.html
- name: Test Summary
if: always()
run: |
ARTIFACTS="${{ steps.testRunner.outputs.artifactsPath || 'artifacts' }}"
CRASHED=""
for MODE in editmode playmode; do
if [ ! -f "$ARTIFACTS/${MODE}-results.xml" ]; then
CRASHED="$CRASHED $MODE"
fi
done
if [ -n "$CRASHED" ]; then
echo "## :boom: Unity crashed during tests" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Missing results for:**$CRASHED**. Unity exited before writing results." >> $GITHUB_STEP_SUMMARY
echo "Check the **Run Tests** step logs for a native stack trace or abort signal." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
fi
python3 root/Scripts~/unity_test_results_utils.py \
"$ARTIFACTS/editmode-results.xml" \
"$ARTIFACTS/playmode-results.xml" \
-f markdown >> $GITHUB_STEP_SUMMARY
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test results (${{ matrix.unityVersion }})
path: |
${{ steps.testRunner.outputs.artifactsPath || 'artifacts' }}
test-results.html
# For platforms with build support on Linux
build-linux:
env:
UNITY_PROJECT_PATH: Samples~/Basic
name: Build (${{ matrix.targetPlatform }}, ${{ matrix.unityVersion }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
unityVersion: [6000.0.49f1]
targetPlatform: [iOS, Android, StandaloneLinux64]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
- uses: actions/cache@v3
with:
path: ${{ env.UNITY_PROJECT_PATH }}/Library
key: Library-${{ env.UNITY_PROJECT_PATH }}-${{ matrix.targetPlatform }}-${{ hashFiles(env.UNITY_PROJECT_PATH) }}
restore-keys: |
Library-${{ env.UNITY_PROJECT_PATH }}-${{ matrix.targetPlatform }}-
Library-${{ env.UNITY_PROJECT_PATH }}-
Library-
# Android build requires more disk space than other platforms
# Solution: clear disk space first
- name: Free Disk Space
if: matrix.targetPlatform == 'Android'
uses: jlumbroso/free-disk-space@v1.3.1
- name: Build
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: ${{ env.UNITY_PROJECT_PATH }}
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: Build (${{ matrix.targetPlatform }})
path: build/${{ matrix.targetPlatform }}
retention-days: 1
# For platforms with build support on Windows
build-windows:
env:
UNITY_PROJECT_PATH: Samples~/Basic
name: Build (${{ matrix.targetPlatform }}, ${{ matrix.unityVersion }})
runs-on: windows-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
unityVersion: [6000.0.49f1]
targetPlatform: [StandaloneWindows64]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
- uses: actions/cache@v3
with:
path: ${{ env.UNITY_PROJECT_PATH }}/Library
key: Library-${{ env.UNITY_PROJECT_PATH }}-${{ matrix.targetPlatform }}-${{ hashFiles(env.UNITY_PROJECT_PATH) }}
restore-keys: |
Library-${{ env.UNITY_PROJECT_PATH }}-${{ matrix.targetPlatform }}-
Library-${{ env.UNITY_PROJECT_PATH }}-
Library-
- name: Build
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: ${{ env.UNITY_PROJECT_PATH }}
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: Build (${{ matrix.targetPlatform }})
path: build/${{ matrix.targetPlatform }}
retention-days: 1
# For platforms with build support on MacOS
build-macos:
env:
UNITY_PROJECT_PATH: Samples~/Basic
name: Build (${{ matrix.targetPlatform }}, ${{ matrix.unityVersion }})
runs-on: macos-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
unityVersion: [6000.0.49f1]
targetPlatform: [StandaloneOSX]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
- uses: actions/cache@v3
with:
path: ${{ env.UNITY_PROJECT_PATH }}/Library
key: Library-${{ env.UNITY_PROJECT_PATH }}-${{ matrix.targetPlatform }}-${{ hashFiles(env.UNITY_PROJECT_PATH) }}
restore-keys: |
Library-${{ env.UNITY_PROJECT_PATH }}-${{ matrix.targetPlatform }}-
Library-${{ env.UNITY_PROJECT_PATH }}-
Library-
- name: Build
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: ${{ env.UNITY_PROJECT_PATH }}
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: Build (${{ matrix.targetPlatform }})
path: build/${{ matrix.targetPlatform }}
retention-days: 1