|
| 1 | +name: Audience SDK — Manual Linux Self-hosted Validation |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 8 | + cancel-in-progress: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + playmode: |
| 12 | + name: ${{ matrix.backend }} / Unity ${{ matrix.unity }} (self-hosted Linux) |
| 13 | + runs-on: [self-hosted, X64, Linux] |
| 14 | + timeout-minutes: 60 |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - backend: IL2CPP |
| 20 | + unity: 2021.3.45f2 |
| 21 | + - backend: Mono2x |
| 22 | + unity: 2021.3.45f2 |
| 23 | + |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + lfs: true |
| 28 | + |
| 29 | + - uses: actions/cache@v4 |
| 30 | + with: |
| 31 | + path: examples/audience/Library |
| 32 | + key: Library-selfhosted-${{ matrix.backend }}-StandaloneLinux64-${{ matrix.unity }}-${{ hashFiles('examples/audience/Assets/**', 'examples/audience/Packages/**', 'examples/audience/ProjectSettings/**', 'src/Packages/Audience/**') }} |
| 33 | + restore-keys: | |
| 34 | + Library-selfhosted-${{ matrix.backend }}-StandaloneLinux64-${{ matrix.unity }}- |
| 35 | + Library-selfhosted-${{ matrix.backend }}-StandaloneLinux64- |
| 36 | +
|
| 37 | + - name: Resolve Unity |
| 38 | + shell: bash |
| 39 | + run: | |
| 40 | + set -uo pipefail |
| 41 | + UNITY="$HOME/Unity/Hub/Editor/${{ matrix.unity }}/Editor/Unity" |
| 42 | + if [ ! -x "$UNITY" ]; then |
| 43 | + echo "::error::Unity ${{ matrix.unity }} not found at $UNITY. Install via Unity Hub on the runner host." |
| 44 | + exit 1 |
| 45 | + fi |
| 46 | + echo "UNITY_PATH=$UNITY" >> "$GITHUB_ENV" |
| 47 | +
|
| 48 | + - name: Activate Unity license |
| 49 | + shell: bash |
| 50 | + env: |
| 51 | + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} |
| 52 | + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} |
| 53 | + UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} |
| 54 | + run: | |
| 55 | + set -uo pipefail |
| 56 | + LOG="$(mktemp)" |
| 57 | + "$UNITY_PATH" -batchmode -nographics -quit \ |
| 58 | + -username "$UNITY_EMAIL" \ |
| 59 | + -password "$UNITY_PASSWORD" \ |
| 60 | + -serial "$UNITY_SERIAL" \ |
| 61 | + -logFile - 2>&1 | tee "$LOG" || true |
| 62 | +
|
| 63 | + if grep -qE "(License activation has failed|\[Licensing::Client\] Error: Code [0-9]+)" "$LOG"; then |
| 64 | + echo "::error::Unity activation failed." |
| 65 | + exit 1 |
| 66 | + fi |
| 67 | + if ! grep -qE "Successfully activated the entitlement license" "$LOG"; then |
| 68 | + echo "::error::Unity activation: no success marker found." |
| 69 | + exit 1 |
| 70 | + fi |
| 71 | +
|
| 72 | + - name: Run PlayMode tests |
| 73 | + shell: bash |
| 74 | + env: |
| 75 | + AUDIENCE_TEST_PUBLISHABLE_KEY: ${{ secrets.AUDIENCE_TEST_PUBLISHABLE_KEY }} |
| 76 | + AUDIENCE_SCRIPTING_BACKEND: ${{ matrix.backend }} |
| 77 | + run: | |
| 78 | + set -euo pipefail |
| 79 | + mkdir -p artifacts |
| 80 | + "$UNITY_PATH" \ |
| 81 | + -batchmode -nographics \ |
| 82 | + -projectPath examples/audience \ |
| 83 | + -runTests \ |
| 84 | + -testPlatform StandaloneLinux64 \ |
| 85 | + -testResults "$(pwd)/artifacts/test-results.xml" \ |
| 86 | + -logFile - 2>&1 | tee "$(pwd)/artifacts/unity.log" |
| 87 | +
|
| 88 | + - name: Return Unity license |
| 89 | + if: always() |
| 90 | + shell: bash |
| 91 | + run: | |
| 92 | + set -uo pipefail |
| 93 | + # Releases the seat after every run so manual reruns do not exhaust |
| 94 | + # the serial's activation pool. |
| 95 | + if [ -n "${UNITY_PATH:-}" ] && [ -x "$UNITY_PATH" ]; then |
| 96 | + "$UNITY_PATH" -returnlicense -batchmode -nographics -quit -logFile - 2>&1 || true |
| 97 | + fi |
| 98 | +
|
| 99 | + - name: Publish test report |
| 100 | + uses: dorny/test-reporter@v3 |
| 101 | + if: always() |
| 102 | + with: |
| 103 | + name: Self-hosted Linux PlayMode (${{ matrix.backend }}) |
| 104 | + path: artifacts/test-results.xml |
| 105 | + reporter: dotnet-nunit |
| 106 | + fail-on-error: true |
| 107 | + |
| 108 | + - uses: actions/upload-artifact@v4 |
| 109 | + if: always() |
| 110 | + with: |
| 111 | + name: selfhosted-linux-${{ matrix.backend }} |
| 112 | + path: | |
| 113 | + artifacts/test-results.xml |
| 114 | + artifacts/unity.log |
0 commit comments