Skip to content

Commit e10a762

Browse files
committed
ci(audience): add Editor-tests workflow + close test-discovery gap (SDK-326)
Audience package's Unity-dependent tests have never run in CI: test-audience-sdk.yml's csproj excludes Tests/Runtime/Unity/** and Tests/Editor/**, and test-audience-sample-app.yml never discovered the package's tests because manifest.json had no testables entry. DeviceCollectorTests has shipped with two compile errors that no PR caught. * Add testables entry — sample app workflow now picks up Immutable.Audience.Runtime.Tests via its existing PlayMode cells (StandaloneOSX/Win64), which also gives them IL2CPP coverage. * New test-audience-sdk-editor.yml — runs Immutable.Audience.Editor.Tests (e.g. iOSInfoPlistPostProcessor). Editor-only asmdef + UnityEditor.iOS.Xcode dependency means it can't run in the sample app's PlayMode cells. * Add InternalsVisibleTo on Immutable.Audience.Unity for the test asmdef so DeviceCollectorTests can see DeviceCollector and IDFVBridge. * Fix DeviceCollectorTests' is-not-string-s pattern: the negated form doesn't bind s, so CS0165 fires once compilation actually runs.
1 parent e6abbbd commit e10a762

5 files changed

Lines changed: 77 additions & 2 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Audience package — Editor Tests
2+
3+
# Runs Immutable.Audience.Editor.Tests (e.g. iOSInfoPlistPostProcessor).
4+
# Editor-only asmdef + UnityEditor.iOS.Xcode dependency means it can't run
5+
# in test-audience-sample-app.yml's StandaloneOSX/Win64 PlayMode cells.
6+
# Runtime.Tests are covered there via the manifest.json testables entry.
7+
8+
on:
9+
push:
10+
branches: [main]
11+
paths:
12+
- 'src/Packages/Audience/**'
13+
- 'examples/audience/Packages/manifest.json'
14+
- '.github/workflows/test-audience-sdk-editor.yml'
15+
pull_request:
16+
paths:
17+
- 'src/Packages/Audience/**'
18+
- 'examples/audience/Packages/manifest.json'
19+
- '.github/workflows/test-audience-sdk-editor.yml'
20+
21+
jobs:
22+
editmode:
23+
if: github.event.pull_request.head.repo.fork == false || github.event_name == 'workflow_dispatch'
24+
name: EditMode (Unity 2022.3 / iOS module)
25+
runs-on: ubuntu-latest-8-cores
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
lfs: true
31+
32+
- uses: actions/cache@v4
33+
with:
34+
path: examples/audience/Library
35+
key: Library-audience-editor-tests-${{ hashFiles('examples/audience/Packages/**', 'examples/audience/ProjectSettings/**', 'src/Packages/Audience/**') }}
36+
restore-keys: |
37+
Library-audience-editor-tests-
38+
39+
- uses: game-ci/unity-test-runner@v4
40+
env:
41+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
42+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
43+
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
44+
with:
45+
unityVersion: 2022.3.62f2
46+
targetPlatform: iOS
47+
projectPath: examples/audience
48+
testMode: editmode
49+
customParameters: -assemblyNames Immutable.Audience.Editor.Tests
50+
checkName: Audience Editor Tests
51+
artifactsPath: artifacts
52+
53+
- uses: actions/upload-artifact@v4
54+
if: always()
55+
with:
56+
name: audience-editor-test-results
57+
path: artifacts

examples/audience/Packages/manifest.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,8 @@
3737
"com.unity.modules.vr": "1.0.0",
3838
"com.unity.modules.wind": "1.0.0",
3939
"com.unity.modules.xr": "1.0.0"
40-
}
40+
},
41+
"testables": [
42+
"com.immutable.audience"
43+
]
4144
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using System.Runtime.CompilerServices;
2+
3+
[assembly: InternalsVisibleTo("Immutable.Audience.Runtime.Tests")]

src/Packages/Audience/Runtime/Unity/AssemblyInfo.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Packages/Audience/Tests/Runtime/Unity/DeviceCollectorTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ public void CollectGameLaunchProperties_StringFields_DoNotExceed256Chars()
6868
"platform", "version", "buildGuid", "unityVersion",
6969
"osFamily", "deviceModel", "gpu", "gpuVendor", "cpu" })
7070
{
71-
if (!props.TryGetValue(key, out var val) || val is not string s) continue;
71+
if (!props.TryGetValue(key, out var val)) continue;
72+
if (val is not string s) continue;
7273
Assert.LessOrEqual(s.Length, 256, $"props[{key}] exceeds 256 chars");
7374
}
7475
}

0 commit comments

Comments
 (0)