|
| 1 | +name: Audience SDK — PlayMode (IL2CPP + Mono) |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - 'src/Packages/Audience/**' |
| 7 | + - 'examples/audience/**' |
| 8 | + - '.github/workflows/test-audience-il2cpp.yml' |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + playmode: |
| 17 | + if: github.event.pull_request.head.repo.fork == false || github.event_name == 'workflow_dispatch' |
| 18 | + name: ${{ matrix.target }} / ${{ matrix.backend }} / Unity ${{ matrix.unity }} |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + include: |
| 23 | + - target: StandaloneWindows64 |
| 24 | + backend: IL2CPP |
| 25 | + unity: 2021.3.45f2 |
| 26 | + runner: [self-hosted, Windows, X64] |
| 27 | + - target: StandaloneWindows64 |
| 28 | + backend: Mono2x |
| 29 | + unity: 2021.3.45f2 |
| 30 | + runner: [self-hosted, Windows, X64] |
| 31 | + - target: StandaloneOSX |
| 32 | + backend: IL2CPP |
| 33 | + unity: 2021.3.45f2 |
| 34 | + runner: [self-hosted, macOS, ARM64] |
| 35 | + - target: StandaloneOSX |
| 36 | + backend: Mono2x |
| 37 | + unity: 2021.3.45f2 |
| 38 | + runner: [self-hosted, macOS, ARM64] |
| 39 | + runs-on: ${{ matrix.runner }} |
| 40 | + timeout-minutes: 60 |
| 41 | + |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + lfs: true |
| 46 | + - run: git lfs pull |
| 47 | + |
| 48 | + - name: Ensure Unity ${{ matrix.unity }} + IL2CPP installed (macOS) |
| 49 | + if: runner.os == 'macOS' |
| 50 | + shell: bash |
| 51 | + run: | |
| 52 | + set -euo pipefail |
| 53 | + HUB="/Applications/Unity Hub.app/Contents/MacOS/Unity Hub" |
| 54 | + # Hub install/install-modules exit non-zero when already installed — |
| 55 | + # log the outcome so a real failure isn't swallowed silently. |
| 56 | + "$HUB" -- --headless install --version ${{ matrix.unity }} --architecture arm64 --module mac-il2cpp --childModules \ |
| 57 | + || echo "(install returned non-zero — expected when Editor + module already present)" |
| 58 | + "$HUB" -- --headless install-modules --version ${{ matrix.unity }} --module mac-il2cpp \ |
| 59 | + || echo "(install-modules returned non-zero — expected when module already present)" |
| 60 | +
|
| 61 | + - name: Ensure Unity ${{ matrix.unity }} + IL2CPP installed (Windows) |
| 62 | + if: runner.os == 'Windows' |
| 63 | + shell: pwsh |
| 64 | + run: | |
| 65 | + $hub = "C:\Program Files\Unity Hub\Unity Hub.exe" |
| 66 | + & $hub -- --headless install --version ${{ matrix.unity }} --module windows-il2cpp --childModules |
| 67 | + if ($LASTEXITCODE -ne 0) { Write-Host "(install returned $LASTEXITCODE — expected when Editor + module already present)" } |
| 68 | + $global:LASTEXITCODE = 0 |
| 69 | + & $hub -- --headless install-modules --version ${{ matrix.unity }} --module windows-il2cpp |
| 70 | + if ($LASTEXITCODE -ne 0) { Write-Host "(install-modules returned $LASTEXITCODE — expected when module already present)" } |
| 71 | + $global:LASTEXITCODE = 0 |
| 72 | +
|
| 73 | + - name: Run PlayMode tests (macOS) |
| 74 | + if: runner.os == 'macOS' |
| 75 | + shell: bash |
| 76 | + env: |
| 77 | + AUDIENCE_TEST_PUBLISHABLE_KEY: ${{ secrets.AUDIENCE_TEST_PUBLISHABLE_KEY }} |
| 78 | + AUDIENCE_SCRIPTING_BACKEND: ${{ matrix.backend }} |
| 79 | + run: | |
| 80 | + set -euo pipefail |
| 81 | + UNITY="/Applications/Unity/Hub/Editor/${{ matrix.unity }}/Unity.app/Contents/MacOS/Unity" |
| 82 | + [ -x "$UNITY" ] || UNITY="/Applications/Unity/Hub/Editor/${{ matrix.unity }}-arm64/Unity.app/Contents/MacOS/Unity" |
| 83 | + if [ ! -x "$UNITY" ]; then |
| 84 | + echo "Unity binary not found"; exit 1 |
| 85 | + fi |
| 86 | + mkdir -p artifacts |
| 87 | + "$UNITY" \ |
| 88 | + -batchmode -nographics \ |
| 89 | + -projectPath examples/audience \ |
| 90 | + -runTests \ |
| 91 | + -testPlatform ${{ matrix.target }} \ |
| 92 | + -testResults "$(pwd)/artifacts/test-results.xml" \ |
| 93 | + -logFile - |
| 94 | +
|
| 95 | + - name: Run PlayMode tests (Windows) |
| 96 | + if: runner.os == 'Windows' |
| 97 | + shell: pwsh |
| 98 | + env: |
| 99 | + AUDIENCE_TEST_PUBLISHABLE_KEY: ${{ secrets.AUDIENCE_TEST_PUBLISHABLE_KEY }} |
| 100 | + AUDIENCE_SCRIPTING_BACKEND: ${{ matrix.backend }} |
| 101 | + run: | |
| 102 | + $unity = "C:\Program Files\Unity\Hub\Editor\${{ matrix.unity }}\Editor\Unity.exe" |
| 103 | + if (-not (Test-Path $unity)) { Write-Error "Unity binary not found at $unity"; exit 1 } |
| 104 | + New-Item -ItemType Directory -Force -Path artifacts | Out-Null |
| 105 | + & $unity ` |
| 106 | + -batchmode -nographics ` |
| 107 | + -projectPath examples/audience ` |
| 108 | + -runTests ` |
| 109 | + -testPlatform ${{ matrix.target }} ` |
| 110 | + -testResults "$pwd\artifacts\test-results.xml" ` |
| 111 | + -logFile - |
| 112 | + if ($LASTEXITCODE -ne 0 -and $LASTEXITCODE -ne 2) { exit $LASTEXITCODE } |
| 113 | +
|
| 114 | + - uses: actions/upload-artifact@v4 |
| 115 | + if: always() |
| 116 | + with: |
| 117 | + name: playmode-${{ matrix.backend }}-${{ matrix.target }}-${{ matrix.unity }} |
| 118 | + path: | |
| 119 | + artifacts/test-results.xml |
| 120 | + examples/audience/Logs/** |
0 commit comments