Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save danieldownes/7e802d7b2403ea627b0fe8438cda354d to your computer and use it in GitHub Desktop.
Save danieldownes/7e802d7b2403ea627b0fe8438cda354d to your computer and use it in GitHub Desktop.
Github Actions CI Unity HoloLens 2 Build (Windows, UWP)
# GitHub Actions CI for Unity Hololens 2 UWP running on windows.
name: CI
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
name: Build Unity (UWP ARM64)
runs-on: windows-latest
env:
UNITY_VERSION: 2019.4.15f1
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Cache Unity Setup Installers
uses: actions/[email protected]
with:
path: UnitySetupInstallerCache
key: UnitySetupInstallerCache-${{ env.UNITY_VERSION }}
- name: Install Unity
run: |
Install-Module UnitySetup -Force
Import-Module UnitySetup
Install-UnitySetupInstance -Cache UnitySetupInstallerCache -Installers (Find-UnitySetupInstaller -Version "$env:UNITY_VERSION" -Components 'Windows','Windows_IL2CPP','UWP_IL2CPP') -Verbose
shell: pwsh
- name: Turnstyle
uses: softprops/turnstyle@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
poll-interval-seconds: 10
- name: Cache Unity
uses: actions/[email protected]
with:
path: Library
key: UnityCache-${{ env.UNITY_VERSION }}
- name: Activate Unity License
run: Start-UnityEditor -Credential (New-Object System.Management.Automation.PSCredential ("$env:UNITY_EMAIL", (ConvertTo-SecureString "$env:UNITY_PASSWORD" -AsPlainText -Force))) -Serial (ConvertTo-SecureString "$env:UNITY_SERIAL" -AsPlainText -Force) -LogFile .\Logs\Activation.log -AdditionalArguments "-verbose -nographics" -Wait -Verbose -ErrorAction SilentlyContinue
shell: pwsh
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
#continue-on-error: true # Can output errors even if activation is successful. Using -LogFile reports them as error. As an alternative, log silently as AdditionalArgument "-logFile .\Logs\Activation.log" instead.
- name: Build Unity Project
run: Start-UnityEditor -Project .\ -ExecuteMethod Microsoft.MixedReality.Toolkit.Build.Editor.UnityPlayerBuildTools.StartCommandLineBuild -BuildTarget WSAPlayer -BatchMode -Quit -LogFile .\Logs\Build.log -Wait -AdditionalArguments "-verbose -nographics -logDirectory Logs -arm64" -Verbose
# Build with appx takes very long, do not use -Quit until https://github.com/microsoft/MixedRealityToolkit-Unity/issues/8901 is resolved
#run: Start-UnityEditor -Project .\ -ExecuteMethod Microsoft.MixedReality.Toolkit.Build.Editor.UnityPlayerBuildTools.StartCommandLineBuild -BuildTarget WSAPlayer -BatchMode -LogFile .\Logs\Build.log -Wait -AdditionalArguments "-verbose -nographics -logDirectory Logs -buildAppx -arm64" -Verbose
shell: pwsh
- name: Return Unity License
run: Start-UnityEditor -Credential (New-Object System.Management.Automation.PSCredential ("$env:UNITY_EMAIL", (ConvertTo-SecureString "$env:UNITY_PASSWORD" -AsPlainText -Force))) -ReturnLicense -LogFile .\Logs\Deactivation.log -Wait -Verbose
shell: pwsh
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
if: always()
- name: Upload Unity Logs
uses: actions/upload-artifact@v2
with:
name: Unity Logs
path: Logs/*.log
if: always()
#- name: Upload Appx Module
# uses: actions/upload-artifact@v2
# with:
# name: Master_ARM64.appx
# path: Builds\WSAPlayer\AppPackages\**\**\*.appx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment