|
| 1 | +name: Audience package — Unity Tests |
| 2 | + |
| 3 | +# Runs the Unity-dependent SDK tests that test-audience-sdk.yml's csproj |
| 4 | +# excludes (Tests/Runtime/Unity/** + Tests/Editor/**). Single GameCI Linux |
| 5 | +# cell on iOS targetPlatform so UnityEditor.iOS.Xcode and the UNITY_IOS |
| 6 | +# define resolve. testables is injected at CI time so the sample app's |
| 7 | +# Packages/manifest.json doesn't permanently advertise the package's tests |
| 8 | +# (avoids polluting the sample app workflow's PlayMode runs). |
| 9 | + |
| 10 | +on: |
| 11 | + push: |
| 12 | + branches: [main] |
| 13 | + paths: |
| 14 | + - 'src/Packages/Audience/**' |
| 15 | + - 'examples/audience/Packages/manifest.json' |
| 16 | + - '.github/workflows/test-audience-sdk-unity.yml' |
| 17 | + pull_request: |
| 18 | + paths: |
| 19 | + - 'src/Packages/Audience/**' |
| 20 | + - 'examples/audience/Packages/manifest.json' |
| 21 | + - '.github/workflows/test-audience-sdk-unity.yml' |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + editmode: |
| 29 | + if: github.event.pull_request.head.repo.fork == false || github.event_name == 'workflow_dispatch' |
| 30 | + name: SDK EditMode (Unity 2022.3 / iOS module) |
| 31 | + runs-on: ubuntu-latest-8-cores |
| 32 | + timeout-minutes: 30 |
| 33 | + |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v4 |
| 36 | + with: |
| 37 | + lfs: true |
| 38 | + |
| 39 | + - name: Inject testables into Packages/manifest.json |
| 40 | + # Adds com.immutable.audience to the project's testables array so |
| 41 | + # Unity Test Runner discovers the package's test asmdefs. Done in CI |
| 42 | + # rather than committed to the file so the sample app workflow's |
| 43 | + # PlayMode cells stay scoped to sample-app-only tests. |
| 44 | + run: | |
| 45 | + jq '.testables = (.testables // []) + ["com.immutable.audience"]' examples/audience/Packages/manifest.json > examples/audience/Packages/manifest.tmp.json |
| 46 | + mv examples/audience/Packages/manifest.tmp.json examples/audience/Packages/manifest.json |
| 47 | +
|
| 48 | + - uses: actions/cache@v4 |
| 49 | + with: |
| 50 | + path: examples/audience/Library |
| 51 | + key: Library-audience-sdk-tests-${{ hashFiles('examples/audience/Packages/**', 'examples/audience/ProjectSettings/**', 'src/Packages/Audience/**') }} |
| 52 | + restore-keys: | |
| 53 | + Library-audience-sdk-tests- |
| 54 | +
|
| 55 | + - uses: game-ci/unity-test-runner@v4 |
| 56 | + env: |
| 57 | + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} |
| 58 | + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} |
| 59 | + UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} |
| 60 | + with: |
| 61 | + unityVersion: 2022.3.62f2 |
| 62 | + targetPlatform: iOS |
| 63 | + projectPath: examples/audience |
| 64 | + testMode: editmode |
| 65 | + customParameters: -assemblyNames Immutable.Audience.Runtime.Tests;Immutable.Audience.Editor.Tests |
| 66 | + checkName: Audience SDK Tests |
| 67 | + artifactsPath: artifacts |
| 68 | + |
| 69 | + - uses: actions/upload-artifact@v4 |
| 70 | + if: always() |
| 71 | + with: |
| 72 | + name: audience-sdk-test-results |
| 73 | + path: artifacts |
0 commit comments