Skip to content

Commit 586fe4c

Browse files
ci(audience): restore PlayMode cells, trim mobile on PR, harden Windows pre-checkout (SDK-330)
- Replaces the cross-product matrix (unity x target x backend with axis-matching include items) on `playmode` with a `set-matrix` helper job that emits a fully-specified JSON matrix. - The cross-product approach silently expanded to zero playmode cells on every run since SDK-327, so Windows and macOS PlayMode tests have not actually run on PRs (verified on the SDK-327 merge commit and on PR #748). Root cause: a unity-keyed include item that has no cell to augment after the conditional `exclude` removes Unity 2022 on PR runs spawns an orphan combination missing `target`, `backend`, and `runner`; `runs-on: ${{ matrix.runner }}` then evaluates to empty and GitHub aborts the matrix. - `set-matrix` runs on ubuntu-latest, defines the full 12-cell playmode matrix and 6-cell mobile matrix inline as JSON, and uses jq to strip Unity 2022.3.62f2 cells when the trigger is pull_request. Schedule and workflow_dispatch get the full sets. - `playmode` declares `needs: set-matrix` and consumes via `matrix.include: fromJSON(needs.set-matrix.outputs.playmode)`. Each cell carries every key the steps need (target, backend, unity, changeset, runner), so no augmentation step can silently drop keys. - `mobile-build` declares `needs: set-matrix` and consumes `needs.set-matrix.outputs.mobile`. PR runs drop Unity 2022.3.62f2 to match the playmode and playmode-linux trim. Schedule and workflow_dispatch keep the full 3 Unity versions. - Hardens the Windows pre-checkout cleanup. The previous Kill-stale step only covered Unity-family processes and slept 2 seconds, then handed off to actions/checkout@v4 which would die with EBUSY on stuck files in examples/audience. New step adds bee_backend and mono to the kill list, sleeps 3 seconds, and force-removes the workspace contents in a retry loop so checkout's own cleanup is left with nothing to do. - mobile-build job steps unchanged. mobile-build trigger fix (the `null == false` coercion) lives in SDK-329 / PR #748 and rebases on this hot-fix. - playmode-linux untouched: its existing cross-product + conditional exclude pattern works because it has no axis-matching include items and `runs-on` is hardcoded. Linear: https://linear.app/imtbl/issue/SDK-330 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4e7127a commit 586fe4c

1 file changed

Lines changed: 73 additions & 33 deletions

File tree

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

Lines changed: 73 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,52 @@ concurrency:
2626
cancel-in-progress: true
2727

2828
jobs:
29-
# Reduced matrix on pull_request, full matrix on schedule and
30-
# workflow_dispatch. The self-hosted Windows runner pool is small, so
31-
# trimming PR cells keeps PR feedback fast. `matrix.exclude` below is
32-
# the source of truth for which cells are dropped on pull_request.
29+
# The PlayMode and mobile-build matrices are built here and consumed
30+
# by the dependent jobs via fromJSON. PR runs trim Unity 2022.3.62f2
31+
# cells; schedule and workflow_dispatch run the full set.
32+
set-matrix:
33+
runs-on: ubuntu-latest
34+
outputs:
35+
playmode: ${{ steps.set.outputs.playmode }}
36+
mobile: ${{ steps.set.outputs.mobile }}
37+
steps:
38+
- id: set
39+
shell: bash
40+
run: |
41+
playmode_full='[
42+
{"target":"StandaloneWindows64","backend":"IL2CPP","unity":"2021.3.45f2","changeset":"88f88f591b2e","runner":["self-hosted","Windows","X64"]},
43+
{"target":"StandaloneWindows64","backend":"Mono2x","unity":"2021.3.45f2","changeset":"88f88f591b2e","runner":["self-hosted","Windows","X64"]},
44+
{"target":"StandaloneOSX","backend":"IL2CPP","unity":"2021.3.45f2","changeset":"88f88f591b2e","runner":["self-hosted","macOS","ARM64"]},
45+
{"target":"StandaloneOSX","backend":"Mono2x","unity":"2021.3.45f2","changeset":"88f88f591b2e","runner":["self-hosted","macOS","ARM64"]},
46+
{"target":"StandaloneWindows64","backend":"IL2CPP","unity":"6000.4.0f1","changeset":"8cf496087c8f","runner":["self-hosted","Windows","X64"]},
47+
{"target":"StandaloneWindows64","backend":"Mono2x","unity":"6000.4.0f1","changeset":"8cf496087c8f","runner":["self-hosted","Windows","X64"]},
48+
{"target":"StandaloneOSX","backend":"IL2CPP","unity":"6000.4.0f1","changeset":"8cf496087c8f","runner":["self-hosted","macOS","ARM64"]},
49+
{"target":"StandaloneOSX","backend":"Mono2x","unity":"6000.4.0f1","changeset":"8cf496087c8f","runner":["self-hosted","macOS","ARM64"]},
50+
{"target":"StandaloneWindows64","backend":"IL2CPP","unity":"2022.3.62f2","changeset":"7670c08855a9","runner":["self-hosted","Windows","X64"]},
51+
{"target":"StandaloneWindows64","backend":"Mono2x","unity":"2022.3.62f2","changeset":"7670c08855a9","runner":["self-hosted","Windows","X64"]},
52+
{"target":"StandaloneOSX","backend":"IL2CPP","unity":"2022.3.62f2","changeset":"7670c08855a9","runner":["self-hosted","macOS","ARM64"]},
53+
{"target":"StandaloneOSX","backend":"Mono2x","unity":"2022.3.62f2","changeset":"7670c08855a9","runner":["self-hosted","macOS","ARM64"]}
54+
]'
55+
mobile_full='[
56+
{"target":"Android","unity":"2021.3.45f2","method":"AndroidBuilder.Build"},
57+
{"target":"Android","unity":"2022.3.62f2","method":"AndroidBuilder.Build"},
58+
{"target":"Android","unity":"6000.4.5f1","method":"AndroidBuilder.Build"},
59+
{"target":"iOS","unity":"2021.3.45f2","method":"IosBuilder.Build"},
60+
{"target":"iOS","unity":"2022.3.62f2","method":"IosBuilder.Build"},
61+
{"target":"iOS","unity":"6000.4.5f1","method":"IosBuilder.Build"}
62+
]'
63+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
64+
playmode=$(jq -c '[.[] | select(.unity != "2022.3.62f2")]' <<<"$playmode_full")
65+
mobile=$(jq -c '[.[] | select(.unity != "2022.3.62f2")]' <<<"$mobile_full")
66+
else
67+
playmode=$(jq -c '.' <<<"$playmode_full")
68+
mobile=$(jq -c '.' <<<"$mobile_full")
69+
fi
70+
echo "playmode=$playmode" >> "$GITHUB_OUTPUT"
71+
echo "mobile=$mobile" >> "$GITHUB_OUTPUT"
72+
3373
playmode:
74+
needs: set-matrix
3475
if: |
3576
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false)
3677
|| github.event_name == 'schedule'
@@ -39,21 +80,7 @@ jobs:
3980
strategy:
4081
fail-fast: false
4182
matrix:
42-
unity: ['2021.3.45f2', '6000.4.0f1', '2022.3.62f2']
43-
target: [StandaloneWindows64, StandaloneOSX]
44-
backend: [IL2CPP, Mono2x]
45-
include:
46-
- unity: '2021.3.45f2'
47-
changeset: 88f88f591b2e
48-
- unity: '6000.4.0f1'
49-
changeset: 8cf496087c8f
50-
- unity: '2022.3.62f2'
51-
changeset: 7670c08855a9
52-
- target: StandaloneWindows64
53-
runner: [self-hosted, Windows, X64]
54-
- target: StandaloneOSX
55-
runner: [self-hosted, macOS, ARM64]
56-
exclude: ${{ fromJSON(github.event_name == 'pull_request' && '[{"unity":"2022.3.62f2"}]' || '[]') }}
83+
include: ${{ fromJSON(needs.set-matrix.outputs.playmode) }}
5784
runs-on: ${{ matrix.runner }}
5885
# Healthy cells finish in ~10 min. 30 min covers cold caches +
5986
# IL2CPP + Unity 6 startup; anything past that is a hang. Capping
@@ -62,25 +89,43 @@ jobs:
6289
timeout-minutes: 30
6390

