Skip to content

Instantly share code, notes, and snippets.

@cookieofcode
Last active April 21, 2024 14:28
Show Gist options
  • Select an option

  • Save cookieofcode/c195d642a1256d211c11aadc59a42cb8 to your computer and use it in GitHub Desktop.

Select an option

Save cookieofcode/c195d642a1256d211c11aadc59a42cb8 to your computer and use it in GitHub Desktop.

Revisions

  1. cookieofcode renamed this gist Nov 25, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. cookieofcode created this gist Nov 25, 2020.
    86 changes: 86 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,86 @@
    # 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/cache@v2.1.3
    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/cache@v2.1.3
    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