-
Notifications
You must be signed in to change notification settings - Fork 125
690 lines (681 loc) · 34 KB
/
Copy pathbuild.yml
File metadata and controls
690 lines (681 loc) · 34 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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
name: Cesium for Unity
on: [push]
env:
VCPKG_BINARY_SOURCES: 'clear;x-aws,s3://cesium-builds/vcpkg/cesium-native-cache/,readwrite'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_INTERNAL_SERVICES_VCPKG_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_INTERNAL_SERVICES_VCPKG_SECRET_KEY }}
AWS_REGION: us-east-1
jobs:
QuickChecks:
name: "Quick Checks"
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Check source formatting
run: |
cd native~
npm ci
npm run format -- --dry-run -Werror
Documentation:
runs-on: ubuntu-latest
steps:
- name: Install Doxygen
run: |
cd ~
wget https://github.com/doxygen/doxygen/releases/download/Release_1_13_2/doxygen-1.13.2.linux.bin.tar.gz
tar xzf doxygen-1.13.2.linux.bin.tar.gz
export PATH=$PWD/doxygen-1.13.2/bin:$PATH
echo "PATH=$PATH" >> "$GITHUB_ENV"
doxygen --version
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Generate Documentation
run: |
npm run doxygen
- name: Publish Documentation Artifact
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: ReferenceDocumentation
path: Documentation~/Reference
Windows:
needs: [QuickChecks]
runs-on: windows-latest
# Only allow a single Windows build at a time, for Unity licensing reasons
concurrency: windows
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.103"
- name: Cache vcpkg artifacts
uses: actions/cache@v4
with:
path: "d:/.ezvcpkg"
key: vcpkg-windows-${{ hashFiles('native~/vcpkg/ports/**/vcpkg.json', 'native~/vcpkg/triplets/**/*', 'native~/extern/*toolchain.cmake') }}-${{ hashFiles('native~/extern/cesium-native/CMakeLists.txt', 'native~/CMakeLists.txt') }}
restore-keys: |
vcpkg-windows-${{ hashFiles('native~/vcpkg/ports/**/vcpkg.json', 'native~/vcpkg/triplets/**/*', 'native~/extern/*toolchain.cmake') }}-
- name: Install latest ninja and cmake
uses: lukka/get-cmake@latest
with:
cmakeVersion: "3.31.6"
- name: Install nasm
uses: ilammy/setup-nasm@v1.5.1
- name: Install wget
run: |
choco install -y wget
- name: Install Unity Hub
run: |
wget https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubSetup-x64.exe
Start-Process "./UnityHubSetup-x64.exe" -Args "/S" -Wait
del ./UnityHubSetup-x64.exe
- name: Install Unity
run: |
Start-Process -FilePath "C:/Program Files/Unity Hub/Unity Hub.exe" -Args "-- --headless install --version 2022.3.41f1 --changeset 0f988161febf" -Wait
Start-Process -FilePath "C:/Program Files/Unity Hub/Unity Hub.exe" -Args "-- --headless install-modules --version 2022.3.41f1 --changeset 0f988161febf --module android android-sdk-ndk-tools android-open-jdk-11.0.14.1+1 universal-windows-platform" -Wait
- name: Create SSH tunnel to Unity License Server
env:
UNITY_LICENSE_SERVER_SSH_KEY: ${{ secrets.UNITY_LICENSE_SERVER_SSH_KEY }}
run: |
$ENV:UNITY_LICENSE_SERVER_SSH_KEY | Set-Content ~/unity-client-ssh-key
# Without StrictHostKeyChecking, OpenSSH will sit forever waiting for local input to confirm the server key is ok.
# We don't really care if the server is authentic, because we're not sending anything sensitive to it.
# The license server VM's sshd_config also needed to be modified with the following options, in order to prevent
# the tunnel from being closed between here and when we're ready to use it.
# TCPKeepAlive yes
# ClientAliveInterval 30
# ClientAliveCountMax 9999
start -FilePath ssh -ArgumentList "-o StrictHostKeyChecking=no -i ~/unity-client-ssh-key -L 127.0.0.1:12331:127.0.0.1:8080 unity-client@ec2-44-204-244-196.compute-1.amazonaws.com"
sleep 5
- name: Test Connection to Unity License Server
run: |
wget.exe http://127.0.0.1:12331/v1/admin/status
cat status
rm status
- name: Configure Unity to Use the License Server
run: |
mkdir -p $ENV:PROGRAMDATA/Unity/config
$filename="$ENV:PROGRAMDATA/Unity/config/services-config.json"
$text='{"licensingServiceBaseUrl":"http://localhost:12331","enableEntitlementLicensing":true,"clientConnectTimeoutSec":120,"clientHandshakeTimeoutSec":60,"toolset":"UnityLicenseServer_16768262570522_9"}'
[IO.File]::WriteAllLines($filename,$text)
- name: Update the version in Cesium.cpp
run: |
$VERSION = (Get-Content -path package.json | ConvertFrom-Json).version
$COMMIT = $(git rev-parse --short HEAD)
((Get-Content -path native~/src/Runtime/Cesium.cpp -Raw) -replace 'Cesium::version = "Development Build"',"Cesium::version = ""$VERSION""") | Set-Content -Path native~/src/Runtime/Cesium.cpp
((Get-Content -path native~/src/Runtime/Cesium.cpp -Raw) -replace 'Cesium::commit = "Unknown"',"Cesium::commit = ""$COMMIT""") | Set-Content -Path native~/src/Runtime/Cesium.cpp
# Sanity check that the replacements happened
if (-Not ((Get-Content -path native~/src/Runtime/Cesium.cpp -Raw) -match "$COMMIT")) { throw "Commit does not exist in file after replacement" }
if (-Not ((Get-Content -path native~/src/Runtime/Cesium.cpp -Raw) -match "$VERSION")) { throw "Version does not exist in file after replacement" }
- name: Move cesium-unity Repo Under Empty Project
run: |
mkdir -p d:\cesium\CesiumForUnityBuildProject\Packages\com.cesium.unity
mv $ENV:GITHUB_WORKSPACE/* d:\cesium\CesiumForUnityBuildProject\Packages\com.cesium.unity
# Disable Unity audio
mkdir -p d:\cesium\CesiumForUnityBuildProject\Packages\com.cesium.unity\ProjectSettings
$text="%YAML 1.1`n%TAG !u! tag:unity3d.com,2011:`n--- !u!11 &1`nAudioManager:`n m_DisableAudio: 1`n"
[IO.File]::WriteAllLines("d:/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity/ProjectSettings/AudioManager.asset",$text)
- name: Build Reinterop
run: |
cd d:\cesium\CesiumForUnityBuildProject\Packages\com.cesium.unity
dotnet publish Reinterop~ -o .
- name: Print disk space 1
if: success() || failure() # run this step even if previous step failed
run: |
get-psdrive
- name: Build Package
run: |
cd d:\cesium\CesiumForUnityBuildProject\Packages\com.cesium.unity
mkdir -p d:\cesium\temp
# Store temp files on the D drive, which is much faster than the EBS-backed C drive.
$ENV:TEMP="d:\cesium\temp"
# We only need a release build of vcpkg dependencies
$ENV:CESIUM_VCPKG_RELEASE_ONLY="TRUE"
# Clear ANDROID_NDK_ROOT so that we use Unity's version
Remove-Item Env:ANDROID_NDK_ROOT
# Explicitly set the ezvcpkg path. Otherwise it will be `/.ezvcpkg` and the drive letter is ambiguous.
$ENV:EZVCPKG_BASEDIR="D:/.ezvcpkg"
# Run the build
dotnet run --project Build~ package --platform Editor --platform Windows --platform UWP --platform Android
- name: Print disk space 2
if: success() || failure() # run this step even if previous step failed
run: |
get-psdrive
- name: Publish Logs
if: success() || failure() # run this step even if previous step failed
uses: actions/upload-artifact@v4
with:
name: Native Build Logs - Windows
path: d:/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity/native~/build-*/build.log
- name: Publish package artifact
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: Windows Package
path: d:\cesium\CesiumForUnityBuildProject\*.tgz
- name: Run Tests
env:
CESIUM_ION_TOKEN_FOR_TESTS: ${{ secrets.CESIUM_ION_TOKEN_FOR_TESTS }}
run: |
start -FilePath "C:\Program Files\Unity\Hub\Editor\2022.3.41f1\Editor\Unity.exe" -ArgumentList "-runTests -batchmode -projectPath d:\cesium\CesiumForUnityBuildProject -testResults d:\cesium\temp\TestResults.xml -testPlatform PlayMode -logFile d:\cesium\temp\test-log.txt" -Wait
cat d:\cesium\temp\test-log.txt
- name: Test Report
uses: kring/test-reporter@v1.6.2-kring
if: success() || failure() # run this step even if previous step failed
with:
name: Tests - Windows
path: d:/cesium/temp/TestResults.xml
reporter: dotnet-nunit
MacOS:
needs: [QuickChecks]
runs-on: macos-14
# Only allow a single macOS build at a time, for Unity licensing reasons
concurrency: mac
steps:
- name: Make some more disk space
run: |
df -h
ls /Applications
brew uninstall google-chrome
sudo rm -rf /Users/runner/Library/Android
sudo rm -rf /Applications/Xcode_14.3.1.app
sudo rm -rf /Applications/Xcode_14.3.app
sudo rm -rf /Applications/Xcode_15.0.1.app
sudo rm -rf /Applications/Xcode_15.0.app
sudo rm -rf /Applications/Xcode_15.1.0.app
sudo rm -rf /Applications/Xcode_15.1.app
sudo rm -rf /Applications/Xcode_15.2.0.app
sudo rm -rf /Applications/Xcode_15.2.app
sudo rm -rf /Applications/Xcode_15.3.0.app
sudo rm -rf /Applications/Xcode_15.3.app
sudo rm -rf /Applications/Xcode_16.0.0.app
sudo rm -rf /Applications/Xcode_16.0.app
sudo rm -rf /Applications/Xcode_16.1.0.app
sudo rm -rf /Applications/Xcode_16.1.app
sudo rm -rf /Applications/Xcode_16.1_beta.app
sudo rm -rf /Applications/Xcode_16_beta_6.app
ls /Applications
df -h
- name: Set XCode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "15.4"
- name: Print XCode version
run: |
xcode-select --print-path
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.103"
- name: Cache vcpkg artifacts
uses: actions/cache@v4
with:
path: "~/.ezvcpkg"
key: vcpkg-mac-${{ hashFiles('native~/vcpkg/ports/**/vcpkg.json', 'native~/vcpkg/triplets/**/*', 'native~/extern/*toolchain.cmake') }}-${{ hashFiles('native~/extern/cesium-native/CMakeLists.txt', 'native~/CMakeLists.txt') }}
restore-keys: |
vcpkg-mac-${{ hashFiles('native~/vcpkg/ports/**/vcpkg.json', 'native~/vcpkg/triplets/**/*', 'native~/extern/*toolchain.cmake') }}-
- name: Install nasm
uses: ilammy/setup-nasm@v1.5.1
- name: Install Unity Hub
run: |
wget --quiet https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubSetup-arm64.dmg
mkdir UnityHubSetup
hdiutil attach UnityHubSetup-arm64.dmg -mountpoint ./UnityHubSetup
sudo cp -R "./UnityHubSetup/Unity Hub.app" /Applications
hdiutil detach ./UnityHubSetup
rm ./UnityHubSetup-arm64.dmg
- name: Install Unity 2022.3.41f1
# This command sometimes returns exit code 130, despite actually succeeding.
continue-on-error: true
run: |
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install --version 2022.3.41f1 --changeset 0f988161febf --architecture arm64
- name: Install Unity iOS Support
run: |
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install-modules --version 2022.3.41f1 --changeset 0f988161febf --module ios --architecture arm64
- name: Configure Unity to Use the License Server
run: |
sudo mkdir -p "/Library/Application Support/Unity/config"
sudo chmod g+w "/Library/Application Support/Unity"
sudo chmod g+w "/Library/Application Support/Unity/config"
sudo echo '{"licensingServiceBaseUrl": "http://localhost:12331","enableEntitlementLicensing": true,"clientConnectTimeoutSec": 60,"clientHandshakeTimeoutSec": 120,"toolset":"UnityLicenseServer_16768262570522_9"}' > "/Library/Application Support/Unity/config/services-config.json"
- name: Create SSH tunnel to Unity License Server
env:
UNITY_LICENSE_SERVER_SSH_KEY: ${{ secrets.UNITY_LICENSE_SERVER_SSH_KEY }}
run: |
echo "$UNITY_LICENSE_SERVER_SSH_KEY" > ~/unity-client-ssh-key
chmod 600 ~/unity-client-ssh-key
# Without StrictHostKeyChecking, OpenSSH will sit forever waiting for local input to confirm the server key is ok.
# We don't really care if the server is authentic, because we're not sending anything sensitive to it.
# The license server VM's sshd_config also needed to be modified with the following options, in order to prevent
# the tunnel from being closed between here and when we're ready to use it.
# TCPKeepAlive yes
# ClientAliveInterval 30
# ClientAliveCountMax 9999
ssh -fNT -o StrictHostKeyChecking=no -i ~/unity-client-ssh-key -L 127.0.0.1:12331:127.0.0.1:8080 unity-client@ec2-44-204-244-196.compute-1.amazonaws.com
sleep 5
- name: Test Connection to Unity License Server
run: |
wget http://127.0.0.1:12331/v1/admin/status
cat status
rm status
- name: Update the version in Cesium.cpp
run: |
export VERSION=$(jq -r ".version" package.json)
export COMMIT=$(git rev-parse --short HEAD)
sed -i '' 's/Cesium::version = "Development Build"/Cesium::version = "'$VERSION'"/g' native~/src/Runtime/Cesium.cpp
sed -i '' 's/Cesium::commit = "Unknown"/Cesium::commit = "'$COMMIT'"/g' native~/src/Runtime/Cesium.cpp
# Sanity check that the replacements happened
grep $VERSION native~/src/Runtime/Cesium.cpp
grep $COMMIT native~/src/Runtime/Cesium.cpp
- name: Move cesium-unity Repo Under Empty Project
run: |
mkdir -p ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity
mv $GITHUB_WORKSPACE/* ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity
# Disable Unity audio
mkdir -p ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity/ProjectSettings
echo '%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!11 &1\nAudioManager:\n m_DisableAudio: 1\n' > ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity/ProjectSettings/AudioManager.asset
- name: Build Reinterop
run: |
cd ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity
dotnet publish Reinterop~ -o .
- name: Verify Reinterop analyzer inputs
run: |
cd ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity
echo "dotnet version: $(dotnet --version)"
ls -l Reinterop.dll Reinterop.dll.meta Source/csc.rsp
shasum -a 256 Reinterop.dll
if [ ! -f Reinterop.dll ]; then
echo "Reinterop.dll is missing before Build Package"
exit 1
fi
if ! grep -q "RoslynAnalyzer" Reinterop.dll.meta; then
echo "Reinterop.dll.meta is missing the RoslynAnalyzer label"
echo "Current Reinterop.dll.meta:"
cat Reinterop.dll.meta
exit 1
fi
- name: Build Package
run: |
# We only need a release build of vcpkg dependencies
export CESIUM_VCPKG_RELEASE_ONLY="TRUE"
cd ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity
dotnet run --project Build~ package --platform Editor --platform macOS --platform iOS
ls -l ~/cesium/CesiumForUnityBuildProject
- name: Publish Logs
if: success() || failure() # run this step even if previous step failed
uses: actions/upload-artifact@v4
with:
name: Native Build Logs - macOS
path: ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity/native~/build-*/build.log
- name: Publish package artifact
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: macOS Package
path: ~/cesium/CesiumForUnityBuildProject/*.tgz
- name: Run Tests
env:
CESIUM_ION_TOKEN_FOR_TESTS: ${{ secrets.CESIUM_ION_TOKEN_FOR_TESTS }}
run: |
/Applications/Unity/Hub/Editor/2022.3.41f1/Unity.app/Contents/MacOS/Unity -runTests -batchmode -projectPath ~/cesium/CesiumForUnityBuildProject -testResults ~/cesium/CesiumForUnityBuildProject/TestResults.xml -testPlatform PlayMode -logFile ~/cesium/CesiumForUnityBuildProject/test-log.txt
cat ~/cesium/CesiumForUnityBuildProject/test-log.txt
ls /Users/runner/cesium/CesiumForUnityBuildProject/TestResults.xml
- name: Test Report
uses: kring/test-reporter@v1.6.2-kring
if: success() || failure() # run this step even if previous step failed
with:
name: Tests - macOS
path: /Users/runner/cesium/CesiumForUnityBuildProject/TestResults.xml
reporter: dotnet-nunit
Linux:
needs: [QuickChecks]
runs-on: ubuntu-latest
# Only allow a single Linux build at a time, for Unity licensing reasons
concurrency: linux
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.103"
- name: Cache vcpkg artifacts
uses: actions/cache@v4
with:
path: "~/.ezvcpkg"
key: vcpkg-linux-alma-${{ hashFiles('native~/vcpkg/ports/**/vcpkg.json', 'native~/vcpkg/triplets/**/*', 'native~/extern/*toolchain.cmake') }}-${{ hashFiles('native~/extern/cesium-native/CMakeLists.txt', 'native~/CMakeLists.txt') }}
restore-keys: |
vcpkg-linux-alma-${{ hashFiles('native~/vcpkg/ports/**/vcpkg.json', 'native~/vcpkg/triplets/**/*', 'native~/extern/*toolchain.cmake') }}-
- name: Install Unity Hub
run: |
sudo apt-get install -y gnupg libgbm1 xvfb
wget -qO - https://hub.unity3d.com/linux/keys/public | gpg --dearmor | sudo tee /usr/share/keyrings/Unity_Technologies_ApS.gpg > /dev/null
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/Unity_Technologies_ApS.gpg] https://hub.unity3d.com/linux/repos/deb stable main" > /etc/apt/sources.list.d/unityhub.list'
sudo apt-get update
sudo apt-get install -y unityhub
- name: Install Unity 2022.3.41f1
# This command sometimes returns exit code 130, despite actually succeeding.
# unityhub-bin requires a virtual display even in headless mode.
continue-on-error: true
run: |
xvfb-run -a /opt/unityhub/unityhub-bin --no-sandbox --headless install --version 2022.3.41f1 --changeset 0f988161febf
- name: Configure Unity to Use the License Server
run: |
sudo mkdir -p /usr/share/unity3d/config
sudo bash -c 'echo "{\"licensingServiceBaseUrl\": \"http://localhost:12331\",\"enableEntitlementLicensing\": true,\"clientConnectTimeoutSec\": 60,\"clientHandshakeTimeoutSec\": 120,\"toolset\":\"UnityLicenseServer_16768262570522_9\"}" > /usr/share/unity3d/config/services-config.json'
- name: Create SSH tunnel to Unity License Server
env:
UNITY_LICENSE_SERVER_SSH_KEY: ${{ secrets.UNITY_LICENSE_SERVER_SSH_KEY }}
run: |
echo "$UNITY_LICENSE_SERVER_SSH_KEY" > ~/unity-client-ssh-key
chmod 600 ~/unity-client-ssh-key
# Without StrictHostKeyChecking, OpenSSH will sit forever waiting for local input to confirm the server key is ok.
# We don't really care if the server is authentic, because we're not sending anything sensitive to it.
# The license server VM's sshd_config also needed to be modified with the following options, in order to prevent
# the tunnel from being closed between here and when we're ready to use it.
# TCPKeepAlive yes
# ClientAliveInterval 30
# ClientAliveCountMax 9999
ssh -fNT -o StrictHostKeyChecking=no -i ~/unity-client-ssh-key -L 127.0.0.1:12331:127.0.0.1:8080 unity-client@ec2-44-204-244-196.compute-1.amazonaws.com
sleep 5
- name: Test Connection to Unity License Server
run: |
wget http://127.0.0.1:12331/v1/admin/status
cat status
rm status
- name: Update the version in Cesium.cpp
run: |
export VERSION=$(jq -r ".version" package.json)
export COMMIT=$(git rev-parse --short HEAD)
sed -i 's/Cesium::version = "Development Build"/Cesium::version = "'$VERSION'"/g' native~/src/Runtime/Cesium.cpp
sed -i 's/Cesium::commit = "Unknown"/Cesium::commit = "'$COMMIT'"/g' native~/src/Runtime/Cesium.cpp
# Sanity check that the replacements happened
grep $VERSION native~/src/Runtime/Cesium.cpp
grep $COMMIT native~/src/Runtime/Cesium.cpp
- name: Move cesium-unity Repo Under Empty Project
run: |
mkdir -p ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity
mv $GITHUB_WORKSPACE/* ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity
# Disable Unity audio
mkdir -p ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity/ProjectSettings
echo '%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!11 &1\nAudioManager:\n m_DisableAudio: 1\n' > ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity/ProjectSettings/AudioManager.asset
- name: Build Reinterop
run: |
cd ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity
dotnet publish Reinterop~ -o .
- name: Build Package
env:
CESIUM_NATIVE_BUILD_CONTAINER: almalinux:8
run: |
# We only need a release build of vcpkg dependencies
export CESIUM_VCPKG_RELEASE_ONLY="TRUE"
cd ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity
dotnet run --project Build~ package --platform Editor --platform Linux
ls -l ~/cesium/CesiumForUnityBuildProject
- name: Publish Logs
if: success() || failure() # run this step even if previous step failed
uses: actions/upload-artifact@v4
with:
name: Native Build Logs - Linux
path: ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity/native~/build-*/build.log
- name: Publish package artifact
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: Linux Package
path: ~/cesium/CesiumForUnityBuildProject/*.tgz
- name: Run Tests
env:
CESIUM_ION_TOKEN_FOR_TESTS: ${{ secrets.CESIUM_ION_TOKEN_FOR_TESTS }}
run: |
xvfb-run -a ~/Unity/Hub/Editor/2022.3.41f1/Editor/Unity -runTests -batchmode -projectPath ~/cesium/CesiumForUnityBuildProject -testResults ~/cesium/CesiumForUnityBuildProject/TestResults.xml -testPlatform PlayMode -logFile ~/cesium/CesiumForUnityBuildProject/test-log.txt
cat ~/cesium/CesiumForUnityBuildProject/test-log.txt
- name: Test Report
uses: kring/test-reporter@v1.6.2-kring
if: success() || failure() # run this step even if previous step failed
with:
name: Tests - Linux
path: ~/cesium/CesiumForUnityBuildProject/TestResults.xml
reporter: dotnet-nunit
Emscripten:
needs: [QuickChecks]
runs-on: windows-latest
# Only allow a single Emscripten build at a time, for Unity licensing reasons
concurrency: emscripten
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.103"
- name: Cache vcpkg artifacts
uses: actions/cache@v4
with:
path: "d:/.ezvcpkg"
key: vcpkg-windows-${{ hashFiles('native~/vcpkg/ports/**/vcpkg.json', 'native~/vcpkg/triplets/**/*', 'native~/extern/*toolchain.cmake') }}-${{ hashFiles('native~/extern/cesium-native/CMakeLists.txt', 'native~/CMakeLists.txt') }}
restore-keys: |
vcpkg-windows-${{ hashFiles('native~/vcpkg/ports/**/vcpkg.json', 'native~/vcpkg/triplets/**/*', 'native~/extern/*toolchain.cmake') }}-
- name: Install latest ninja and cmake
uses: lukka/get-cmake@latest
with:
cmakeVersion: "3.31.6"
- name: Install nasm
uses: ilammy/setup-nasm@v1.5.1
- name: Install wget
run: |
choco install -y wget
- name: Install Unity Hub
run: |
wget https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubSetup-x64.exe
Start-Process "./UnityHubSetup-x64.exe" -Args "/S" -Wait
del ./UnityHubSetup-x64.exe
- name: Install Unity
run: |
# We must use Unity 6+ because the Emscripten version in older releases is too old.
Start-Process -FilePath "C:/Program Files/Unity Hub/Unity Hub.exe" -Args "-- --headless install --version 6000.0.62f1 --changeset f99f05b3e950" -Wait
Start-Process -FilePath "C:/Program Files/Unity Hub/Unity Hub.exe" -Args "-- --headless install-modules --version 6000.0.62f1 --changeset f99f05b3e950 --module webgl" -Wait
- name: Create SSH tunnel to Unity License Server
env:
UNITY_LICENSE_SERVER_SSH_KEY: ${{ secrets.UNITY_LICENSE_SERVER_SSH_KEY }}
run: |
$ENV:UNITY_LICENSE_SERVER_SSH_KEY | Set-Content ~/unity-client-ssh-key
# Without StrictHostKeyChecking, OpenSSH will sit forever waiting for local input to confirm the server key is ok.
# We don't really care if the server is authentic, because we're not sending anything sensitive to it.
# The license server VM's sshd_config also needed to be modified with the following options, in order to prevent
# the tunnel from being closed between here and when we're ready to use it.
# TCPKeepAlive yes
# ClientAliveInterval 30
# ClientAliveCountMax 9999
start -FilePath ssh -ArgumentList "-o StrictHostKeyChecking=no -i ~/unity-client-ssh-key -L 127.0.0.1:12331:127.0.0.1:8080 unity-client@ec2-44-204-244-196.compute-1.amazonaws.com"
sleep 5
- name: Test Connection to Unity License Server
run: |
wget.exe http://127.0.0.1:12331/v1/admin/status
cat status
rm status
- name: Configure Unity to Use the License Server
run: |
mkdir -p $ENV:PROGRAMDATA/Unity/config
$filename="$ENV:PROGRAMDATA/Unity/config/services-config.json"
$text='{"licensingServiceBaseUrl":"http://localhost:12331","enableEntitlementLicensing":true,"clientConnectTimeoutSec":120,"clientHandshakeTimeoutSec":60,"toolset":"UnityLicenseServer_16768335856821_1"}'
[IO.File]::WriteAllLines($filename,$text)
- name: Update the version in Cesium.cpp
run: |
$VERSION = (Get-Content -path package.json | ConvertFrom-Json).version
$COMMIT = $(git rev-parse --short HEAD)
((Get-Content -path native~/src/Runtime/Cesium.cpp -Raw) -replace 'Cesium::version = "Development Build"',"Cesium::version = ""$VERSION""") | Set-Content -Path native~/src/Runtime/Cesium.cpp
((Get-Content -path native~/src/Runtime/Cesium.cpp -Raw) -replace 'Cesium::commit = "Unknown"',"Cesium::commit = ""$COMMIT""") | Set-Content -Path native~/src/Runtime/Cesium.cpp
# Sanity check that the replacements happened
if (-Not ((Get-Content -path native~/src/Runtime/Cesium.cpp -Raw) -match "$COMMIT")) { throw "Commit does not exist in file after replacement" }
if (-Not ((Get-Content -path native~/src/Runtime/Cesium.cpp -Raw) -match "$VERSION")) { throw "Version does not exist in file after replacement" }
- name: Move cesium-unity Repo Under Empty Project
run: |
mkdir -p d:\cesium\CesiumForUnityBuildProject\Packages\com.cesium.unity
mv $ENV:GITHUB_WORKSPACE/* d:\cesium\CesiumForUnityBuildProject\Packages\com.cesium.unity
# Disable Unity audio
mkdir -p d:\cesium\CesiumForUnityBuildProject\Packages\com.cesium.unity\ProjectSettings
$text="%YAML 1.1`n%TAG !u! tag:unity3d.com,2011:`n--- !u!11 &1`nAudioManager:`n m_DisableAudio: 1`n"
[IO.File]::WriteAllLines("d:/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity/ProjectSettings/AudioManager.asset",$text)
- name: Build Reinterop
run: |
cd d:\cesium\CesiumForUnityBuildProject\Packages\com.cesium.unity
dotnet publish Reinterop~ -o .
- name: Print disk space 1
if: success() || failure() # run this step even if previous step failed
run: |
get-psdrive
- name: Delete ccache
run: |
# To prevent the ada-url build from trying (and failing) to use it.
rm C:/Strawberry/c/bin/ccache.exe
- name: Build Package
run: |
cd d:\cesium\CesiumForUnityBuildProject\Packages\com.cesium.unity
mkdir -p d:\cesium\temp
# Store temp files on the D drive, which is much faster than the EBS-backed C drive.
$ENV:TEMP="d:\cesium\temp"
# We only need a release build of vcpkg dependencies
$ENV:CESIUM_VCPKG_RELEASE_ONLY="TRUE"
# Clear ANDROID_NDK_ROOT so that we use Unity's version
Remove-Item Env:ANDROID_NDK_ROOT
# Explicitly set the ezvcpkg path. Otherwise it will be `/.ezvcpkg` and the drive letter is ambiguous.
$ENV:EZVCPKG_BASEDIR="D:/.ezvcpkg"
# Run the build
dotnet run --project Build~ package --platform Web
- name: Print disk space 2
if: success() || failure() # run this step even if previous step failed
run: |
get-psdrive
- name: Publish Logs
if: success() || failure() # run this step even if previous step failed
uses: actions/upload-artifact@v4
with:
name: Native Build Logs - Emscripten
path: d:/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity/native~/build-*/build.log
- name: Publish package artifact
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: Emscripten Package
path: d:\cesium\CesiumForUnityBuildProject\*.tgz
Combine:
runs-on: ubuntu-latest
needs: [Windows, MacOS, Linux, Emscripten]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install jq
run: sudo apt install jq
- name: Download macOS build
uses: actions/download-artifact@v4
with:
name: macOS Package
path: combine/macos
- name: Extract macOS build
run: |
cd combine/macos
tar xzf *.tgz
rm *.tgz
- name: Download Emscripten build
uses: actions/download-artifact@v4
with:
name: Emscripten Package
path: combine/emscripten
- name: Extract Emscripten build
run: |
cd combine/emscripten
tar xzf *.tgz
rm *.tgz
- name: Download Linux build
uses: actions/download-artifact@v4
with:
name: Linux Package
path: combine/linux
- name: Extract Linux build
run: |
cd combine/linux
tar xzf *.tgz
rm *.tgz
- name: Download Windows build
uses: actions/download-artifact@v4
with:
name: Windows Package
path: combine/windows
- name: Extract Windows build
run: |
cd combine/windows
tar xzf *.tgz
rm *.tgz
- name: Create combined package
run: |
mkdir -p combine/merged
cd combine/merged
# Copy the everything. For files that exist in multiple packages, the Windows one will win.
cp -r ../macos/* .
cp -r ../emscripten/* .
cp -r ../linux/* .
cp -r ../windows/* .
# Remove the generated C# files
for file in $(find package/Source/generated -name '*.cs');
do
rm $file
done;
# Merge the generated files by concatentation
cd ../macos
for file in $(find package/Source/generated -name '*.cs');
do
mkdir -p $(dirname "../merged/$file")
cp "$file" "../merged/$file"
done;
cd ../emscripten
for file in $(find package/Source/generated -name '*.cs');
do
echo Merging $file
mkdir -p $(dirname "../merged/$file")
cat "$file" >> "../merged/$file"
done;
cd ../linux
for file in $(find package/Source/generated -name '*.cs');
do
echo Merging $file
mkdir -p $(dirname "../merged/$file")
cat "$file" >> "../merged/$file"
done;
cd ../windows
for file in $(find package/Source/generated -name '*.cs');
do
echo Merging $file
mkdir -p $(dirname "../merged/$file")
cat "$file" >> "../merged/$file"
done;
# Create the package
cd ../merged
export NAME=$(jq -r ".name" $GITHUB_WORKSPACE/package.json)
export VERSION=$(jq -r ".version" $GITHUB_WORKSPACE/package.json)
tar czf $NAME-$VERSION.tgz package
- name: Print SHA256 of combined package
run: |
cd combine/merged
sha256sum *.tgz
- name: Publish combined package
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: Combined Package
path: combine/merged/*.tgz