6491
steps:
65-
- name: Kill stale Unity processes (Windows pre-checkout)
92+
- name: Clean Windows workspace (pre-checkout)
6693
if: runner.os == 'Windows'
6794
shell: pwsh
6895
continue-on-error: true
6996
run: |
70-
# actions/checkout@v4 deletes the prior workspace before cloning. If a
71-
# previous run's Unity Editor / IL2CPP build process is still holding
72-
# handles inside examples/audience, checkout dies with EBUSY. Kill any
73-
# leftover Unity-family process here so checkout's cleanup succeeds.
97+
# actions/checkout@v4 removes the prior workspace before cloning. If
98+
# a previous run's Unity build / IL2CPP linker / bee_backend / shader
99+
# compiler is still holding handles, checkout dies with EBUSY on
100+
# examples/audience. Kill known offenders, then force-remove the
101+
# workspace contents ourselves so checkout's cleanup succeeds.
74102
Get-Process | Where-Object {
75103
$_.Name -like 'Unity*' -or
76104
$_.Name -like 'il2cpp*' -or
77105
$_.Name -like 'UnityShaderCompiler*' -or
78-
$_.Name -like 'UnityCrashHandler*'
106+
$_.Name -like 'UnityCrashHandler*' -or
107+
$_.Name -like 'bee_backend*' -or
108+
$_.Name -like 'mono*'
79109
} | ForEach-Object {
80110
Write-Host "Killing stale process: $($_.Name) (pid $($_.Id))"
81111
Stop-Process -Id $_.Id -Force -ErrorAction SilentlyContinue
82112
}
83-
Start-Sleep -Seconds 2
113+
Start-Sleep -Seconds 3
114+
115+
$ws = "$env:GITHUB_WORKSPACE"
116+
if (-not (Test-Path $ws)) { return }
117+
for ($i = 1; $i -le 6; $i++) {
118+
try {
119+
Get-ChildItem -Path $ws -Force -ErrorAction Stop |
120+
Remove-Item -Recurse -Force -ErrorAction Stop
121+
Write-Host "Cleaned $ws on attempt ${i}"
122+
return
123+
} catch {
124+
Write-Host "Attempt ${i}: $($_.Exception.Message)"
125+
Start-Sleep -Seconds 3
126+
}
127+
}
128+
Write-Host "::warning::Workspace not fully cleaned; checkout may fail"
84129
85130
- uses: actions/checkout@v4
86131
with:
@@ -470,6 +515,7 @@ jobs:
470515
# Note: Unity 6 cells use 6000.4.5f1 (the latest patch with a GameCI image);
471516
# 6000.4.0f1 does not have a published GameCI Docker image.
472517
mobile-build:
518+
needs: set-matrix
473519
if: |
474520
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false)
475521
|| github.event_name == 'schedule'
@@ -479,13 +525,7 @@ jobs:
479525
strategy:
480526
fail-fast: false
481527
matrix:
482-
target: [Android, iOS]
483-
unity: ['2021.3.45f2', '2022.3.62f2', '6000.4.5f1']
484-
include:
485-
- target: Android
486-
method: AndroidBuilder.Build
487-
- target: iOS
488-
method: IosBuilder.Build
528+
include: ${{ fromJSON(needs.set-matrix.outputs.mobile) }}
489529

490530
steps:
491531
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)