Update CHANGES.md. #1265
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cesium for Unity | |
on: [push] | |
jobs: | |
QuickChecks: | |
name: "Quick Checks" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Install clang-format | |
run: pip install clang-format | |
- name: Check source formatting | |
run: | | |
find native~/Runtime native~/Editor native~/Shared \( -iname '*.cpp' -o -iname '*.h' \) -print0 | xargs -0 clang-format --dry-run -Werror | |
Documentation: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Doxygen | |
run: | | |
sudo apt install -y doxygen | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Generate Documentation | |
run: | | |
doxygen ./Documentation~/Doxyfile | |
- 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: 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 Ninja | |
run: | | |
choco install -y ninja | |
- name: Install nasm | |
uses: ilammy/[email protected] | |
- name: Install wget | |
run: | | |
choco install -y wget | |
- name: Install Unity Hub | |
run: | | |
wget https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubSetup.exe | |
Start-Process "./UnityHubSetup.exe" -Args "/S" -Wait | |
del ./UnityHubSetup.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 [email protected]" | |
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}' | |
[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~/Shared/src/Cesium.cpp -Raw) -replace 'Cesium::version = "Development Build"',"Cesium::version = ""$VERSION""") | Set-Content -Path native~/Shared/src/Cesium.cpp | |
((Get-Content -path native~/Shared/src/Cesium.cpp -Raw) -replace 'Cesium::commit = "Unknown"',"Cesium::commit = ""$COMMIT""") | Set-Content -Path native~/Shared/src/Cesium.cpp | |
# Sanity check that the replacements happened | |
if (-Not ((Get-Content -path native~/Shared/src/Cesium.cpp -Raw) -match "$COMMIT")) { throw "Commit does not exist in file after replacement" } | |
if (-Not ((Get-Content -path native~/Shared/src/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: 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~ | |
- 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 | |
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/[email protected] | |
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-latest | |
# 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: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- 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/[email protected] | |
- name: Install Unity Hub | |
run: | | |
wget --quiet https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubSetup.dmg | |
mkdir UnityHubSetup | |
hdiutil attach UnityHubSetup.dmg -mountpoint ./UnityHubSetup | |
sudo cp -R "./UnityHubSetup/Unity Hub.app" /Applications | |
hdiutil detach ./UnityHubSetup | |
rm ./UnityHubSetup.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}' > "/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 [email protected] | |
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~/Shared/src/Cesium.cpp | |
sed -i '' 's/Cesium::commit = "Unknown"/Cesium::commit = "'$COMMIT'"/g' native~/Shared/src/Cesium.cpp | |
# Sanity check that the replacements happened | |
grep $VERSION native~/Shared/src/Cesium.cpp | |
grep $COMMIT native~/Shared/src/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 | |
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~ | |
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 | |
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/[email protected] | |
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 | |
Combine: | |
runs-on: ubuntu-latest | |
needs: [Windows, MacOS] | |
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 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 ../windows/* . | |
# Remove the generated C# files | |
for file in $(find package/Runtime/generated -name '*.cs'); | |
do | |
rm $file | |
done; | |
for file in $(find package/Editor/generated -name '*.cs'); | |
do | |
rm $file | |
done; | |
# Merge the generated files by concatentation | |
cd ../macos | |
for file in $(find package/Runtime/generated -name '*.cs'); | |
do | |
mkdir -p $(dirname "../merged/$file") | |
cp "$file" "../merged/$file" | |
done; | |
for file in $(find package/Editor/generated -name '*.cs'); | |
do | |
mkdir -p $(dirname "../merged/$file") | |
cp "$file" "../merged/$file" | |
done; | |
cd ../windows | |
for file in $(find package/Runtime/generated -name '*.cs'); | |
do | |
echo Merging $file | |
mkdir -p $(dirname "../merged/$file") | |
cat "$file" >> "../merged/$file" | |
done; | |
for file in $(find package/Editor/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: Publish combined package | |
if: ${{ success() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Combined Package | |
path: combine/merged/*.tgz |