Add loading message for quick add list. #892
Workflow file for this run
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@v3 | |
- 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 | |
Windows: | |
needs: [QuickChecks] | |
runs-on: ["self-hosted","windows","x64","unity-2021-3"] | |
# Only allow a single Windows build at a time, for Unity licensing reasons | |
concurrency: windows | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install nasm | |
uses: ilammy/[email protected] | |
- 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 | |
- 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" | |
dotnet run --project Build~ | |
cat D:\cesium\CesiumForUnityBuildProject\Packages\com.cesium.unity\native~\build-WSA-x86_64\build.log | |
dir d:\cesium\CesiumForUnityBuildProject | |
- name: Publish package artifact | |
if: ${{ success() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Windows Package | |
path: d:\cesium\CesiumForUnityBuildProject\*.tgz | |
- name: Run Tests | |
run: | | |
start -FilePath "C:\Program Files\Unity\Hub\Editor\2021.3.13f1\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-11 | |
# Only allow a single macOS build at a time, for Unity licensing reasons | |
concurrency: mac | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install nasm | |
uses: ilammy/[email protected] | |
- name: Install jq | |
run: brew install jq | |
- 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 2021.3.13f1 | |
# 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 2021.3.13f1 --changeset 9e7d58001ecf | |
- name: Install Unity iOS Support | |
run: | | |
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install-modules --version 2021.3.13f1 --changeset 9e7d58001ecf --module ios | |
- 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 | |
- name: Build Reinterop | |
run: | | |
cd ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity | |
dotnet publish Reinterop~ -o . | |
- name: Build Package | |
run: | | |
cd ~/cesium/CesiumForUnityBuildProject/Packages/com.cesium.unity | |
dotnet run --project Build~ | |
ls -l ~/cesium/CesiumForUnityBuildProject | |
- name: Publish package artifact | |
if: ${{ success() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: macOS Package | |
path: ~/cesium/CesiumForUnityBuildProject/*.tgz | |
- name: Run Tests | |
run: | | |
/Applications/Unity/Hub/Editor/2021.3.13f1/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@v3 | |
- name: Install jq | |
run: sudo apt install jq | |
- name: Download macOS build | |
uses: actions/download-artifact@v3 | |
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@v3 | |
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@v3 | |
with: | |
name: Combined Package | |
path: combine/merged/*.tgz |