Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 28 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ on:
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
PR_UNITY_VERSIONS: '["2022.3", "6000.0", "6000.3"]'
FULL_UNITY_VERSIONS: '["2021.3", "2022.3", "6000.0", "6000.3"]'

defaults:
run:
Expand All @@ -27,11 +29,6 @@ jobs:
with:
access_token: ${{ github.token }}

create-unity-matrix:
uses: ./.github/workflows/create-unity-matrix.yml
with:
event-name: ${{ github.event_name }}

sdk:
strategy:
matrix:
Expand Down Expand Up @@ -89,11 +86,11 @@ jobs:
test-create:
name: Create ${{ matrix.unity-version }} Test Project
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [create-unity-matrix]
secrets: inherit
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix) }}
matrix:
unity-version: ${{ github.event_name == 'pull_request' && fromJSON(env.PR_UNITY_VERSIONS) || fromJSON(env.FULL_UNITY_VERSIONS) }}
Comment on lines +92 to +93
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The env context is used within strategy.matrix, but it is not available in that context, which will cause the test matrix to fail evaluation.
Severity: CRITICAL

Suggested Fix

Revert to the previous pattern of using a dedicated job to create the matrix and passing it as an output. Subsequent jobs can then consume this output in strategy.matrix using the needs context, for example: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix) }}.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/workflows/ci.yml#L92-L93

Potential issue: The GitHub Actions workflow attempts to populate the `strategy.matrix`
using environment variables like `${{ env.PR_UNITY_VERSIONS }}`. According to GitHub
Actions documentation, the `env` context is not accessible within the `strategy.matrix`
definition. This will cause the matrix to be empty or fail to evaluate, preventing
numerous test jobs (`test-create`, `test-build-webgl`, etc.) from running as intended.
This effectively breaks the CI pipeline's ability to run tests across multiple Unity
versions.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workflow-level env context unavailable in strategy matrix

High Severity

The env context is not available in jobs.<job_id>.strategy — GitHub Actions only allows github, needs, vars, and inputs there. Every matrix definition using fromJSON(env.PR_UNITY_VERSIONS) or fromJSON(env.FULL_UNITY_VERSIONS) will fail with an "Unrecognized named-value: 'env'" error, breaking all test jobs. The previous approach worked because it used the needs context (which is allowed) to pass the matrix from a prior job's outputs.

Additional Locations (2)
Fix in Cursor Fix in Web

uses: ./.github/workflows/test-create.yml
with:
unity-version: ${{ matrix.unity-version }}
Expand All @@ -102,12 +99,12 @@ jobs:
test-build-webgl:
name: Build ${{ matrix.platform }} ${{ matrix.unity-version }} Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-create, create-unity-matrix]
needs: [test-create]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
unity-version: ${{ github.event_name == 'pull_request' && fromJSON(env.PR_UNITY_VERSIONS) || fromJSON(env.FULL_UNITY_VERSIONS) }}
platform: ["WebGL"]
include:
- platform: WebGL
Expand Down Expand Up @@ -242,19 +239,20 @@ jobs:
test-build-android:
name: Build Android ${{ matrix.unity-version }} Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-create, create-unity-matrix]
needs: [test-create]
secrets: inherit
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix) }}
matrix:
unity-version: ${{ github.event_name == 'pull_request' && fromJSON(env.PR_UNITY_VERSIONS) || fromJSON(env.FULL_UNITY_VERSIONS) }}
uses: ./.github/workflows/test-build-android.yml
with:
unity-version: ${{ matrix.unity-version }}

test-run-android:
name: Run Android ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-build-android, create-unity-matrix]
needs: [test-build-android]
secrets: inherit
uses: ./.github/workflows/test-run-android.yml
with:
Expand All @@ -264,32 +262,33 @@ jobs:
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
unity-version: ${{ github.event_name == 'pull_request' && fromJSON(env.PR_UNITY_VERSIONS) || fromJSON(env.FULL_UNITY_VERSIONS) }}
# api-level: [30, 31, 34]
api-level: [30]
init-type: ["runtime", "buildtime"]

