Skip to content

Commit 2658686

Browse files
ci(audience): add manual self-hosted Linux PlayMode job (SDK-255)
- Adds a playmode-linux-selfhosted job to test-audience-sample-app.yml, gated `if: github.event_name == 'workflow_dispatch'` so the self-hosted Linux runner is not consumed on every PR. - Targets the [self-hosted, X64, Linux] runner with the same matrix shape as the GameCI Linux job (IL2CPP and Mono2x for Unity 2021.3.45f2). - Activates Unity at job start and returns the license at job end so manual reruns do not leak seats against the serial's activation pool. - Used to cross-check that the SDK behaves the same on a real self-hosted Linux machine as it does inside the GameCI Docker image. - Lives in the existing workflow file (not a new file) because GitHub's workflow_dispatch API only accepts workflow files that exist on the default branch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fe7c1ac commit 2658686

1 file changed

Lines changed: 108 additions & 0 deletions

File tree

.github/workflows/test-audience-sample-app.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,3 +562,111 @@ jobs:
562562
path: |
563563
examples/audience/Builds/Android/*.apk
564564
examples/audience/Logs/**
565+
566+
# workflow_dispatch only. Cross-checks the GameCI Docker outcome against
567+
# the self-hosted Linux machine when there's reason to suspect divergence.
568+
playmode-linux-selfhosted:
569+
if: github.event_name == 'workflow_dispatch'
570+
name: ${{ matrix.backend }} / Unity ${{ matrix.unity }} (self-hosted Linux)
571+
runs-on: [self-hosted, X64, Linux]
572+
timeout-minutes: 60
573+
strategy:
574+
fail-fast: false
575+
matrix:
576+
include:
577+
- backend: IL2CPP
578+
unity: 2021.3.45f2
579+
- backend: Mono2x
580+
unity: 2021.3.45f2
581+
582+
steps:
583+
- uses: actions/checkout@v4
584+
with:
585+
lfs: true
586+
587+
- uses: actions/cache@v4
588+
with:
589+
path: examples/audience/Library
590+
key: Library-selfhosted-${{ matrix.backend }}-StandaloneLinux64-${{ matrix.unity }}-${{ hashFiles('examples/audience/Assets/**', 'examples/audience/Packages/**', 'examples/audience/ProjectSettings/**', 'src/Packages/Audience/**') }}
591+
restore-keys: |
592+
Library-selfhosted-${{ matrix.backend }}-StandaloneLinux64-${{ matrix.unity }}-
593+
Library-selfhosted-${{ matrix.backend }}-StandaloneLinux64-
594+
595+
- name: Resolve Unity
596+
shell: bash
597+
run: |
598+
set -uo pipefail
599+
UNITY="$HOME/Unity/Hub/Editor/${{ matrix.unity }}/Editor/Unity"
600+
if [ ! -x "$UNITY" ]; then
601+
echo "::error::Unity ${{ matrix.unity }} not found at $UNITY. Install via Unity Hub on the runner host."
602+
exit 1
603+
fi
604+
echo "UNITY_PATH=$UNITY" >> "$GITHUB_ENV"
605+
606+
- name: Activate Unity license
607+
shell: bash
608+
env:
609+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
610+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
611+
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
612+
run: |
613+
set -uo pipefail
614+
LOG="$(mktemp)"
615+
"$UNITY_PATH" -batchmode -nographics -quit \
616+
-username "$UNITY_EMAIL" \
617+
-password "$UNITY_PASSWORD" \
618+
-serial "$UNITY_SERIAL" \
619+
-logFile - 2>&1 | tee "$LOG" || true
620+
621+
if grep -qE "(License activation has failed|\[Licensing::Client\] Error: Code [0-9]+)" "$LOG"; then
622+
echo "::error::Unity activation failed."
623+
exit 1
624+
fi
625+
if ! grep -qE "Successfully activated the entitlement license" "$LOG"; then
626+
echo "::error::Unity activation: no success marker found."
627+
exit 1
628+
fi
629+
630+
- name: Run PlayMode tests
631+
shell: bash
632+
env:
633+
AUDIENCE_TEST_PUBLISHABLE_KEY: ${{ secrets.AUDIENCE_TEST_PUBLISHABLE_KEY }}
634+
AUDIENCE_SCRIPTING_BACKEND: ${{ matrix.backend }}
635+
run: |
636+
set -euo pipefail
637+
mkdir -p artifacts
638+
"$UNITY_PATH" \
639+
-batchmode -nographics \
640+
-projectPath examples/audience \
641+
-runTests \
642+
-testPlatform StandaloneLinux64 \
643+
-testResults "$(pwd)/artifacts/test-results.xml" \
644+
-logFile - 2>&1 | tee "$(pwd)/artifacts/unity.log"
645+
646+
- name: Return Unity license
647+
if: always()
648+
shell: bash
649+
run: |
650+
set -uo pipefail
651+
# Releases the seat after every run so manual reruns do not exhaust
652+
# the serial's activation pool.
653+
if [ -n "${UNITY_PATH:-}" ] && [ -x "$UNITY_PATH" ]; then
654+
"$UNITY_PATH" -returnlicense -batchmode -nographics -quit -logFile - 2>&1 || true
655+
fi
656+
657+
- name: Publish test report
658+
uses: dorny/test-reporter@v3
659+
if: always()
660+
with:
661+
name: Self-hosted Linux PlayMode (${{ matrix.backend }})
662+
path: artifacts/test-results.xml
663+
reporter: dotnet-nunit
664+
fail-on-error: true
665+
666+
- uses: actions/upload-artifact@v4
667+
if: always()
668+
with:
669+
name: selfhosted-linux-${{ matrix.backend }}
670+
path: |
671+
artifacts/test-results.xml
672+
artifacts/unity.log

0 commit comments

Comments
 (0)