test-build-ios:
name: Build iOS ${{ matrix.unity-version }} Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-create, create-unity-matrix]
needs: [test-create]
secrets: inherit
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix) }}
matrix:
unity-version: ${{ github.event_name == 'pull_request' && fromJSON(env.PR_UNITY_VERSIONS) || fromJSON(env.FULL_UNITY_VERSIONS) }}
uses: ./.github/workflows/test-build-ios.yml
with:
unity-version: ${{ matrix.unity-version }}

test-compile-ios:
name: Compile iOS ${{ matrix.unity-version }} Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-build-ios, create-unity-matrix]
needs: [test-build-ios]
secrets: inherit
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
unity-version: ${{ github.event_name == 'pull_request' && fromJSON(env.PR_UNITY_VERSIONS) || fromJSON(env.FULL_UNITY_VERSIONS) }}
init-type: ["runtime", "buildtime"]
uses: ./.github/workflows/test-compile-ios.yml
with:
Expand All @@ -299,7 +298,7 @@ jobs:
test-run-ios:
name: Run iOS ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-compile-ios, create-unity-matrix]
needs: [test-compile-ios]
uses: ./.github/workflows/test-run-ios.yml
with:
unity-version: ${{ matrix.unity-version }}
Expand All @@ -309,7 +308,7 @@ jobs:
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
unity-version: ${{ github.event_name == 'pull_request' && fromJSON(env.PR_UNITY_VERSIONS) || fromJSON(env.FULL_UNITY_VERSIONS) }}
ios-version: ["17.0", "latest"]
init-type: ["runtime", "buildtime"]
# Check https://support.apple.com/en-us/HT201222 for the latest minor version for a given major one.
Expand All @@ -325,51 +324,51 @@ jobs:
test-run-webgl:
name: Run WebGL ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-build-webgl, create-unity-matrix]
needs: [test-build-webgl]
secrets: inherit
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
unity-version: ${{ github.event_name == 'pull_request' && fromJSON(env.PR_UNITY_VERSIONS) || fromJSON(env.FULL_UNITY_VERSIONS) }}
uses: ./.github/workflows/test-run-webgl.yml
with:
unity-version: ${{ matrix.unity-version }}

test-build-linux:
name: Build Linux ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-create, create-unity-matrix]
needs: [test-create]
secrets: inherit
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
unity-version: ${{ github.event_name == 'pull_request' && fromJSON(env.PR_UNITY_VERSIONS) || fromJSON(env.FULL_UNITY_VERSIONS) }}
uses: ./.github/workflows/test-build-linux.yml
with:
unity-version: ${{ matrix.unity-version }}

test-build-windows:
name: Build Windows ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-create, create-unity-matrix]
needs: [test-create]
secrets: inherit
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
unity-version: ${{ github.event_name == 'pull_request' && fromJSON(env.PR_UNITY_VERSIONS) || fromJSON(env.FULL_UNITY_VERSIONS) }}
uses: ./.github/workflows/test-build-windows.yml
with:
unity-version: ${{ matrix.unity-version }}

test-run-linux:
name: Run Linux ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-build-linux, create-unity-matrix]
needs: [test-build-linux]
secrets: inherit
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
unity-version: ${{ github.event_name == 'pull_request' && fromJSON(env.PR_UNITY_VERSIONS) || fromJSON(env.FULL_UNITY_VERSIONS) }}
uses: ./.github/workflows/test-run-desktop.yml
with:
unity-version: ${{ matrix.unity-version }}
Expand All @@ -378,12 +377,12 @@ jobs:
test-run-windows:
name: Run Windows ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [test-build-windows, create-unity-matrix]
needs: [test-build-windows]
secrets: inherit
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
unity-version: ${{ github.event_name == 'pull_request' && fromJSON(env.PR_UNITY_VERSIONS) || fromJSON(env.FULL_UNITY_VERSIONS) }}
uses: ./.github/workflows/test-run-desktop.yml
with:
unity-version: ${{ matrix.unity-version }}
Expand Down
42 changes: 0 additions & 42 deletions .github/workflows/create-unity-matrix.yml

This file was deleted.

Loading