From 03102cd104cd0b563fcf9244d11a5bff49c61afb Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 20 Oct 2026 20:38:43 +0200 Subject: [PATCH 01/20] bumped to 6.6 --- .github/workflows/create-unity-matrix.yml | 4 +-- CONTRIBUTING.md | 2 +- bootstrap.ps1 | 6 ++-- docs/agent-guides/ci.md | 4 +-- docs/agent-guides/testing.md | 2 +- samples/unity-of-bugs-local/Assets | 1 - samples/unity-of-bugs-local/Assets/Editor | 1 + .../unity-of-bugs-local/Assets/Editor.meta | 1 + samples/unity-of-bugs-local/Assets/Plugins | 1 + .../unity-of-bugs-local/Assets/Plugins.meta | 1 + samples/unity-of-bugs-local/Assets/Resources | 1 + .../unity-of-bugs-local/Assets/Resources.meta | 1 + samples/unity-of-bugs-local/Assets/Scenes | 1 + .../unity-of-bugs-local/Assets/Scenes.meta | 1 + samples/unity-of-bugs-local/Assets/Scripts | 1 + .../unity-of-bugs-local/Assets/Scripts.meta | 1 + .../ProjectAuditorSettings.asset | 36 +++++++++++++++++++ .../ProjectSettings/ProjectVersion.txt | 4 +-- samples/unity-of-bugs-local/README.md | 8 +++-- scripts/unity-versions.json | 6 ++-- 20 files changed, 65 insertions(+), 18 deletions(-) delete mode 120000 samples/unity-of-bugs-local/Assets create mode 120000 samples/unity-of-bugs-local/Assets/Editor create mode 120000 samples/unity-of-bugs-local/Assets/Editor.meta create mode 120000 samples/unity-of-bugs-local/Assets/Plugins create mode 120000 samples/unity-of-bugs-local/Assets/Plugins.meta create mode 120000 samples/unity-of-bugs-local/Assets/Resources create mode 120000 samples/unity-of-bugs-local/Assets/Resources.meta create mode 120000 samples/unity-of-bugs-local/Assets/Scenes create mode 120000 samples/unity-of-bugs-local/Assets/Scenes.meta create mode 120000 samples/unity-of-bugs-local/Assets/Scripts create mode 120000 samples/unity-of-bugs-local/Assets/Scripts.meta create mode 100644 samples/unity-of-bugs-local/ProjectSettings/ProjectAuditorSettings.asset diff --git a/.github/workflows/create-unity-matrix.yml b/.github/workflows/create-unity-matrix.yml index 3fffae108..2ad5eb93d 100644 --- a/.github/workflows/create-unity-matrix.yml +++ b/.github/workflows/create-unity-matrix.yml @@ -19,9 +19,9 @@ on: env: # Unity versions used in PRs - PR_UNITY_VERSIONS: '["2021.3", "6000.5"]' + PR_UNITY_VERSIONS: '["2021.3", "6000.6"]' # Unity versions used on main branch - FULL_UNITY_VERSIONS: '["2021.3", "2022.3", "6000.0", "6000.3", "6000.5"]' + FULL_UNITY_VERSIONS: '["2021.3", "2022.3", "6000.0", "6000.3", "6000.6"]' jobs: create-unity-matrix: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ea408327a..3ebe55db4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -119,7 +119,7 @@ Run integration tests locally using the same scripts as CI: ```pwsh pwsh ./test/Scripts.Integration.Test/dev-integration-test.ps1 ` - -UnityVersion "6000.5.0f1" ` + -UnityVersion "6000.6.6f1" ` -Platform "MacOS" ` -Repack ``` diff --git a/bootstrap.ps1 b/bootstrap.ps1 index f09a7b5f2..c982ea228 100644 --- a/bootstrap.ps1 +++ b/bootstrap.ps1 @@ -144,11 +144,11 @@ else { } $localAssets = Join-Path $repoRoot "samples/unity-of-bugs-local/Assets" -if ((Test-Path $localAssets) -and (Get-Item $localAssets).LinkType -eq "SymbolicLink") { - Add-Result -Status "PASS" -Name "Local sample assets" -Detail "Assets symlink is available." +if ((Test-Path (Join-Path $localAssets "Scripts")) -and (Get-Item (Join-Path $localAssets "Scripts")).LinkType -eq "SymbolicLink") { + Add-Result -Status "PASS" -Name "Local sample assets" -Detail "Assets symlinks are available." } else { - Add-Result -Status "WARN" -Name "Local sample assets" -Detail "Assets symlink is unavailable." -Fix "Enable Git symlink support and restore samples/unity-of-bugs-local/Assets." + Add-Result -Status "WARN" -Name "Local sample assets" -Detail "Assets symlinks are unavailable." -Fix "Enable Git symlink support and restore samples/unity-of-bugs-local/Assets." } Write-Host "" diff --git a/docs/agent-guides/ci.md b/docs/agent-guides/ci.md index 577f1cb0e..09e5e6ad2 100644 --- a/docs/agent-guides/ci.md +++ b/docs/agent-guides/ci.md @@ -11,8 +11,8 @@ | Trigger | Integration Unity versions | | --- | --- | -| Pull request | `2021.3`, `6000.5` | -| Main or non-PR | `2021.3`, `2022.3`, `6000.0`, `6000.3`, `6000.5` | +| Pull request | `2021.3`, `6000.6` | +| Main or non-PR | `2021.3`, `2022.3`, `6000.0`, `6000.3`, `6000.6` | | `chore/unity-.*` PR | Matching version only | Exact Unity editor versions and changesets live in `scripts/unity-versions.json`. The package build itself currently uses Unity `2021.3`. diff --git a/docs/agent-guides/testing.md b/docs/agent-guides/testing.md index e686b20a2..b06c2ee2b 100644 --- a/docs/agent-guides/testing.md +++ b/docs/agent-guides/testing.md @@ -37,7 +37,7 @@ dotnet msbuild /t:UnityEditModeTest test/Sentry.Unity.Editor.Tests ```pwsh pwsh ./test/Scripts.Integration.Test/dev-integration-test.ps1 ` - -UnityVersion "6000.5.0f1" ` + -UnityVersion "6000.6.6f1" ` -Platform "MacOS" ` -Repack ``` diff --git a/samples/unity-of-bugs-local/Assets b/samples/unity-of-bugs-local/Assets deleted file mode 120000 index be39c9997..000000000 --- a/samples/unity-of-bugs-local/Assets +++ /dev/null @@ -1 +0,0 @@ -../unity-of-bugs/Assets \ No newline at end of file diff --git a/samples/unity-of-bugs-local/Assets/Editor b/samples/unity-of-bugs-local/Assets/Editor new file mode 120000 index 000000000..5a067119d --- /dev/null +++ b/samples/unity-of-bugs-local/Assets/Editor @@ -0,0 +1 @@ +../../unity-of-bugs/Assets/Editor \ No newline at end of file diff --git a/samples/unity-of-bugs-local/Assets/Editor.meta b/samples/unity-of-bugs-local/Assets/Editor.meta new file mode 120000 index 000000000..79e159da1 --- /dev/null +++ b/samples/unity-of-bugs-local/Assets/Editor.meta @@ -0,0 +1 @@ +../../unity-of-bugs/Assets/Editor.meta \ No newline at end of file diff --git a/samples/unity-of-bugs-local/Assets/Plugins b/samples/unity-of-bugs-local/Assets/Plugins new file mode 120000 index 000000000..38acf0d2f --- /dev/null +++ b/samples/unity-of-bugs-local/Assets/Plugins @@ -0,0 +1 @@ +../../unity-of-bugs/Assets/Plugins \ No newline at end of file diff --git a/samples/unity-of-bugs-local/Assets/Plugins.meta b/samples/unity-of-bugs-local/Assets/Plugins.meta new file mode 120000 index 000000000..022cecea0 --- /dev/null +++ b/samples/unity-of-bugs-local/Assets/Plugins.meta @@ -0,0 +1 @@ +../../unity-of-bugs/Assets/Plugins.meta \ No newline at end of file diff --git a/samples/unity-of-bugs-local/Assets/Resources b/samples/unity-of-bugs-local/Assets/Resources new file mode 120000 index 000000000..a6640f44e --- /dev/null +++ b/samples/unity-of-bugs-local/Assets/Resources @@ -0,0 +1 @@ +../../unity-of-bugs/Assets/Resources \ No newline at end of file diff --git a/samples/unity-of-bugs-local/Assets/Resources.meta b/samples/unity-of-bugs-local/Assets/Resources.meta new file mode 120000 index 000000000..2ae0d4d0f --- /dev/null +++ b/samples/unity-of-bugs-local/Assets/Resources.meta @@ -0,0 +1 @@ +../../unity-of-bugs/Assets/Resources.meta \ No newline at end of file diff --git a/samples/unity-of-bugs-local/Assets/Scenes b/samples/unity-of-bugs-local/Assets/Scenes new file mode 120000 index 000000000..7edcdf105 --- /dev/null +++ b/samples/unity-of-bugs-local/Assets/Scenes @@ -0,0 +1 @@ +../../unity-of-bugs/Assets/Scenes \ No newline at end of file diff --git a/samples/unity-of-bugs-local/Assets/Scenes.meta b/samples/unity-of-bugs-local/Assets/Scenes.meta new file mode 120000 index 000000000..aefeb091b --- /dev/null +++ b/samples/unity-of-bugs-local/Assets/Scenes.meta @@ -0,0 +1 @@ +../../unity-of-bugs/Assets/Scenes.meta \ No newline at end of file diff --git a/samples/unity-of-bugs-local/Assets/Scripts b/samples/unity-of-bugs-local/Assets/Scripts new file mode 120000 index 000000000..c0a4897f3 --- /dev/null +++ b/samples/unity-of-bugs-local/Assets/Scripts @@ -0,0 +1 @@ +../../unity-of-bugs/Assets/Scripts \ No newline at end of file diff --git a/samples/unity-of-bugs-local/Assets/Scripts.meta b/samples/unity-of-bugs-local/Assets/Scripts.meta new file mode 120000 index 000000000..125efa28b --- /dev/null +++ b/samples/unity-of-bugs-local/Assets/Scripts.meta @@ -0,0 +1 @@ +../../unity-of-bugs/Assets/Scripts.meta \ No newline at end of file diff --git a/samples/unity-of-bugs-local/ProjectSettings/ProjectAuditorSettings.asset b/samples/unity-of-bugs-local/ProjectSettings/ProjectAuditorSettings.asset new file mode 100644 index 000000000..1dae2b366 --- /dev/null +++ b/samples/unity-of-bugs-local/ProjectSettings/ProjectAuditorSettings.asset @@ -0,0 +1,36 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 53 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 0} + m_Name: + m_EditorClassIdentifier: UnityEditor.ProjectAuditorModule:Unity.ProjectAuditor.Editor:ProjectAuditorSettings + Rules: + rules: [] + DiagnosticParams: + paramsStack: + - PlatformGroup: + m_String: Unknown + m_SerializedParams: + - Key: StreamingClipThresholdBytes + Value: 218294 + - Key: LongDecompressedClipThresholdBytes + Value: 204800 + - Key: LongCompressedMobileClipThresholdBytes + Value: 204800 + - Key: LoadInBackGroundClipSizeThresholdBytes + Value: 204800 + - Key: TextureStreamingMipmapsSizeLimit + Value: 4000 + - Key: SpriteAtlasEmptySpaceLimit + Value: 50 + - Key: StreamingAssetsFolderSizeLimit + Value: 50 + CurrentParamsIndex: 0 diff --git a/samples/unity-of-bugs-local/ProjectSettings/ProjectVersion.txt b/samples/unity-of-bugs-local/ProjectSettings/ProjectVersion.txt index 02866a225..99bacd03c 100644 --- a/samples/unity-of-bugs-local/ProjectSettings/ProjectVersion.txt +++ b/samples/unity-of-bugs-local/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 6000.6.0b5 -m_EditorVersionWithRevision: 6000.6.0b5 (b5238eaafb35) +m_EditorVersion: 6000.6.6f1 +m_EditorVersionWithRevision: 6000.6.6f1 (d20c9ac777da) diff --git a/samples/unity-of-bugs-local/README.md b/samples/unity-of-bugs-local/README.md index 4249995b6..c2d0fe8c4 100644 --- a/samples/unity-of-bugs-local/README.md +++ b/samples/unity-of-bugs-local/README.md @@ -1,8 +1,10 @@ # Unity of Bugs (Local) -Unity 6 development project. Its `Assets` directory is a relative symlink to -`../unity-of-bugs/Assets`, so sample scenes and scripts stay shared with the -Unity 2021 compatibility project. +Unity 6 development project. The entries in its `Assets` directory are relative +symlinks into `../unity-of-bugs/Assets`, so sample scenes and scripts stay shared +with the Unity 2021 compatibility project. `Assets` itself is a real directory +because Unity Hub rejects projects whose `Assets` is a symlink. Add a symlink here +when adding a top-level folder to `unity-of-bugs/Assets`. `Packages` and `ProjectSettings` are local to this project. Unity can upgrade them without changing `unity-of-bugs`. diff --git a/scripts/unity-versions.json b/scripts/unity-versions.json index 939b25de5..eccd8ffd8 100644 --- a/scripts/unity-versions.json +++ b/scripts/unity-versions.json @@ -15,8 +15,8 @@ "version": "6000.3.26f1", "changeset": "de8167e7440c" }, - "6000.5": { - "version": "6000.5.0f1", - "changeset": "88b47c5e7076" + "6000.6": { + "version": "6000.6.6f1", + "changeset": "d20c9ac777da" } } From dff6a4b91f1cec3665923e6a6b9b2465f5cab5dd Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 20 Oct 2026 21:09:52 +0200 Subject: [PATCH 02/20] bumped pipeline from 0.6.0 to 0.9.0 --- .../Packages/manifest.json | 4 +- .../Packages/packages-lock.json | 4 +- scripts/build-sample.ps1 | 4 +- scripts/unity-pipeline.ps1 | 47 ++++++++++++++----- scripts/unity-test-pipeline.ps1 | 6 +-- 5 files changed, 45 insertions(+), 20 deletions(-) diff --git a/samples/unity-of-bugs-local/Packages/manifest.json b/samples/unity-of-bugs-local/Packages/manifest.json index 6ff453380..0dbadb4ae 100644 --- a/samples/unity-of-bugs-local/Packages/manifest.json +++ b/samples/unity-of-bugs-local/Packages/manifest.json @@ -2,14 +2,14 @@ "dependencies": { "com.unity.ai.navigation": "2.0.13", "com.unity.burst": "2.0.0", - "com.unity.collab-proxy": "2.12.4", + "com.unity.collab-proxy": "2.13.6", "com.unity.feature.development": "1.0.2", "com.unity.ide.rider": "3.0.40", "com.unity.ide.visualstudio": "2.0.26", "com.unity.ide.vscode": "1.2.5", "com.unity.mobile.android-logcat": "1.4.7", "com.unity.multiplayer.center": "2.0.1", - "com.unity.pipeline": "0.4.0-exp.1", + "com.unity.pipeline": "0.9.0-exp.1", "com.unity.test-framework": "1.8.0", "com.unity.timeline": "6.6.0", "com.unity.ugui": "2.6.0", diff --git a/samples/unity-of-bugs-local/Packages/packages-lock.json b/samples/unity-of-bugs-local/Packages/packages-lock.json index a5548205e..5987c4d75 100644 --- a/samples/unity-of-bugs-local/Packages/packages-lock.json +++ b/samples/unity-of-bugs-local/Packages/packages-lock.json @@ -16,7 +16,7 @@ "dependencies": {} }, "com.unity.collab-proxy": { - "version": "2.12.4", + "version": "2.13.6", "depth": 0, "source": "registry", "dependencies": {}, @@ -109,7 +109,7 @@ "url": "https://packages.unity.com" }, "com.unity.pipeline": { - "version": "0.4.0-exp.1", + "version": "0.9.0-exp.1", "depth": 0, "source": "registry", "dependencies": { diff --git a/scripts/build-sample.ps1 b/scripts/build-sample.ps1 index d45f8b75c..9df7eaa73 100644 --- a/scripts/build-sample.ps1 +++ b/scripts/build-sample.ps1 @@ -48,7 +48,7 @@ function Wait-ForUnityPipelineBuild([string] $projectPath, [int] $timeoutSeconds while ((Get-Date) -lt $deadline) { try { - $status = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "build_status" + $status = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "build status" } catch { $lastError = $_ @@ -88,7 +88,7 @@ function Wait-ForUnityPipelineBuild([string] $projectPath, [int] $timeoutSeconds $executionMode = Get-UnityExecutionMode -ProjectPath $projectPath if ($executionMode -eq "Pipeline") { Prepare-UnityPipelineEditor -ProjectPath $projectPath -TimeoutSeconds $timeoutSeconds - $started = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "build" -CommandArguments @("--target", $Target, "--outputPath", $outputPath, "--confirm", "true") + $started = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "build run" -CommandArguments @("--target", $Target, "--outputPath", $outputPath, "--confirm", "true") if ($started.status -ne "queued") { $errorsProperty = $started.PSObject.Properties["validationErrors"] $errors = if ($errorsProperty) { @($errorsProperty.Value) } else { @() } diff --git a/scripts/unity-pipeline.ps1 b/scripts/unity-pipeline.ps1 index 2e3077ab3..daa5f2510 100644 --- a/scripts/unity-pipeline.ps1 +++ b/scripts/unity-pipeline.ps1 @@ -36,9 +36,22 @@ function Get-UnityCliErrorCode([object] $response) { return $null } +# Absolute path with symlinks resolved, as the Editor reports its project path. +function Resolve-UnityProjectPath([string] $path) { + $resolved = (Resolve-Path -LiteralPath $path).Path + if (-not $IsWindows) { + $real = & realpath $resolved 2>$null + if ($LASTEXITCODE -eq 0 -and $real) { + return $real + } + } + + return $resolved +} + function Get-UnityExecutionMode([string] $projectPath) { - $projectName = Split-Path $projectPath -Leaf - $status = Invoke-UnityCli @("status", "--project", $projectName, "--format", "json") + # Match by full path: worktrees of this repo share the project folder name. + $status = Invoke-UnityCli @("status", "--project-path", $projectPath, "--format", "json") $successProperty = $null if ($status.Response) { $successProperty = $status.Response.PSObject.Properties["success"] @@ -66,8 +79,8 @@ function Invoke-UnityPipelineCommand( [string[]] $commandArguments = @(), [int] $timeoutSeconds = 30 ) { - $arguments = @( - "--json", "command", $command, + # Pipeline 0.9 names commands as ` ` (e.g. "editor status"). + $arguments = @("--json", "command") + ($command -split " ") + @( "--project-path", $projectPath, "--timeout", $timeoutSeconds ) + $commandArguments @@ -84,11 +97,23 @@ function Invoke-UnityPipelineCommand( throw "Unity command '$command' returned invalid JSON:`n$($output | Out-String)" } - if (-not $response.success -or -not $response.data.success) { + # Older CLIs also report the command's own result in data.success; newer ones only in success. + $dataSuccess = $response.data.PSObject.Properties["success"] + if (-not $response.success -or ($dataSuccess -and -not $dataSuccess.Value)) { throw "Unity command '$command' failed:`n$($output | Out-String)" } - return $response.data.result + # Some commands return their result as a JSON string. + $result = $response.data.result + if ($result -is [string]) { + try { + $result = $result | ConvertFrom-Json + } + catch { + } + } + + return $result } function Wait-ForUnityEditorReady([string] $projectPath, [int] $timeoutSeconds) { @@ -97,7 +122,7 @@ function Wait-ForUnityEditorReady([string] $projectPath, [int] $timeoutSeconds) while ((Get-Date) -lt $deadline) { try { - $status = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "editor_status" + $status = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "editor status" } catch { $lastError = $_ @@ -110,7 +135,7 @@ function Wait-ForUnityEditorReady([string] $projectPath, [int] $timeoutSeconds) throw "Unity Editor must be stopped before continuing. Current play mode: $($status.playMode)." } - if ((Resolve-Path $status.projectPath).Path -ne $projectPath) { + if ((Resolve-UnityProjectPath $status.projectPath) -ne (Resolve-UnityProjectPath $projectPath)) { throw "Unity Pipeline is connected to $($status.projectPath), not $projectPath." } @@ -128,11 +153,11 @@ function Wait-ForUnityEditorReady([string] $projectPath, [int] $timeoutSeconds) } function Enable-UnityPipelineAutoTick([string] $projectPath) { - Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "set_autotick" -CommandArguments @("--enable", "true") | Out-Null + Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "editor set_auto_tick" -CommandArguments @("--enable", "true") | Out-Null } function Wait-ForUnityRecompile([string] $projectPath, [int] $timeoutSeconds) { - $recompile = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "recompile" -TimeoutSeconds $timeoutSeconds + $recompile = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "script recompile" -TimeoutSeconds $timeoutSeconds if ($recompile.status -eq "up_to_date") { return } @@ -141,7 +166,7 @@ function Wait-ForUnityRecompile([string] $projectPath, [int] $timeoutSeconds) { $lastError = $null while ((Get-Date) -lt $deadline) { try { - $status = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "recompile_status" + $status = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "script recompile_status" if ($status -is [string]) { $status = $status | ConvertFrom-Json } diff --git a/scripts/unity-test-pipeline.ps1 b/scripts/unity-test-pipeline.ps1 index 8b2f8bf29..99b2e3786 100644 --- a/scripts/unity-test-pipeline.ps1 +++ b/scripts/unity-test-pipeline.ps1 @@ -14,7 +14,7 @@ function Wait-ForPlayModeTests([string] $projectPath, [int] $timeoutSeconds) { $lastError = $null while ((Get-Date) -lt $deadline) { try { - $status = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "test_status" + $status = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "test status" if ($status -is [string]) { $status = $status | ConvertFrom-Json } @@ -109,14 +109,14 @@ function Invoke-UnityPipelineTests( } if ($testPlatform -eq "playmode") { - $started = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "run_tests" -CommandArguments ($commandArguments + @("--async_tests", "true")) -TimeoutSeconds ($timeoutSeconds + 30) + $started = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "test run" -CommandArguments ($commandArguments + @("--async_tests", "true")) -TimeoutSeconds ($timeoutSeconds + 30) if (-not $started.success) { throw "Unity PlayMode tests could not start: $($started.error)" } $result = Wait-ForPlayModeTests -ProjectPath $projectPath -TimeoutSeconds $timeoutSeconds } else { - $result = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "run_tests" -CommandArguments $commandArguments -TimeoutSeconds ($timeoutSeconds + 30) + $result = Invoke-UnityPipelineCommand -ProjectPath $projectPath -Command "test run" -CommandArguments $commandArguments -TimeoutSeconds ($timeoutSeconds + 30) } $runs += Get-TestSummary -RequestedMode $testPlatform -Result $result From eccb3b98d51da1991caec9bc7d0ab4098a1d7010 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 21 Oct 2026 19:49:43 +0200 Subject: [PATCH 03/20] pinned ubuntu to 24 --- .github/workflows/ci.yml | 14 +++++++------- .github/workflows/create-unity-matrix.yml | 2 +- .github/workflows/danger.yml | 2 +- .github/workflows/format-code.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/test-build-ios.yml | 2 +- .github/workflows/test-build-linux.yml | 2 +- .github/workflows/test-create.yml | 2 +- .github/workflows/test-run-android.yml | 2 +- .github/workflows/test-run-desktop.yml | 2 +- .github/workflows/test-run-webgl.yml | 2 +- .github/workflows/update-deps.yml | 4 ++-- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6151395e8..ad148a4aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ defaults: jobs: cancel-previous-workflow: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1 @@ -38,11 +38,11 @@ jobs: matrix: include: - target: Android - host: ubuntu-latest + host: ubuntu-24.04 - target: Linux - host: ubuntu-latest + host: ubuntu-24.04 - target: LinuxNative - host: ubuntu-latest + host: ubuntu-24.04 - target: Windows host: windows-latest - target: WindowsNative @@ -75,7 +75,7 @@ jobs: package-validation: name: UPM Package validation - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -135,7 +135,7 @@ jobs: name: Build ${{ matrix.platform }} ${{ matrix.unity-version }} Test if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [test-create, create-unity-matrix] - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: @@ -565,7 +565,7 @@ jobs: build-size-summary: name: Build Size - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [test-build-webgl, test-build-android, test-compile-ios, test-build-linux, test-build-windows, test-build-macos] steps: diff --git a/.github/workflows/create-unity-matrix.yml b/.github/workflows/create-unity-matrix.yml index 2ad5eb93d..bd2d30579 100644 --- a/.github/workflows/create-unity-matrix.yml +++ b/.github/workflows/create-unity-matrix.yml @@ -25,7 +25,7 @@ env: jobs: create-unity-matrix: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 outputs: unity-matrix: ${{ steps.set-matrix.outputs.matrix }} steps: diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 0ec9dcccf..aeae42afc 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -5,6 +5,6 @@ on: jobs: danger: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: getsentry/github-workflows/danger@26f565c05d0dd49f703d238706b775883037d76b # v3 diff --git a/.github/workflows/format-code.yml b/.github/workflows/format-code.yml index 6be001e9b..720bddf4e 100644 --- a/.github/workflows/format-code.yml +++ b/.github/workflows/format-code.yml @@ -5,7 +5,7 @@ on: jobs: format-code: name: Format Code - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f37c48d98..01f60ec1f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ permissions: jobs: job_release: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 name: 'Release a new version: ${{ github.event.inputs.version }}' steps: - name: Get auth token diff --git a/.github/workflows/test-build-ios.yml b/.github/workflows/test-build-ios.yml index 9dab592ec..118bb4c06 100644 --- a/.github/workflows/test-build-ios.yml +++ b/.github/workflows/test-build-ios.yml @@ -20,7 +20,7 @@ defaults: jobs: build: name: ${{ inputs.unity-version }} - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 strategy: matrix: include: diff --git a/.github/workflows/test-build-linux.yml b/.github/workflows/test-build-linux.yml index 5535dc050..1f2b2309d 100644 --- a/.github/workflows/test-build-linux.yml +++ b/.github/workflows/test-build-linux.yml @@ -20,7 +20,7 @@ defaults: jobs: build: name: Linux ${{ inputs.unity-version }} - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 env: GITHUB_ACTOR: ${{ github.actor }} UNITY_PATH: docker exec unity unity-editor diff --git a/.github/workflows/test-create.yml b/.github/workflows/test-create.yml index 067df280d..33ce665b8 100644 --- a/.github/workflows/test-create.yml +++ b/.github/workflows/test-create.yml @@ -16,7 +16,7 @@ defaults: jobs: create: name: ${{ inputs.unity-version }} - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 env: GITHUB_ACTOR: ${{ github.actor }} UNITY_PATH: docker exec unity unity-editor diff --git a/.github/workflows/test-run-android.yml b/.github/workflows/test-run-android.yml index 67b6471f6..dcb471dab 100644 --- a/.github/workflows/test-run-android.yml +++ b/.github/workflows/test-run-android.yml @@ -26,7 +26,7 @@ jobs: name: ${{ inputs.unity-version }} ${{ inputs.api-level }} ${{ inputs.init-type }} # Unity 6000.x builds ARM64 so we run Redroid (containerized arm64 Android) on an # arm64 Linux runner. - runs-on: ${{ fromJSON(inputs.unity-version) >= 6000 && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} + runs-on: ${{ fromJSON(inputs.unity-version) >= 6000 && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} env: ARTIFACTS_PATH: samples/IntegrationTest/test-artifacts/ HOMEBREW_NO_INSTALL_CLEANUP: 1 diff --git a/.github/workflows/test-run-desktop.yml b/.github/workflows/test-run-desktop.yml index 4cf4f7e24..e5b0ffa13 100644 --- a/.github/workflows/test-run-desktop.yml +++ b/.github/workflows/test-run-desktop.yml @@ -37,7 +37,7 @@ defaults: jobs: run: name: ${{ inputs.platform }}${{ inputs.architecture && format(' {0}', inputs.architecture) || '' }}${{ inputs.scripting && format(' {0}', inputs.scripting) || '' }}${{ inputs.backend && format(' ({0})', inputs.backend) || '' }} ${{ inputs.unity-version }} - runs-on: ${{ inputs.platform == 'linux' && 'ubuntu-latest' || inputs.platform == 'macos' && 'macos-latest' || 'windows-latest' }} + runs-on: ${{ inputs.platform == 'linux' && 'ubuntu-24.04' || inputs.platform == 'macos' && 'macos-latest' || 'windows-latest' }} env: SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} diff --git a/.github/workflows/test-run-webgl.yml b/.github/workflows/test-run-webgl.yml index cff15cb81..8d243ca5e 100644 --- a/.github/workflows/test-run-webgl.yml +++ b/.github/workflows/test-run-webgl.yml @@ -18,7 +18,7 @@ defaults: jobs: run: name: WebGL ${{ inputs.unity-version }} - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 env: SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} diff --git a/.github/workflows/update-deps.yml b/.github/workflows/update-deps.yml index 90be275f6..4c8ee93ad 100644 --- a/.github/workflows/update-deps.yml +++ b/.github/workflows/update-deps.yml @@ -27,7 +27,7 @@ jobs: post-update-script: scripts/sync-dotnet-global-json.ps1 - name: CLI path: modules/sentry-cli.properties - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: getsentry/github-workflows/updater@959162c159b866489d3fabe93327f48f9b8cb7ee # 3.4.1 with: @@ -40,7 +40,7 @@ jobs: name: Unity ${{ matrix.unity-prefix }} PR # Note: we're using the negative check here so this runs also for workflow_dispatch. if: github.event.schedule != '0 3 * * *' - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 defaults: run: shell: pwsh From 7a647d9e357abac64cd2b44100f1bfdfd5b32019 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 21 Oct 2026 20:39:44 +0200 Subject: [PATCH 04/20] Raise Docker shared memory for Unity 6.6 --- scripts/ci-docker.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci-docker.sh b/scripts/ci-docker.sh index a9330c0b1..769647a88 100755 --- a/scripts/ci-docker.sh +++ b/scripts/ci-docker.sh @@ -36,6 +36,7 @@ set -x docker run -td --name $container \ --hostname $uniqueHostname \ --user $uid:$gid \ + --shm-size=2g \ -v "$cwd":/sentry-unity \ -v $ANDROID_HOME:$ANDROID_HOME \ -v $JAVA_HOME_11_X64:$JAVA_HOME_11_X64 \ From 4da4d285120e0ec78f2321cc56f45ff286e71750 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 21 Oct 2026 21:01:48 +0200 Subject: [PATCH 05/20] Temporary: print kernel log on Linux build failure --- .github/workflows/test-build-linux.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test-build-linux.yml b/.github/workflows/test-build-linux.yml index 1f2b2309d..41ec3af1e 100644 --- a/.github/workflows/test-build-linux.yml +++ b/.github/workflows/test-build-linux.yml @@ -191,6 +191,14 @@ jobs: Write-Host "`n=== Unity log from container ===" docker exec unity cat /sentry-unity/unity.log 2>&1 || echo "unity.log not found" + + Write-Host "`n=== Kernel log ===" + sudo dmesg -T | Select-Object -Last 60 + + Write-Host "`n=== Memory ===" + free -m + docker exec unity df -h /dev/shm + docker exec unity ls -la /opt/unity/Editor/Data/PlaybackEngines/LinuxStandaloneSupport continue-on-error: true - name: Upload IntegrationTest project on failure From 426f9b569c1f0c0fe38c80d5bbefd626ab124329 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 21 Oct 2026 21:57:20 +0200 Subject: [PATCH 06/20] Remove kernel log diagnostic --- .github/workflows/test-build-linux.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/test-build-linux.yml b/.github/workflows/test-build-linux.yml index 41ec3af1e..1f2b2309d 100644 --- a/.github/workflows/test-build-linux.yml +++ b/.github/workflows/test-build-linux.yml @@ -191,14 +191,6 @@ jobs: Write-Host "`n=== Unity log from container ===" docker exec unity cat /sentry-unity/unity.log 2>&1 || echo "unity.log not found" - - Write-Host "`n=== Kernel log ===" - sudo dmesg -T | Select-Object -Last 60 - - Write-Host "`n=== Memory ===" - free -m - docker exec unity df -h /dev/shm - docker exec unity ls -la /opt/unity/Editor/Data/PlaybackEngines/LinuxStandaloneSupport continue-on-error: true - name: Upload IntegrationTest project on failure From 21643216fe1b07fa91d9ae57d5bb4a67c76ecbc3 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 21 Oct 2026 21:57:58 +0200 Subject: [PATCH 07/20] Install Unity via the Unity CLI instead of Docker containers --- .github/actions/setup-unity/action.yml | 28 +++++++ .github/actions/setup-unity/setup-unity.ps1 | 75 +++++++++++++++++++ .github/workflows/build.yml | 38 ++++------ .github/workflows/ci.yml | 24 ++---- .github/workflows/test-build-android.yml | 23 +++--- .github/workflows/test-build-ios.yml | 21 ++---- .github/workflows/test-build-linux.yml | 36 +++------ .github/workflows/test-build-macos.yml | 22 +----- .github/workflows/test-build-windows-mono.yml | 22 +----- .github/workflows/test-build-windows-x86.yml | 22 +----- .github/workflows/test-build-windows.yml | 22 +----- .github/workflows/test-create.yml | 19 ++--- docs/agent-guides/ci.md | 4 +- scripts/alias-assemblies.ps1 | 5 +- scripts/ci-docker.sh | 68 ----------------- scripts/find-unity.ps1 | 2 +- scripts/unity-utils.ps1 | 16 +--- test/Scripts.Integration.Test/add-sentry.ps1 | 1 - .../build-project.ps1 | 2 +- test/Scripts.Integration.Test/common.ps1 | 2 +- .../create-project.ps1 | 2 +- test/Scripts.Integration.Test/globals.ps1 | 17 +---- 22 files changed, 181 insertions(+), 290 deletions(-) create mode 100644 .github/actions/setup-unity/action.yml create mode 100644 .github/actions/setup-unity/setup-unity.ps1 delete mode 100755 scripts/ci-docker.sh diff --git a/.github/actions/setup-unity/action.yml b/.github/actions/setup-unity/action.yml new file mode 100644 index 000000000..580f89433 --- /dev/null +++ b/.github/actions/setup-unity/action.yml @@ -0,0 +1,28 @@ +name: 'Setup Unity' +description: 'Installs a Unity Editor and modules with the Unity CLI and configures the license server.' +inputs: + unity-version: + description: 'Unity version key in scripts/unity-versions.json, e.g. 2021.3' + required: true + modules: + description: 'Space-separated Unity module IDs, e.g. android. Child modules are included.' + required: false + default: '' + license-server-config: + description: 'Contents of the Unity license server services-config.json' + required: true +outputs: + unity-version: + description: 'Installed Unity Editor version, e.g. 2021.3.45f2' + value: ${{ steps.setup.outputs.unity-version }} + +runs: + using: composite + steps: + - id: setup + env: + UNITY_VERSION_KEY: ${{ inputs.unity-version }} + UNITY_MODULES: ${{ inputs.modules }} + UNITY_LICENSE_SERVER_CONFIG: ${{ inputs.license-server-config }} + shell: pwsh + run: '& "$env:GITHUB_ACTION_PATH/setup-unity.ps1" -UnityVersion $env:UNITY_VERSION_KEY -Modules $env:UNITY_MODULES' diff --git a/.github/actions/setup-unity/setup-unity.ps1 b/.github/actions/setup-unity/setup-unity.ps1 new file mode 100644 index 000000000..84f4a3b04 --- /dev/null +++ b/.github/actions/setup-unity/setup-unity.ps1 @@ -0,0 +1,75 @@ +param( + [Parameter(Mandatory = $true)][string] $UnityVersion, + [string] $Modules = '' +) + +$ErrorActionPreference = 'Stop' +$PSNativeCommandUseErrorActionPreference = $true + +$CliVersion = '1.0.0-beta.14' +$CliBinaries = @{ + 'linux-x64' = @('unity-linux-x64', 'd9a2c1716ce723b970898f7f40adc09cceee04e84ce2f1f1638f07ac3e9898aa') + 'darwin-arm64' = @('unity-darwin-arm64', '367ea124c61e91dc22409699cb40d2e65d23952f3220e911ccea1f6d8a1ff37f') + 'win32-x64' = @('unity-windows-x64.exe', '78761a0547cd4a9bc212e27a217c66e6a621bf48c753ba440e4b2327ee7ff8ac') +} + +$unity = (Get-Content "$PSScriptRoot/../../../scripts/unity-versions.json" -Raw | ConvertFrom-Json).$UnityVersion +if (-not $unity) { throw "Unity version '$UnityVersion' not found in scripts/unity-versions.json" } +$moduleList = -split $Modules + +$env:UNITY_NON_INTERACTIVE = '1' +$env:UNITY_NO_BANNER = '1' +$env:UNITY_NO_PAGER = '1' + +# Unity CLI, pinned by version and checksum +$os = $IsWindows ? 'win32' : $IsMacOS ? 'darwin' : 'linux' +$arch = "$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)".ToLower() +$cliFile, $cliSha = $CliBinaries["$os-$arch"] +if (-not $cliFile) { throw "No Unity CLI binary pinned for $os-$arch" } + +$cliDir = Join-Path ($env:RUNNER_TEMP ?? [System.IO.Path]::GetTempPath()) 'unity-cli' +New-Item -ItemType Directory -Force -Path $cliDir | Out-Null +$cli = Join-Path $cliDir ($IsWindows ? 'unity.exe' : 'unity') +Invoke-WebRequest -Uri "https://public-cdn.cloud.unity3d.com/hub/prod/cli/$CliVersion/$cliFile" -OutFile $cli +if ((Get-FileHash $cli -Algorithm SHA256).Hash -ne $cliSha) { throw "Unity CLI checksum mismatch for $cliFile" } +if (-not $IsWindows) { chmod +x $cli } + +if ($IsLinux) { + # Ubuntu 24.04 package names: editor runtime libraries, xvfb for batchmode, unzip for module extraction, + # and the native toolchain for IL2CPP and WebGL + $packages = @('xvfb', 'libglu1-mesa', 'libgtk-3-0t64', 'libasound2t64', 'libnss3', 'libxtst6', 'libxss1', 'libnotify4', 'libcap2', 'cpio', 'xz-utils', 'unzip') + if ($moduleList -match 'il2cpp|webgl') { $packages += @('build-essential', 'clang', 'lld') } + sudo apt-get update -q + sudo apt-get install -y -q --no-install-recommends @packages +} + +$installArgs = @('install', $unity.version, '--changeset', $unity.changeset, '--child-modules', '--accept-eula', '--yes') +if ($moduleList) { $installArgs += @('--module') + $moduleList } +& $cli @installArgs + +$editor = (& $cli editors --installed --verbose --json | ConvertFrom-Json).data | Where-Object version -EQ $unity.version | Select-Object -First 1 +if (-not $editor) { throw "Unity $($unity.version) not listed after install" } +$location = $editor.location +$unityPath = @($location, "$location/Contents/MacOS/Unity", "$location/Unity.exe", "$location/Unity", "$location/Editor/Unity.exe", "$location/Editor/Unity") | + Where-Object { Test-Path $_ -PathType Leaf } | + Select-Object -First 1 +if (-not $unityPath) { throw "Unity executable not found at $location" } +Write-Host "Unity $($unity.version) installed at $unityPath" + +if ($env:UNITY_LICENSE_SERVER_CONFIG) { + if ($IsWindows) { + New-Item -ItemType Directory -Force -Path 'C:/ProgramData/Unity/config' | Out-Null + Set-Content -Path 'C:/ProgramData/Unity/config/services-config.json' -Value $env:UNITY_LICENSE_SERVER_CONFIG + } else { + $unityDataDir = $IsMacOS ? '/Library/Application Support/Unity' : '/usr/share/unity3d' + $configFile = Join-Path $cliDir 'services-config.json' + Set-Content -Path $configFile -Value $env:UNITY_LICENSE_SERVER_CONFIG + sudo mkdir -p "$unityDataDir/config" + sudo cp $configFile "$unityDataDir/config/services-config.json" + sudo chown -R "$(id -un)" $unityDataDir + Remove-Item $configFile + } +} + +if ($env:GITHUB_ENV) { "UNITY_PATH=$unityPath" >> $env:GITHUB_ENV } +if ($env:GITHUB_OUTPUT) { "unity-version=$($unity.version)" >> $env:GITHUB_OUTPUT } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cff3308ec..7a4bc77cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,6 @@ on: env: DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: 1 - GITHUB_ACTOR: ${{ github.actor }} UNITY_VERSION: ${{ inputs.unity-version }} defaults: @@ -49,6 +48,7 @@ jobs: run: | $v = (Get-Content scripts/unity-versions.json -Raw | ConvertFrom-Json).'${{ env.UNITY_VERSION }}'.version "unityVersion=$v" >> $env:GITHUB_OUTPUT + "UNITY_VERSION=$v" >> $env:GITHUB_ENV - name: Cache Unity Library uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 @@ -58,18 +58,12 @@ jobs: restore-keys: | Library-unity-of-bugs-${{ steps.env.outputs.unityVersion }}- - - name: Docker Login - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + - name: Setup Unity + uses: ./.github/actions/setup-unity with: - registry: ghcr.io - username: ${{ env.GITHUB_ACTOR }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Start the Unity docker container - run: ./scripts/ci-docker.sh "$UNITY_VERSION" 'ios' "$UNITY_LICENSE_SERVER_CONFIG" - shell: bash - env: - UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + unity-version: ${{ inputs.unity-version }} + modules: ios + license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Install .NET SDK if: runner.os != 'Windows' @@ -126,17 +120,17 @@ jobs: path: package-dev/Plugins/Windows/SentryNative~ - name: Build Sentry.Unity Solution - run: docker exec unity dotnet build -c Release -v:d + run: dotnet build -c Release -v:d - name: Install assemblyalias - run: docker exec unity dotnet tool install --global Sentry.AssemblyAlias --version 0.5.0 --allow-roll-forward + run: dotnet tool install --global Sentry.AssemblyAlias --version 0.5.0 --allow-roll-forward - name: Alias assemblies - run: docker exec unity pwsh scripts/alias-assemblies.ps1 -AssemblyAlias /home/gh/.dotnet/tools/assemblyalias + run: ./scripts/alias-assemblies.ps1 -AssemblyAlias "$HOME/.dotnet/tools/assemblyalias" - name: Package for release run: | - docker exec unity dotnet msbuild /t:UnityConfigureSentryOptions /p:Configuration=Release /p:OutDir=other src/Sentry.Unity + dotnet msbuild /t:UnityConfigureSentryOptions /p:Configuration=Release /p:OutDir=other src/Sentry.Unity ./scripts/pack.ps1 - name: Upload release artifacts @@ -148,7 +142,7 @@ jobs: package-release.zip - name: Build DependencyConflict package - run: docker exec unity dotnet build test/Scripts.Integration.Test/DependencyConflictPackage + run: dotnet build test/Scripts.Integration.Test/DependencyConflictPackage - name: Upload DependencyConflict package uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 @@ -158,16 +152,16 @@ jobs: path: test/Scripts.Integration.Test/DependencyConflictPackage/DependencyConflict - name: Run Unity tests (playmode) - run: docker exec unity dotnet msbuild /t:UnityPlayModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Tests + run: dotnet msbuild /t:UnityPlayModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Tests - name: Run Unity tests (editmode) - run: docker exec unity dotnet msbuild /t:UnityEditModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Editor.Tests + run: dotnet msbuild /t:UnityEditModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Editor.Tests - name: Publish Test Results uses: dorny/test-reporter@a6ddd83ac95ff4586f5d3aceeb314d9a1841db95 # v3.0.0 if: ${{ !cancelled() }} with: - name: Unity Test Results - ${{ env.UNITY_VERSION }} + name: Unity Test Results - ${{ inputs.unity-version }} path: artifacts/test/**/*.xml reporter: dotnet-nunit fail-on-error: false @@ -175,11 +169,11 @@ jobs: - name: Upload test artifacts (playmode) uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: Test results (playmode) - ${{ env.UNITY_VERSION }} + name: Test results (playmode) - ${{ inputs.unity-version }} path: artifacts/test/playmode - name: Upload test artifacts (editmode) uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: Test results (editmode) - ${{ env.UNITY_VERSION }} + name: Test results (editmode) - ${{ inputs.unity-version }} path: artifacts/test/editmode diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad148a4aa..7b06f9c34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -130,7 +130,7 @@ jobs: with: unity-version: ${{ matrix.unity-version }} - # A Linux, docker-based build to prepare a WebGL player. The tests run in `test-run-webgl`. + # A Linux build to prepare a WebGL player. The tests run in `test-run-webgl`. test-build-webgl: name: Build ${{ matrix.platform }} ${{ matrix.unity-version }} Test if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} @@ -144,8 +144,6 @@ jobs: include: - platform: WebGL build_platform: WebGL - env: - UNITY_PATH: docker exec unity unity-editor steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -160,22 +158,12 @@ jobs: docker-images: false swap-storage: true - - name: Docker Login - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + - name: Setup Unity + uses: ./.github/actions/setup-unity with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Start the Unity docker container - run: ./scripts/ci-docker.sh "$UNITY_VERSION" "$PLATFORM_WITH_SUFFIX" "$UNITY_LICENSE_SERVER_CONFIG" - shell: bash - env: - UNITY_VERSION: ${{ matrix.unity-version }} - PLATFORM: ${{ matrix.platform }} - IMAGE_SUFFIX: ${{ matrix.image-suffix }} - PLATFORM_WITH_SUFFIX: ${{ matrix.platform }}${{ matrix.image-suffix }} - UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + unity-version: ${{ matrix.unity-version }} + modules: webgl + license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/test-build-android.yml b/.github/workflows/test-build-android.yml index 1524018ed..b636545c1 100644 --- a/.github/workflows/test-build-android.yml +++ b/.github/workflows/test-build-android.yml @@ -22,27 +22,18 @@ jobs: name: ${{ inputs.unity-version }} runs-on: ubuntu-latest-4-cores env: - GITHUB_ACTOR: ${{ github.actor }} - UNITY_PATH: docker exec unity unity-editor UNITY_VERSION: ${{ inputs.unity-version }} steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Docker Login - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + - name: Setup Unity + uses: ./.github/actions/setup-unity with: - registry: ghcr.io - username: ${{ env.GITHUB_ACTOR }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Start the Unity docker container - run: ./scripts/ci-docker.sh "$UNITY_VERSION" 'android' "$UNITY_LICENSE_SERVER_CONFIG" - shell: bash - env: - UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + unity-version: ${{ inputs.unity-version }} + modules: android + license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 @@ -105,6 +96,8 @@ jobs: - name: Export APK - Runtime Initialization run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -UnityVersion "$env:UNITY_VERSION" + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Assert symbols and sources were uploaded (Runtime) run: ./test/Scripts.Integration.Test/assert-symbol-upload.ps1 -LogPath samples/IntegrationTest/Logs/sentry-symbols-upload.log @@ -144,6 +137,8 @@ jobs: - name: Export APK - Build-Time Initialization run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -UnityVersion "$env:UNITY_VERSION" + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Assert symbols and sources were uploaded (Build-Time) run: ./test/Scripts.Integration.Test/assert-symbol-upload.ps1 -LogPath samples/IntegrationTest/Logs/sentry-symbols-upload.log diff --git a/.github/workflows/test-build-ios.yml b/.github/workflows/test-build-ios.yml index 118bb4c06..0f307004a 100644 --- a/.github/workflows/test-build-ios.yml +++ b/.github/workflows/test-build-ios.yml @@ -28,27 +28,18 @@ jobs: check_symbols: false build_platform: iOS env: - GITHUB_ACTOR: ${{ github.actor }} - UNITY_PATH: docker exec unity unity-editor UNITY_VERSION: ${{ inputs.unity-version }} steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Docker Login - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + - name: Setup Unity + uses: ./.github/actions/setup-unity with: - registry: ghcr.io - username: ${{ env.GITHUB_ACTOR }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Start the Unity docker container - run: ./scripts/ci-docker.sh "$UNITY_VERSION" "iOS" "$UNITY_LICENSE_SERVER_CONFIG" - shell: bash - env: - UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + unity-version: ${{ inputs.unity-version }} + modules: ios + license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 @@ -127,6 +118,7 @@ jobs: run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -UnityVersion "$env:UNITY_VERSION" env: BUILD_PLATFORM: ${{ matrix.build_platform }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} # We create tar explicitly because upload-artifact is slow for many files. - name: Create archive (runtime initialization) @@ -155,6 +147,7 @@ jobs: run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -UnityVersion "$env:UNITY_VERSION" env: BUILD_PLATFORM: ${{ matrix.build_platform }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Create archive (build-time initialization) run: | diff --git a/.github/workflows/test-build-linux.yml b/.github/workflows/test-build-linux.yml index 1f2b2309d..6e758c2f4 100644 --- a/.github/workflows/test-build-linux.yml +++ b/.github/workflows/test-build-linux.yml @@ -22,8 +22,6 @@ jobs: name: Linux ${{ inputs.unity-version }} runs-on: ubuntu-24.04 env: - GITHUB_ACTOR: ${{ github.actor }} - UNITY_PATH: docker exec unity unity-editor UNITY_VERSION: ${{ inputs.unity-version }} BUILD_PLATFORM: Linux @@ -41,19 +39,12 @@ jobs: docker-images: false swap-storage: true - - name: Log into Docker - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + - name: Setup Unity + uses: ./.github/actions/setup-unity with: - registry: ghcr.io - username: ${{ env.GITHUB_ACTOR }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Start the Unity docker container - run: ./scripts/ci-docker.sh "$UNITY_VERSION" "Linux-il2cpp" "$UNITY_LICENSE_SERVER_CONFIG" - shell: bash - env: - UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + unity-version: ${{ inputs.unity-version }} + modules: linux-il2cpp + license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 @@ -116,6 +107,8 @@ jobs: - name: Build with Sentry SDK (Breakpad backend) run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -UnityVersion "$env:UNITY_VERSION" + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Assert symbols and sources were uploaded (Breakpad backend) run: ./test/Scripts.Integration.Test/assert-symbol-upload.ps1 -LogPath unity.log @@ -154,6 +147,8 @@ jobs: - name: Build with Sentry SDK (Native backend) run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -UnityVersion "$env:UNITY_VERSION" + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Assert symbols and sources were uploaded (Native backend) run: ./test/Scripts.Integration.Test/assert-symbol-upload.ps1 -LogPath unity.log @@ -180,19 +175,6 @@ jobs: path: samples/IntegrationTest/Library key: it-library-ubuntu-${{ env.UNITY_VERSION }}-${{ github.run_id }} - - name: Docker diagnostics on failure - if: ${{ failure() }} - run: | - Write-Host "=== Docker container status ===" - docker ps -a --filter "name=^/unity$" - - Write-Host "`n=== Working directory ===" - docker exec unity pwd - - Write-Host "`n=== Unity log from container ===" - docker exec unity cat /sentry-unity/unity.log 2>&1 || echo "unity.log not found" - continue-on-error: true - - name: Upload IntegrationTest project on failure if: ${{ failure() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 diff --git a/.github/workflows/test-build-macos.yml b/.github/workflows/test-build-macos.yml index 318f71bd5..55fbc3c18 100644 --- a/.github/workflows/test-build-macos.yml +++ b/.github/workflows/test-build-macos.yml @@ -29,26 +29,12 @@ jobs: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Load env - id: env - run: | - $u = (Get-Content scripts/unity-versions.json -Raw | ConvertFrom-Json).'${{ env.UNITY_VERSION }}' - "unityVersion=$($u.version)" >> $env:GITHUB_OUTPUT - "unityChangeset=$($u.changeset)" >> $env:GITHUB_OUTPUT - - name: Setup Unity - uses: getsentry/setup-unity@61c0c0944851685b6c1225e940d1b1ab349e3aa3 + uses: ./.github/actions/setup-unity with: - unity-version: ${{ steps.env.outputs.unityVersion }} - unity-version-changeset: ${{ steps.env.outputs.unityChangeset }} - unity-modules: mac-il2cpp - - - name: Create Unity license config - run: | - sudo mkdir -p "/Library/Application Support/Unity/config" - echo "$env:UNITY_LICENSE_SERVER_CONFIG" | sudo tee "/Library/Application Support/Unity/config/services-config.json" > /dev/null - env: - UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + unity-version: ${{ inputs.unity-version }} + modules: mac-il2cpp + license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/test-build-windows-mono.yml b/.github/workflows/test-build-windows-mono.yml index 2fad1218c..bce6c2443 100644 --- a/.github/workflows/test-build-windows-mono.yml +++ b/.github/workflows/test-build-windows-mono.yml @@ -29,26 +29,12 @@ jobs: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Load env - id: env - run: | - $u = (Get-Content scripts/unity-versions.json -Raw | ConvertFrom-Json).'${{ env.UNITY_VERSION }}' - "unityVersion=$($u.version)" >> $env:GITHUB_OUTPUT - "unityChangeset=$($u.changeset)" >> $env:GITHUB_OUTPUT - - name: Setup Unity - uses: getsentry/setup-unity@61c0c0944851685b6c1225e940d1b1ab349e3aa3 + uses: ./.github/actions/setup-unity with: - unity-version: ${{ steps.env.outputs.unityVersion }} - unity-version-changeset: ${{ steps.env.outputs.unityChangeset }} - unity-modules: windows-il2cpp - - - name: Create Unity license config - run: | - New-Item -Path "C:/ProgramData/Unity/config/" -ItemType Directory -Force - Set-Content -Path "C:/ProgramData/Unity/config/services-config.json" -Value "$env:UNITY_LICENSE_SERVER_CONFIG" - env: - UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + unity-version: ${{ inputs.unity-version }} + modules: windows-il2cpp + license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/test-build-windows-x86.yml b/.github/workflows/test-build-windows-x86.yml index fac318d77..a5aa4ffa8 100644 --- a/.github/workflows/test-build-windows-x86.yml +++ b/.github/workflows/test-build-windows-x86.yml @@ -29,26 +29,12 @@ jobs: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Load env - id: env - run: | - $u = (Get-Content scripts/unity-versions.json -Raw | ConvertFrom-Json).'${{ env.UNITY_VERSION }}' - "unityVersion=$($u.version)" >> $env:GITHUB_OUTPUT - "unityChangeset=$($u.changeset)" >> $env:GITHUB_OUTPUT - - name: Setup Unity - uses: getsentry/setup-unity@61c0c0944851685b6c1225e940d1b1ab349e3aa3 + uses: ./.github/actions/setup-unity with: - unity-version: ${{ steps.env.outputs.unityVersion }} - unity-version-changeset: ${{ steps.env.outputs.unityChangeset }} - unity-modules: windows-il2cpp - - - name: Create Unity license config - run: | - New-Item -Path "C:/ProgramData/Unity/config/" -ItemType Directory -Force - Set-Content -Path "C:/ProgramData/Unity/config/services-config.json" -Value "$env:UNITY_LICENSE_SERVER_CONFIG" - env: - UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + unity-version: ${{ inputs.unity-version }} + modules: windows-il2cpp + license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/test-build-windows.yml b/.github/workflows/test-build-windows.yml index 89dedc474..793a8a826 100644 --- a/.github/workflows/test-build-windows.yml +++ b/.github/workflows/test-build-windows.yml @@ -29,26 +29,12 @@ jobs: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Load env - id: env - run: | - $u = (Get-Content scripts/unity-versions.json -Raw | ConvertFrom-Json).'${{ env.UNITY_VERSION }}' - "unityVersion=$($u.version)" >> $env:GITHUB_OUTPUT - "unityChangeset=$($u.changeset)" >> $env:GITHUB_OUTPUT - - name: Setup Unity - uses: getsentry/setup-unity@61c0c0944851685b6c1225e940d1b1ab349e3aa3 + uses: ./.github/actions/setup-unity with: - unity-version: ${{ steps.env.outputs.unityVersion }} - unity-version-changeset: ${{ steps.env.outputs.unityChangeset }} - unity-modules: windows-il2cpp - - - name: Create Unity license config - run: | - New-Item -Path "C:/ProgramData/Unity/config/" -ItemType Directory -Force - Set-Content -Path "C:/ProgramData/Unity/config/services-config.json" -Value "$env:UNITY_LICENSE_SERVER_CONFIG" - env: - UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + unity-version: ${{ inputs.unity-version }} + modules: windows-il2cpp + license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/test-create.yml b/.github/workflows/test-create.yml index 33ce665b8..f6aff7f29 100644 --- a/.github/workflows/test-create.yml +++ b/.github/workflows/test-create.yml @@ -18,21 +18,12 @@ jobs: name: ${{ inputs.unity-version }} runs-on: ubuntu-24.04 env: - GITHUB_ACTOR: ${{ github.actor }} - UNITY_PATH: docker exec unity unity-editor UNITY_VERSION: ${{ inputs.unity-version }} steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Docker Login - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 - with: - registry: ghcr.io - username: ${{ env.GITHUB_ACTOR }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Restore IntegrationTest Project cache id: cache-project uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 @@ -42,12 +33,12 @@ jobs: restore-keys: | IntegrationTest-Project-${{ env.UNITY_VERSION }}- - - name: Start the Unity docker container + - name: Setup Unity if: steps.cache-project.outputs.cache-hit != 'true' - run: ./scripts/ci-docker.sh "$UNITY_VERSION" 'base' "$UNITY_LICENSE_SERVER_CONFIG" - shell: bash - env: - UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + uses: ./.github/actions/setup-unity + with: + unity-version: ${{ inputs.unity-version }} + license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Create new Project if: steps.cache-project.outputs.cache-hit != 'true' diff --git a/docs/agent-guides/ci.md b/docs/agent-guides/ci.md index 09e5e6ad2..0300f9c24 100644 --- a/docs/agent-guides/ci.md +++ b/docs/agent-guides/ci.md @@ -22,9 +22,9 @@ Exact Unity editor versions and changesets live in `scripts/unity-versions.json` `build.yml`: 1. Checks out `src/sentry-dotnet`. -2. Starts a `unityci/editor` Docker image. +2. Installs the Unity Editor via `.github/actions/setup-unity` (Unity CLI). 3. Restores .NET workloads and downloads native CI artifacts. -4. Runs `dotnet build -c Release -v:d` in the container. +4. Runs `dotnet build -c Release -v:d`. 5. Installs `Sentry.AssemblyAlias` and runs `scripts/alias-assemblies.ps1`. 6. Runs `scripts/pack.ps1` and uploads `package-release`. 7. Builds/uploads the DependencyConflict fixture. diff --git a/scripts/alias-assemblies.ps1 b/scripts/alias-assemblies.ps1 index 0a729ad02..9b2e42fc2 100644 --- a/scripts/alias-assemblies.ps1 +++ b/scripts/alias-assemblies.ps1 @@ -1,13 +1,12 @@ # Single source of truth for the assembly-aliasing invocation. Used by the local -# release script (repack.ps1) and by CI (build.yml, which runs it inside the Unity -# docker container). +# release script (repack.ps1) and by CI (build.yml). # param( # Pass an empty string to skip either target. [string]$RuntimeDir = "package-dev/Runtime", [string]$EditorDir = "package-dev/Editor", # assemblyalias is on PATH for local host builds; CI runs it from the dotnet - # global tools path inside the container (/home/gh/.dotnet/tools/assemblyalias). + # global tools path (~/.dotnet/tools/assemblyalias). [string]$AssemblyAlias = "assemblyalias" ) diff --git a/scripts/ci-docker.sh b/scripts/ci-docker.sh deleted file mode 100755 index 769647a88..000000000 --- a/scripts/ci-docker.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -unityPrefix="$1" -unityVersion=$(jq -r --arg p "$unityPrefix" '.[$p].version' ./scripts/unity-versions.json) -imageVariant=$(echo "$2" | tr '[:upper:]' '[:lower:]') -licenseConfig=$3 - -container="unity" -image="unityci/editor:ubuntu-$unityVersion-$imageVariant-3" -cwd="${GITHUB_WORKSPACE:-$(pwd)}" -user="gh" -uid=$(id -u) -gid=$(id -g) - -# Local fallbacks for testing -ANDROID_HOME=${ANDROID_HOME:-/android-home-missing} -JAVA_HOME_11_X64=${JAVA_HOME_11_X64:-/java-home-missing} - -if [[ $(docker ps --filter "name=^/$container$" --format '{{.Names}}') == "$container" ]]; then - echo "Removing existing container '$container'" - docker stop $container - docker rm $container -fi - -echo "Starting up '$image' as '$container'" -suexec="docker exec --user root" - -# Format: -- -uniqueHostname="${GITHUB_JOB:-local}-${imageVariant}-${GITHUB_RUN_ID:-0}" -# Sanitize hostname: replace underscores and spaces with hyphens, ensure lowercase -uniqueHostname=$(echo "$uniqueHostname" | tr '[:upper:]_ ' '[:lower:]--' | tr -s '-') - -# We use the host dotnet installation - it's much faster than installing inside the docker container. -set -x -docker run -td --name $container \ - --hostname $uniqueHostname \ - --user $uid:$gid \ - --shm-size=2g \ - -v "$cwd":/sentry-unity \ - -v $ANDROID_HOME:$ANDROID_HOME \ - -v $JAVA_HOME_11_X64:$JAVA_HOME_11_X64 \ - -v /usr/share/dotnet:/usr/share/dotnet \ - -v /opt/microsoft/powershell/7:/opt/microsoft/powershell/7 \ - -e UNITY_VERSION=$unityVersion \ - -e GITHUB_ACTIONS="${GITHUB_ACTIONS}" \ - -e SENTRY_AUTH_TOKEN="${SENTRY_AUTH_TOKEN:-}" \ - --workdir /sentry-unity $image - -# Generate unique machine-id to avoid any hardcoded values and license-fetch congestion -$suexec $container rm -f /etc/machine-id -$suexec $container dbus-uuidgen --ensure=/etc/machine-id - -$suexec $container groupadd -g $gid $user -$suexec $container useradd -u $uid -g $gid --create-home $user - -$suexec $container ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet -$suexec $container ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh - -$suexec $container mkdir -p /usr/share/unity3d/config/ -echo $licenseConfig | $suexec -i $container sh -c "cat > /usr/share/unity3d/config/services-config.json" -$suexec $container chown -R $uid /usr/share/unity3d/config/ - -# Unity 2021+ tries to write to this directory during asset import... -$suexec $container chmod -R 755 /opt/unity/Editor/Data/UnityReferenceAssemblies/ - -echo "Container started successfully: " -docker ps --filter "name=^/$container$" diff --git a/scripts/find-unity.ps1 b/scripts/find-unity.ps1 index 51409619f..94f14b295 100644 --- a/scripts/find-unity.ps1 +++ b/scripts/find-unity.ps1 @@ -61,7 +61,7 @@ $rootName = if ($IsMacOS) { 'Unity.app' } else { 'Editor' } # Each "install" candidate is a directory like // that contains # either Editor/ (win/linux) or Unity.app/ (mac). $installs = [System.Collections.Generic.List[string]]::new() -if ($IsLinux -and $env:UNITY_PATH) { $installs.Add($env:UNITY_PATH) } +if ($IsLinux -and $env:UNITY_PATH) { $installs.Add((Split-Path (Split-Path $env:UNITY_PATH))) } if ($HubInstallDir -and $UnityVersion) { $installs.Add((Join-Path $HubInstallDir $UnityVersion)) } if ($HubInstallDir -and $HubDefaultEditor -and $UnityVersion -ne $HubDefaultEditor) { $installs.Add((Join-Path $HubInstallDir $HubDefaultEditor)) diff --git a/scripts/unity-utils.ps1 b/scripts/unity-utils.ps1 index 742ad74b1..cf90430f7 100644 --- a/scripts/unity-utils.ps1 +++ b/scripts/unity-utils.ps1 @@ -4,21 +4,7 @@ $ClearUnityLogTimeoutSeconds = 30 function RunUnity([string] $unityPath, [string[]] $arguments, [switch] $ReturnLogOutput) { - If ($unityPath.StartsWith("docker ")) - { - # Move docker arguments from $unityPath to $arguments, leaving "docker" as $unityPath - $arguments = ($unityPath.Split(" ") | Select-Object -Skip 1) + $arguments - $unityPath = "docker" - } - - If ($unityPath -eq "docker") - { - # Remove "-batchmode" which ends up being duplicate because the referenced unity-editor script already adds it - Write-Host "Removing argument '-batchmode' - it would be duplicate and cause a build to fail" - $arguments = $arguments | Where-Object { $_ –ne "-batchmode" } - Write-Host "Updated arguments: $arguments" - } - ElseIf ($IsLinux -and "$env:XDG_CURRENT_DESKTOP" -eq "" -and $unityPath -ne "xvfb-run") + If ($IsLinux -and "$env:XDG_CURRENT_DESKTOP" -eq "" -and $unityPath -ne "xvfb-run") { $arguments = @("-ae", "/dev/stdout", "$unityPath") + $arguments $unityPath = "xvfb-run" diff --git a/test/Scripts.Integration.Test/add-sentry.ps1 b/test/Scripts.Integration.Test/add-sentry.ps1 index 926ba9ac0..faf0c68ba 100644 --- a/test/Scripts.Integration.Test/add-sentry.ps1 +++ b/test/Scripts.Integration.Test/add-sentry.ps1 @@ -13,7 +13,6 @@ if (-not $Global:NewProjectPathCache) $UnityPath = FormatUnityPath $UnityPath # Convert relative paths to absolute (relative to ProjectRoot) -# This ensures the path works both locally and in Docker (where RunUnityCustom handles path translation) if (-not [System.IO.Path]::IsPathRooted($PackagePath)) { $PackagePath = "$(ProjectRoot)/$PackagePath" diff --git a/test/Scripts.Integration.Test/build-project.ps1 b/test/Scripts.Integration.Test/build-project.ps1 index 01a0e5902..1a10d91cd 100644 --- a/test/Scripts.Integration.Test/build-project.ps1 +++ b/test/Scripts.Integration.Test/build-project.ps1 @@ -26,7 +26,7 @@ if ($Platform -eq "Switch") $unityArgs += @("-buildTarget", "Switch") } -RunUnityCustom $unityPath $unityArgs +RunUnity $unityPath $unityArgs if ($Platform -eq "Android-Export") { diff --git a/test/Scripts.Integration.Test/common.ps1 b/test/Scripts.Integration.Test/common.ps1 index d9865ef9d..0c4025ae5 100644 --- a/test/Scripts.Integration.Test/common.ps1 +++ b/test/Scripts.Integration.Test/common.ps1 @@ -75,7 +75,7 @@ function Write-PhaseFailed function RunUnityAndExpect([string] $UnityPath, [string] $name, [string] $successMessage, [string[]] $arguments) { - $stdout = RunUnityCustom $UnityPath $arguments -ReturnLogOutput + $stdout = RunUnity $UnityPath $arguments -ReturnLogOutput $lineWithSuccess = $stdout | Select-String $successMessage If ($null -ne $lineWithSuccess) { diff --git a/test/Scripts.Integration.Test/create-project.ps1 b/test/Scripts.Integration.Test/create-project.ps1 index 6bafe4f60..c198dcbbb 100644 --- a/test/Scripts.Integration.Test/create-project.ps1 +++ b/test/Scripts.Integration.Test/create-project.ps1 @@ -24,7 +24,7 @@ New-Item -Path "$(ProjectRoot)/samples" -Name $(GetNewProjectName) -ItemType "di Write-Detail "Directory created" Write-Log "Creating integration project..." -RunUnityCustom $UnityPath @("-batchmode", "-createProject", "$(GetNewProjectPath)", "-quit") +RunUnity $UnityPath @("-batchmode", "-createProject", "$(GetNewProjectPath)", "-quit") Write-Log "Copying Editor scripts to integration project..." New-Item -Path "$(GetNewProjectAssetsPath)" -Name "Editor" -ItemType "directory" | Out-Null diff --git a/test/Scripts.Integration.Test/globals.ps1 b/test/Scripts.Integration.Test/globals.ps1 index 275438f5d..2b23b84e0 100644 --- a/test/Scripts.Integration.Test/globals.ps1 +++ b/test/Scripts.Integration.Test/globals.ps1 @@ -107,10 +107,7 @@ function FormatUnityPath Throw "Unity path is required." } - If ($unityPath.StartsWith("docker ")) - { - } - ElseIf ($IsMacOS) + If ($IsMacOS) { If (-not $unityPath.EndsWith("Contents/MacOS/Unity")) { @@ -179,15 +176,3 @@ function BuildMethodFor([string] $platform) Default { Throw "Unsupported build platform: '$platform'" } } } - -function RunUnityCustom([string] $unityPath, [string[]] $arguments, [switch] $ReturnLogOutput) -{ - If ($unityPath.StartsWith("docker ")) - { - # Fix paths (they're supposed to be the current working directory in the docker container) - Write-Detail "Replacing project root ($(ProjectRoot)) in docker arguments" - $arguments = $arguments | ForEach-Object { $_.Replace("$(ProjectRoot)", "/sentry-unity") } - } - - return RunUnity $unityPath $arguments -ReturnLogOutput:$ReturnLogOutput -} From 64450b4f4226c1324f01b7873b09c2bea2621c43 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 21 Oct 2026 22:10:01 +0200 Subject: [PATCH 08/20] Replace setup-unity action with a repo script and pin Android build to ubuntu-24.04 --- .github/actions/setup-unity/action.yml | 28 ------------------- .github/workflows/build.yml | 8 ++---- .github/workflows/ci.yml | 8 ++---- .github/workflows/test-build-android.yml | 20 +++++++++---- .github/workflows/test-build-ios.yml | 8 ++---- .github/workflows/test-build-linux.yml | 8 ++---- .github/workflows/test-build-macos.yml | 8 ++---- .github/workflows/test-build-windows-mono.yml | 8 ++---- .github/workflows/test-build-windows-x86.yml | 8 ++---- .github/workflows/test-build-windows.yml | 8 ++---- .github/workflows/test-create.yml | 7 ++--- docs/agent-guides/ci.md | 2 +- .../setup-unity => scripts}/setup-unity.ps1 | 2 +- 13 files changed, 43 insertions(+), 80 deletions(-) delete mode 100644 .github/actions/setup-unity/action.yml rename {.github/actions/setup-unity => scripts}/setup-unity.ps1 (97%) diff --git a/.github/actions/setup-unity/action.yml b/.github/actions/setup-unity/action.yml deleted file mode 100644 index 580f89433..000000000 --- a/.github/actions/setup-unity/action.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: 'Setup Unity' -description: 'Installs a Unity Editor and modules with the Unity CLI and configures the license server.' -inputs: - unity-version: - description: 'Unity version key in scripts/unity-versions.json, e.g. 2021.3' - required: true - modules: - description: 'Space-separated Unity module IDs, e.g. android. Child modules are included.' - required: false - default: '' - license-server-config: - description: 'Contents of the Unity license server services-config.json' - required: true -outputs: - unity-version: - description: 'Installed Unity Editor version, e.g. 2021.3.45f2' - value: ${{ steps.setup.outputs.unity-version }} - -runs: - using: composite - steps: - - id: setup - env: - UNITY_VERSION_KEY: ${{ inputs.unity-version }} - UNITY_MODULES: ${{ inputs.modules }} - UNITY_LICENSE_SERVER_CONFIG: ${{ inputs.license-server-config }} - shell: pwsh - run: '& "$env:GITHUB_ACTION_PATH/setup-unity.ps1" -UnityVersion $env:UNITY_VERSION_KEY -Modules $env:UNITY_MODULES' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7a4bc77cd..1a823b10e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -59,11 +59,9 @@ jobs: Library-unity-of-bugs-${{ steps.env.outputs.unityVersion }}- - name: Setup Unity - uses: ./.github/actions/setup-unity - with: - unity-version: ${{ inputs.unity-version }} - modules: ios - license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules ios + env: + UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Install .NET SDK if: runner.os != 'Windows' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b06f9c34..075eeae3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -159,11 +159,9 @@ jobs: swap-storage: true - name: Setup Unity - uses: ./.github/actions/setup-unity - with: - unity-version: ${{ matrix.unity-version }} - modules: webgl - license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + run: ./scripts/setup-unity.ps1 -UnityVersion "${{ matrix.unity-version }}" -Modules webgl + env: + UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/test-build-android.yml b/.github/workflows/test-build-android.yml index b636545c1..dc8738a36 100644 --- a/.github/workflows/test-build-android.yml +++ b/.github/workflows/test-build-android.yml @@ -20,7 +20,7 @@ defaults: jobs: build: name: ${{ inputs.unity-version }} - runs-on: ubuntu-latest-4-cores + runs-on: ubuntu-24.04 env: UNITY_VERSION: ${{ inputs.unity-version }} @@ -28,12 +28,20 @@ jobs: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Setup Unity - uses: ./.github/actions/setup-unity + - name: Free Disk Space + uses: jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8 # v1.3.0 with: - unity-version: ${{ inputs.unity-version }} - modules: android - license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + android: true + dotnet: false + haskell: true + large-packages: false + docker-images: false + swap-storage: true + + - name: Setup Unity + run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules android + env: + UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/test-build-ios.yml b/.github/workflows/test-build-ios.yml index 0f307004a..aeae40680 100644 --- a/.github/workflows/test-build-ios.yml +++ b/.github/workflows/test-build-ios.yml @@ -35,11 +35,9 @@ jobs: uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup Unity - uses: ./.github/actions/setup-unity - with: - unity-version: ${{ inputs.unity-version }} - modules: ios - license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules ios + env: + UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/test-build-linux.yml b/.github/workflows/test-build-linux.yml index 6e758c2f4..c83cace2a 100644 --- a/.github/workflows/test-build-linux.yml +++ b/.github/workflows/test-build-linux.yml @@ -40,11 +40,9 @@ jobs: swap-storage: true - name: Setup Unity - uses: ./.github/actions/setup-unity - with: - unity-version: ${{ inputs.unity-version }} - modules: linux-il2cpp - license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules linux-il2cpp + env: + UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/test-build-macos.yml b/.github/workflows/test-build-macos.yml index 55fbc3c18..2ce2bfd49 100644 --- a/.github/workflows/test-build-macos.yml +++ b/.github/workflows/test-build-macos.yml @@ -30,11 +30,9 @@ jobs: uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup Unity - uses: ./.github/actions/setup-unity - with: - unity-version: ${{ inputs.unity-version }} - modules: mac-il2cpp - license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules mac-il2cpp + env: + UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/test-build-windows-mono.yml b/.github/workflows/test-build-windows-mono.yml index bce6c2443..6a40abce9 100644 --- a/.github/workflows/test-build-windows-mono.yml +++ b/.github/workflows/test-build-windows-mono.yml @@ -30,11 +30,9 @@ jobs: uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup Unity - uses: ./.github/actions/setup-unity - with: - unity-version: ${{ inputs.unity-version }} - modules: windows-il2cpp - license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules windows-il2cpp + env: + UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/test-build-windows-x86.yml b/.github/workflows/test-build-windows-x86.yml index a5aa4ffa8..94513f524 100644 --- a/.github/workflows/test-build-windows-x86.yml +++ b/.github/workflows/test-build-windows-x86.yml @@ -30,11 +30,9 @@ jobs: uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup Unity - uses: ./.github/actions/setup-unity - with: - unity-version: ${{ inputs.unity-version }} - modules: windows-il2cpp - license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules windows-il2cpp + env: + UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/test-build-windows.yml b/.github/workflows/test-build-windows.yml index 793a8a826..611816ae9 100644 --- a/.github/workflows/test-build-windows.yml +++ b/.github/workflows/test-build-windows.yml @@ -30,11 +30,9 @@ jobs: uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup Unity - uses: ./.github/actions/setup-unity - with: - unity-version: ${{ inputs.unity-version }} - modules: windows-il2cpp - license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules windows-il2cpp + env: + UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/test-create.yml b/.github/workflows/test-create.yml index f6aff7f29..bd333bcb7 100644 --- a/.github/workflows/test-create.yml +++ b/.github/workflows/test-create.yml @@ -35,10 +35,9 @@ jobs: - name: Setup Unity if: steps.cache-project.outputs.cache-hit != 'true' - uses: ./.github/actions/setup-unity - with: - unity-version: ${{ inputs.unity-version }} - license-server-config: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" + env: + UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Create new Project if: steps.cache-project.outputs.cache-hit != 'true' diff --git a/docs/agent-guides/ci.md b/docs/agent-guides/ci.md index 0300f9c24..92dfeb9f9 100644 --- a/docs/agent-guides/ci.md +++ b/docs/agent-guides/ci.md @@ -22,7 +22,7 @@ Exact Unity editor versions and changesets live in `scripts/unity-versions.json` `build.yml`: 1. Checks out `src/sentry-dotnet`. -2. Installs the Unity Editor via `.github/actions/setup-unity` (Unity CLI). +2. Installs the Unity Editor via `scripts/setup-unity.ps1` (Unity CLI). 3. Restores .NET workloads and downloads native CI artifacts. 4. Runs `dotnet build -c Release -v:d`. 5. Installs `Sentry.AssemblyAlias` and runs `scripts/alias-assemblies.ps1`. diff --git a/.github/actions/setup-unity/setup-unity.ps1 b/scripts/setup-unity.ps1 similarity index 97% rename from .github/actions/setup-unity/setup-unity.ps1 rename to scripts/setup-unity.ps1 index 84f4a3b04..eaa5c9a3b 100644 --- a/.github/actions/setup-unity/setup-unity.ps1 +++ b/scripts/setup-unity.ps1 @@ -13,7 +13,7 @@ $CliBinaries = @{ 'win32-x64' = @('unity-windows-x64.exe', '78761a0547cd4a9bc212e27a217c66e6a621bf48c753ba440e4b2327ee7ff8ac') } -$unity = (Get-Content "$PSScriptRoot/../../../scripts/unity-versions.json" -Raw | ConvertFrom-Json).$UnityVersion +$unity = (Get-Content "$PSScriptRoot/unity-versions.json" -Raw | ConvertFrom-Json).$UnityVersion if (-not $unity) { throw "Unity version '$UnityVersion' not found in scripts/unity-versions.json" } $moduleList = -split $Modules From 639aa84722ac22250a48480709e729ddae0ab825 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 22 Oct 2026 09:45:01 +0200 Subject: [PATCH 09/20] Temporary: diagnose bee_backend hang on 2021.3 --- .github/workflows/test-create.yml | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/test-create.yml b/.github/workflows/test-create.yml index bd333bcb7..115d00b81 100644 --- a/.github/workflows/test-create.yml +++ b/.github/workflows/test-create.yml @@ -41,8 +41,42 @@ jobs: - name: Create new Project if: steps.cache-project.outputs.cache-hit != 'true' + timeout-minutes: 20 run: ./test/Scripts.Integration.Test/create-project.ps1 -UnityPath "$env:UNITY_PATH" + - name: "Temporary: diagnose bee_backend hang" + if: failure() + shell: bash + run: | + sudo apt-get install -y -q strace >/dev/null + echo "=== process tree" + ps -eo pid,ppid,pgid,stat,wchan:32,etime,args --forest | grep -vE '\[.*\]$' | cut -c1-300 + for name in Unity bee_backend; do + for pid in $(pgrep -x "$name"); do + echo "=== $name $pid" + echo "--- fds"; sudo ls -l /proc/$pid/fd | cut -c40- + echo "--- threads (comm wchan)" + for t in /proc/$pid/task/*; do echo "$(basename $t) $(cat $t/comm) $(sudo cat $t/wchan)"; done + echo "--- kernel stacks" + for t in /proc/$pid/task/*; do echo "# $(basename $t)"; sudo cat $t/stack; done + done + done + for pid in $(pgrep -x bee_backend); do + echo "=== strace bee_backend $pid (15s)" + sudo timeout 15 strace -f -tt -p $pid 2>&1 | head -200 + done + echo "=== Library/Bee" + ls -la samples/IntegrationTest/Library/Bee 2>&1 | head -40 + tail -c 4000 samples/IntegrationTest/Library/Bee/backend_profiler*.traceevents 2>&1 + + echo "=== retry with stdin from /dev/null" + pkill -9 -x bee_backend; pkill -9 -x Unity; pkill -9 -f Xvfb; sleep 5 + set +e + timeout 1200 xvfb-run -ae /dev/stdout "$UNITY_PATH" -batchmode -createProject "$RUNNER_TEMP/StdinTest" -quit -logFile - < /dev/null > stdin-test.log 2>&1 + echo "retry exit code: $? (124 = timed out)" + grep -nE 'bee_backend|ExitCode|Exiting|Application will terminate' stdin-test.log | tail -20 + continue-on-error: true + - name: Save IntegrationTest Project cache if: github.ref == 'refs/heads/main' && steps.cache-project.outputs.cache-hit != 'true' uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 From d6cc17d1ab24f40af4c9eb48a5a5a333c70b67ba Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 22 Oct 2026 10:45:26 +0200 Subject: [PATCH 10/20] Strip bee_backend's stdin canary on Linux for Unity 2021 --- scripts/setup-unity.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/setup-unity.ps1 b/scripts/setup-unity.ps1 index eaa5c9a3b..b70debd39 100644 --- a/scripts/setup-unity.ps1 +++ b/scripts/setup-unity.ps1 @@ -56,6 +56,22 @@ $unityPath = @($location, "$location/Contents/MacOS/Unity", "$location/Unity.exe if (-not $unityPath) { throw "Unity executable not found at $location" } Write-Host "Unity $($unity.version) installed at $unityPath" +# Unity 2021's bee_backend deadlocks on exit on Ubuntu 24.04: its --stdin-canary thread holds the stdin +# lock while exit() waits for it. Batchmode never cancels builds, so drop the canary. +if ($IsLinux -and $unity.version.StartsWith('2021.')) { + $bee = Join-Path (Split-Path $unityPath) 'Data/bee_backend' + Move-Item $bee "$bee.real" + Set-Content -Path $bee -Value @' +#!/bin/sh +for arg; do + shift + [ "$arg" = --stdin-canary ] || set -- "$@" "$arg" +done +exec "$0.real" "$@" +'@ + chmod +x $bee +} + if ($env:UNITY_LICENSE_SERVER_CONFIG) { if ($IsWindows) { New-Item -ItemType Directory -Force -Path 'C:/ProgramData/Unity/config' | Out-Null From 7f949df0686fde7bf3ede65c31fc805bcae5157f Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 22 Oct 2026 11:12:25 +0200 Subject: [PATCH 11/20] Install libssl1.1 on Linux for Unity 2021 --- scripts/setup-unity.ps1 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/setup-unity.ps1 b/scripts/setup-unity.ps1 index b70debd39..bf8045cdc 100644 --- a/scripts/setup-unity.ps1 +++ b/scripts/setup-unity.ps1 @@ -56,9 +56,15 @@ $unityPath = @($location, "$location/Contents/MacOS/Unity", "$location/Unity.exe if (-not $unityPath) { throw "Unity executable not found at $location" } Write-Host "Unity $($unity.version) installed at $unityPath" -# Unity 2021's bee_backend deadlocks on exit on Ubuntu 24.04: its --stdin-canary thread holds the stdin -# lock while exit() waits for it. Batchmode never cancels builds, so drop the canary. if ($IsLinux -and $unity.version.StartsWith('2021.')) { + # Unity 2021 compiles scripts on a bundled .NET 5 that only loads OpenSSL 1.x; Ubuntu 24.04 ships OpenSSL 3. + $libssl = Join-Path $cliDir 'libssl1.1.deb' + Invoke-WebRequest -Uri 'https://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb' -OutFile $libssl + if ((Get-FileHash $libssl -Algorithm SHA256).Hash -ne '7cf39d70a639017d1dd7c8d36daa2258063608688e449fddf40ffdd46f992a78') { throw 'libssl1.1 checksum mismatch' } + sudo dpkg -i $libssl + + # Unity 2021's bee_backend deadlocks on exit on Ubuntu 24.04: its --stdin-canary thread holds the stdin + # lock while exit() waits for it. Batchmode never cancels builds, so drop the canary. $bee = Join-Path (Split-Path $unityPath) 'Data/bee_backend' Move-Item $bee "$bee.real" Set-Content -Path $bee -Value @' From f5aa5a902a7fc64ab45b21d3f1d1f82b1833c4eb Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 22 Oct 2026 12:09:32 +0200 Subject: [PATCH 12/20] Temporary: trace SIGKILL senders on Linux Android and WebGL builds --- .github/workflows/ci.yml | 13 +++++++++++++ .github/workflows/test-build-android.yml | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 075eeae3f..11f143404 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -163,6 +163,11 @@ jobs: env: UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + - name: "Temporary: trace SIGKILL senders" + shell: bash + run: | + sudo sh -c 'cd /sys/kernel/tracing && echo "sig == 9" > events/signal/signal_generate/filter && echo 1 > events/signal/signal_generate/enable && echo 1 > tracing_on' + - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: @@ -266,6 +271,14 @@ jobs: # Library cache for the shared `ubuntu` flavour is written only by the Linux job # (see test-build-linux.yml) - the other ubuntu targets are restore-only. + - name: "Temporary: dump SIGKILL trace" + if: ${{ failure() }} + shell: bash + run: | + sudo cat /sys/kernel/tracing/trace + sudo dmesg -T | tail -20 + continue-on-error: true + - name: Upload IntegrationTest project on failure if: ${{ failure() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 diff --git a/.github/workflows/test-build-android.yml b/.github/workflows/test-build-android.yml index dc8738a36..418b01bc6 100644 --- a/.github/workflows/test-build-android.yml +++ b/.github/workflows/test-build-android.yml @@ -43,6 +43,11 @@ jobs: env: UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + - name: "Temporary: trace SIGKILL senders" + shell: bash + run: | + sudo sh -c 'cd /sys/kernel/tracing && echo "sig == 9" > events/signal/signal_generate/filter && echo 1 > events/signal/signal_generate/enable && echo 1 > tracing_on' + - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: @@ -169,6 +174,14 @@ jobs: # Library cache for the shared `ubuntu` flavour is written only by the Linux job # (see test-build-linux.yml) - the other ubuntu targets are restore-only. + - name: "Temporary: dump SIGKILL trace" + if: ${{ failure() }} + shell: bash + run: | + sudo cat /sys/kernel/tracing/trace + sudo dmesg -T | tail -20 + continue-on-error: true + - name: Upload IntegrationTest project on failure if: ${{ failure() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 From 73ed3d373d3e502a590e1ad6b0a50766e613e648 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 22 Oct 2026 12:30:51 +0200 Subject: [PATCH 13/20] Revert "Temporary: trace SIGKILL senders on Linux Android and WebGL builds" This reverts commit f5aa5a902a7fc64ab45b21d3f1d1f82b1833c4eb. --- .github/workflows/ci.yml | 13 ------------- .github/workflows/test-build-android.yml | 13 ------------- 2 files changed, 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11f143404..075eeae3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -163,11 +163,6 @@ jobs: env: UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - - name: "Temporary: trace SIGKILL senders" - shell: bash - run: | - sudo sh -c 'cd /sys/kernel/tracing && echo "sig == 9" > events/signal/signal_generate/filter && echo 1 > events/signal/signal_generate/enable && echo 1 > tracing_on' - - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: @@ -271,14 +266,6 @@ jobs: # Library cache for the shared `ubuntu` flavour is written only by the Linux job # (see test-build-linux.yml) - the other ubuntu targets are restore-only. - - name: "Temporary: dump SIGKILL trace" - if: ${{ failure() }} - shell: bash - run: | - sudo cat /sys/kernel/tracing/trace - sudo dmesg -T | tail -20 - continue-on-error: true - - name: Upload IntegrationTest project on failure if: ${{ failure() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 diff --git a/.github/workflows/test-build-android.yml b/.github/workflows/test-build-android.yml index 418b01bc6..dc8738a36 100644 --- a/.github/workflows/test-build-android.yml +++ b/.github/workflows/test-build-android.yml @@ -43,11 +43,6 @@ jobs: env: UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - - name: "Temporary: trace SIGKILL senders" - shell: bash - run: | - sudo sh -c 'cd /sys/kernel/tracing && echo "sig == 9" > events/signal/signal_generate/filter && echo 1 > events/signal/signal_generate/enable && echo 1 > tracing_on' - - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: @@ -174,14 +169,6 @@ jobs: # Library cache for the shared `ubuntu` flavour is written only by the Linux job # (see test-build-linux.yml) - the other ubuntu targets are restore-only. - - name: "Temporary: dump SIGKILL trace" - if: ${{ failure() }} - shell: bash - run: | - sudo cat /sys/kernel/tracing/trace - sudo dmesg -T | tail -20 - continue-on-error: true - - name: Upload IntegrationTest project on failure if: ${{ failure() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 From a6fe2839fa06f90fe25e533df53d282c57ecb810 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 22 Oct 2026 12:30:51 +0200 Subject: [PATCH 14/20] Revert "Temporary: diagnose bee_backend hang on 2021.3" This reverts commit 639aa84722ac22250a48480709e729ddae0ab825. --- .github/workflows/test-create.yml | 34 ------------------------------- 1 file changed, 34 deletions(-) diff --git a/.github/workflows/test-create.yml b/.github/workflows/test-create.yml index 115d00b81..bd333bcb7 100644 --- a/.github/workflows/test-create.yml +++ b/.github/workflows/test-create.yml @@ -41,42 +41,8 @@ jobs: - name: Create new Project if: steps.cache-project.outputs.cache-hit != 'true' - timeout-minutes: 20 run: ./test/Scripts.Integration.Test/create-project.ps1 -UnityPath "$env:UNITY_PATH" - - name: "Temporary: diagnose bee_backend hang" - if: failure() - shell: bash - run: | - sudo apt-get install -y -q strace >/dev/null - echo "=== process tree" - ps -eo pid,ppid,pgid,stat,wchan:32,etime,args --forest | grep -vE '\[.*\]$' | cut -c1-300 - for name in Unity bee_backend; do - for pid in $(pgrep -x "$name"); do - echo "=== $name $pid" - echo "--- fds"; sudo ls -l /proc/$pid/fd | cut -c40- - echo "--- threads (comm wchan)" - for t in /proc/$pid/task/*; do echo "$(basename $t) $(cat $t/comm) $(sudo cat $t/wchan)"; done - echo "--- kernel stacks" - for t in /proc/$pid/task/*; do echo "# $(basename $t)"; sudo cat $t/stack; done - done - done - for pid in $(pgrep -x bee_backend); do - echo "=== strace bee_backend $pid (15s)" - sudo timeout 15 strace -f -tt -p $pid 2>&1 | head -200 - done - echo "=== Library/Bee" - ls -la samples/IntegrationTest/Library/Bee 2>&1 | head -40 - tail -c 4000 samples/IntegrationTest/Library/Bee/backend_profiler*.traceevents 2>&1 - - echo "=== retry with stdin from /dev/null" - pkill -9 -x bee_backend; pkill -9 -x Unity; pkill -9 -f Xvfb; sleep 5 - set +e - timeout 1200 xvfb-run -ae /dev/stdout "$UNITY_PATH" -batchmode -createProject "$RUNNER_TEMP/StdinTest" -quit -logFile - < /dev/null > stdin-test.log 2>&1 - echo "retry exit code: $? (124 = timed out)" - grep -nE 'bee_backend|ExitCode|Exiting|Application will terminate' stdin-test.log | tail -20 - continue-on-error: true - - name: Save IntegrationTest Project cache if: github.ref == 'refs/heads/main' && steps.cache-project.outputs.cache-hit != 'true' uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 From 85b2d98f06a41e46baf1ded2df561f8adf263ee3 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 22 Oct 2026 12:32:18 +0200 Subject: [PATCH 15/20] Keep Linux CI on the GameCI Docker images --- .github/workflows/build.yml | 34 ++++++---- .github/workflows/ci.yml | 20 +++++- .github/workflows/test-build-android.yml | 19 ++++-- .github/workflows/test-build-ios.yml | 17 +++-- .github/workflows/test-build-linux.yml | 32 +++++++-- .github/workflows/test-create.yml | 14 +++- docs/agent-guides/ci.md | 4 +- scripts/alias-assemblies.ps1 | 5 +- scripts/ci-docker.sh | 68 +++++++++++++++++++ scripts/find-unity.ps1 | 2 +- scripts/setup-unity.ps1 | 39 +---------- scripts/unity-utils.ps1 | 16 ++++- test/Scripts.Integration.Test/add-sentry.ps1 | 1 + .../build-project.ps1 | 2 +- test/Scripts.Integration.Test/common.ps1 | 2 +- .../create-project.ps1 | 2 +- test/Scripts.Integration.Test/globals.ps1 | 17 ++++- 17 files changed, 214 insertions(+), 80 deletions(-) create mode 100755 scripts/ci-docker.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a823b10e..cff3308ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,7 @@ on: env: DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: 1 + GITHUB_ACTOR: ${{ github.actor }} UNITY_VERSION: ${{ inputs.unity-version }} defaults: @@ -48,7 +49,6 @@ jobs: run: | $v = (Get-Content scripts/unity-versions.json -Raw | ConvertFrom-Json).'${{ env.UNITY_VERSION }}'.version "unityVersion=$v" >> $env:GITHUB_OUTPUT - "UNITY_VERSION=$v" >> $env:GITHUB_ENV - name: Cache Unity Library uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 @@ -58,8 +58,16 @@ jobs: restore-keys: | Library-unity-of-bugs-${{ steps.env.outputs.unityVersion }}- - - name: Setup Unity - run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules ios + - name: Docker Login + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + with: + registry: ghcr.io + username: ${{ env.GITHUB_ACTOR }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Start the Unity docker container + run: ./scripts/ci-docker.sh "$UNITY_VERSION" 'ios' "$UNITY_LICENSE_SERVER_CONFIG" + shell: bash env: UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} @@ -118,17 +126,17 @@ jobs: path: package-dev/Plugins/Windows/SentryNative~ - name: Build Sentry.Unity Solution - run: dotnet build -c Release -v:d + run: docker exec unity dotnet build -c Release -v:d - name: Install assemblyalias - run: dotnet tool install --global Sentry.AssemblyAlias --version 0.5.0 --allow-roll-forward + run: docker exec unity dotnet tool install --global Sentry.AssemblyAlias --version 0.5.0 --allow-roll-forward - name: Alias assemblies - run: ./scripts/alias-assemblies.ps1 -AssemblyAlias "$HOME/.dotnet/tools/assemblyalias" + run: docker exec unity pwsh scripts/alias-assemblies.ps1 -AssemblyAlias /home/gh/.dotnet/tools/assemblyalias - name: Package for release run: | - dotnet msbuild /t:UnityConfigureSentryOptions /p:Configuration=Release /p:OutDir=other src/Sentry.Unity + docker exec unity dotnet msbuild /t:UnityConfigureSentryOptions /p:Configuration=Release /p:OutDir=other src/Sentry.Unity ./scripts/pack.ps1 - name: Upload release artifacts @@ -140,7 +148,7 @@ jobs: package-release.zip - name: Build DependencyConflict package - run: dotnet build test/Scripts.Integration.Test/DependencyConflictPackage + run: docker exec unity dotnet build test/Scripts.Integration.Test/DependencyConflictPackage - name: Upload DependencyConflict package uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 @@ -150,16 +158,16 @@ jobs: path: test/Scripts.Integration.Test/DependencyConflictPackage/DependencyConflict - name: Run Unity tests (playmode) - run: dotnet msbuild /t:UnityPlayModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Tests + run: docker exec unity dotnet msbuild /t:UnityPlayModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Tests - name: Run Unity tests (editmode) - run: dotnet msbuild /t:UnityEditModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Editor.Tests + run: docker exec unity dotnet msbuild /t:UnityEditModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Editor.Tests - name: Publish Test Results uses: dorny/test-reporter@a6ddd83ac95ff4586f5d3aceeb314d9a1841db95 # v3.0.0 if: ${{ !cancelled() }} with: - name: Unity Test Results - ${{ inputs.unity-version }} + name: Unity Test Results - ${{ env.UNITY_VERSION }} path: artifacts/test/**/*.xml reporter: dotnet-nunit fail-on-error: false @@ -167,11 +175,11 @@ jobs: - name: Upload test artifacts (playmode) uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: Test results (playmode) - ${{ inputs.unity-version }} + name: Test results (playmode) - ${{ env.UNITY_VERSION }} path: artifacts/test/playmode - name: Upload test artifacts (editmode) uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: Test results (editmode) - ${{ inputs.unity-version }} + name: Test results (editmode) - ${{ env.UNITY_VERSION }} path: artifacts/test/editmode diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 075eeae3f..ad148a4aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -130,7 +130,7 @@ jobs: with: unity-version: ${{ matrix.unity-version }} - # A Linux build to prepare a WebGL player. The tests run in `test-run-webgl`. + # A Linux, docker-based build to prepare a WebGL player. The tests run in `test-run-webgl`. test-build-webgl: name: Build ${{ matrix.platform }} ${{ matrix.unity-version }} Test if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} @@ -144,6 +144,8 @@ jobs: include: - platform: WebGL build_platform: WebGL + env: + UNITY_PATH: docker exec unity unity-editor steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -158,9 +160,21 @@ jobs: docker-images: false swap-storage: true - - name: Setup Unity - run: ./scripts/setup-unity.ps1 -UnityVersion "${{ matrix.unity-version }}" -Modules webgl + - name: Docker Login + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Start the Unity docker container + run: ./scripts/ci-docker.sh "$UNITY_VERSION" "$PLATFORM_WITH_SUFFIX" "$UNITY_LICENSE_SERVER_CONFIG" + shell: bash env: + UNITY_VERSION: ${{ matrix.unity-version }} + PLATFORM: ${{ matrix.platform }} + IMAGE_SUFFIX: ${{ matrix.image-suffix }} + PLATFORM_WITH_SUFFIX: ${{ matrix.platform }}${{ matrix.image-suffix }} UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} - name: Download IntegrationTest project diff --git a/.github/workflows/test-build-android.yml b/.github/workflows/test-build-android.yml index dc8738a36..b3fb9f8d2 100644 --- a/.github/workflows/test-build-android.yml +++ b/.github/workflows/test-build-android.yml @@ -22,6 +22,8 @@ jobs: name: ${{ inputs.unity-version }} runs-on: ubuntu-24.04 env: + GITHUB_ACTOR: ${{ github.actor }} + UNITY_PATH: docker exec unity unity-editor UNITY_VERSION: ${{ inputs.unity-version }} steps: @@ -38,10 +40,19 @@ jobs: docker-images: false swap-storage: true - - name: Setup Unity - run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules android + - name: Docker Login + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + with: + registry: ghcr.io + username: ${{ env.GITHUB_ACTOR }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Start the Unity docker container + run: ./scripts/ci-docker.sh "$UNITY_VERSION" 'android' "$UNITY_LICENSE_SERVER_CONFIG" + shell: bash env: UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 @@ -104,8 +115,6 @@ jobs: - name: Export APK - Runtime Initialization run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -UnityVersion "$env:UNITY_VERSION" - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Assert symbols and sources were uploaded (Runtime) run: ./test/Scripts.Integration.Test/assert-symbol-upload.ps1 -LogPath samples/IntegrationTest/Logs/sentry-symbols-upload.log @@ -145,8 +154,6 @@ jobs: - name: Export APK - Build-Time Initialization run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -UnityVersion "$env:UNITY_VERSION" - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Assert symbols and sources were uploaded (Build-Time) run: ./test/Scripts.Integration.Test/assert-symbol-upload.ps1 -LogPath samples/IntegrationTest/Logs/sentry-symbols-upload.log diff --git a/.github/workflows/test-build-ios.yml b/.github/workflows/test-build-ios.yml index aeae40680..118bb4c06 100644 --- a/.github/workflows/test-build-ios.yml +++ b/.github/workflows/test-build-ios.yml @@ -28,16 +28,27 @@ jobs: check_symbols: false build_platform: iOS env: + GITHUB_ACTOR: ${{ github.actor }} + UNITY_PATH: docker exec unity unity-editor UNITY_VERSION: ${{ inputs.unity-version }} steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Setup Unity - run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules ios + - name: Docker Login + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + with: + registry: ghcr.io + username: ${{ env.GITHUB_ACTOR }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Start the Unity docker container + run: ./scripts/ci-docker.sh "$UNITY_VERSION" "iOS" "$UNITY_LICENSE_SERVER_CONFIG" + shell: bash env: UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 @@ -116,7 +127,6 @@ jobs: run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -UnityVersion "$env:UNITY_VERSION" env: BUILD_PLATFORM: ${{ matrix.build_platform }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} # We create tar explicitly because upload-artifact is slow for many files. - name: Create archive (runtime initialization) @@ -145,7 +155,6 @@ jobs: run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -UnityVersion "$env:UNITY_VERSION" env: BUILD_PLATFORM: ${{ matrix.build_platform }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Create archive (build-time initialization) run: | diff --git a/.github/workflows/test-build-linux.yml b/.github/workflows/test-build-linux.yml index c83cace2a..1f2b2309d 100644 --- a/.github/workflows/test-build-linux.yml +++ b/.github/workflows/test-build-linux.yml @@ -22,6 +22,8 @@ jobs: name: Linux ${{ inputs.unity-version }} runs-on: ubuntu-24.04 env: + GITHUB_ACTOR: ${{ github.actor }} + UNITY_PATH: docker exec unity unity-editor UNITY_VERSION: ${{ inputs.unity-version }} BUILD_PLATFORM: Linux @@ -39,10 +41,19 @@ jobs: docker-images: false swap-storage: true - - name: Setup Unity - run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules linux-il2cpp + - name: Log into Docker + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + with: + registry: ghcr.io + username: ${{ env.GITHUB_ACTOR }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Start the Unity docker container + run: ./scripts/ci-docker.sh "$UNITY_VERSION" "Linux-il2cpp" "$UNITY_LICENSE_SERVER_CONFIG" + shell: bash env: UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Download IntegrationTest project uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 @@ -105,8 +116,6 @@ jobs: - name: Build with Sentry SDK (Breakpad backend) run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -UnityVersion "$env:UNITY_VERSION" - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Assert symbols and sources were uploaded (Breakpad backend) run: ./test/Scripts.Integration.Test/assert-symbol-upload.ps1 -LogPath unity.log @@ -145,8 +154,6 @@ jobs: - name: Build with Sentry SDK (Native backend) run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -UnityVersion "$env:UNITY_VERSION" - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Assert symbols and sources were uploaded (Native backend) run: ./test/Scripts.Integration.Test/assert-symbol-upload.ps1 -LogPath unity.log @@ -173,6 +180,19 @@ jobs: path: samples/IntegrationTest/Library key: it-library-ubuntu-${{ env.UNITY_VERSION }}-${{ github.run_id }} + - name: Docker diagnostics on failure + if: ${{ failure() }} + run: | + Write-Host "=== Docker container status ===" + docker ps -a --filter "name=^/unity$" + + Write-Host "`n=== Working directory ===" + docker exec unity pwd + + Write-Host "`n=== Unity log from container ===" + docker exec unity cat /sentry-unity/unity.log 2>&1 || echo "unity.log not found" + continue-on-error: true + - name: Upload IntegrationTest project on failure if: ${{ failure() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 diff --git a/.github/workflows/test-create.yml b/.github/workflows/test-create.yml index bd333bcb7..33ce665b8 100644 --- a/.github/workflows/test-create.yml +++ b/.github/workflows/test-create.yml @@ -18,12 +18,21 @@ jobs: name: ${{ inputs.unity-version }} runs-on: ubuntu-24.04 env: + GITHUB_ACTOR: ${{ github.actor }} + UNITY_PATH: docker exec unity unity-editor UNITY_VERSION: ${{ inputs.unity-version }} steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Docker Login + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + with: + registry: ghcr.io + username: ${{ env.GITHUB_ACTOR }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Restore IntegrationTest Project cache id: cache-project uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 @@ -33,9 +42,10 @@ jobs: restore-keys: | IntegrationTest-Project-${{ env.UNITY_VERSION }}- - - name: Setup Unity + - name: Start the Unity docker container if: steps.cache-project.outputs.cache-hit != 'true' - run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" + run: ./scripts/ci-docker.sh "$UNITY_VERSION" 'base' "$UNITY_LICENSE_SERVER_CONFIG" + shell: bash env: UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} diff --git a/docs/agent-guides/ci.md b/docs/agent-guides/ci.md index 92dfeb9f9..09e5e6ad2 100644 --- a/docs/agent-guides/ci.md +++ b/docs/agent-guides/ci.md @@ -22,9 +22,9 @@ Exact Unity editor versions and changesets live in `scripts/unity-versions.json` `build.yml`: 1. Checks out `src/sentry-dotnet`. -2. Installs the Unity Editor via `scripts/setup-unity.ps1` (Unity CLI). +2. Starts a `unityci/editor` Docker image. 3. Restores .NET workloads and downloads native CI artifacts. -4. Runs `dotnet build -c Release -v:d`. +4. Runs `dotnet build -c Release -v:d` in the container. 5. Installs `Sentry.AssemblyAlias` and runs `scripts/alias-assemblies.ps1`. 6. Runs `scripts/pack.ps1` and uploads `package-release`. 7. Builds/uploads the DependencyConflict fixture. diff --git a/scripts/alias-assemblies.ps1 b/scripts/alias-assemblies.ps1 index 9b2e42fc2..0a729ad02 100644 --- a/scripts/alias-assemblies.ps1 +++ b/scripts/alias-assemblies.ps1 @@ -1,12 +1,13 @@ # Single source of truth for the assembly-aliasing invocation. Used by the local -# release script (repack.ps1) and by CI (build.yml). +# release script (repack.ps1) and by CI (build.yml, which runs it inside the Unity +# docker container). # param( # Pass an empty string to skip either target. [string]$RuntimeDir = "package-dev/Runtime", [string]$EditorDir = "package-dev/Editor", # assemblyalias is on PATH for local host builds; CI runs it from the dotnet - # global tools path (~/.dotnet/tools/assemblyalias). + # global tools path inside the container (/home/gh/.dotnet/tools/assemblyalias). [string]$AssemblyAlias = "assemblyalias" ) diff --git a/scripts/ci-docker.sh b/scripts/ci-docker.sh new file mode 100755 index 000000000..769647a88 --- /dev/null +++ b/scripts/ci-docker.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +set -euo pipefail + +unityPrefix="$1" +unityVersion=$(jq -r --arg p "$unityPrefix" '.[$p].version' ./scripts/unity-versions.json) +imageVariant=$(echo "$2" | tr '[:upper:]' '[:lower:]') +licenseConfig=$3 + +container="unity" +image="unityci/editor:ubuntu-$unityVersion-$imageVariant-3" +cwd="${GITHUB_WORKSPACE:-$(pwd)}" +user="gh" +uid=$(id -u) +gid=$(id -g) + +# Local fallbacks for testing +ANDROID_HOME=${ANDROID_HOME:-/android-home-missing} +JAVA_HOME_11_X64=${JAVA_HOME_11_X64:-/java-home-missing} + +if [[ $(docker ps --filter "name=^/$container$" --format '{{.Names}}') == "$container" ]]; then + echo "Removing existing container '$container'" + docker stop $container + docker rm $container +fi + +echo "Starting up '$image' as '$container'" +suexec="docker exec --user root" + +# Format: -- +uniqueHostname="${GITHUB_JOB:-local}-${imageVariant}-${GITHUB_RUN_ID:-0}" +# Sanitize hostname: replace underscores and spaces with hyphens, ensure lowercase +uniqueHostname=$(echo "$uniqueHostname" | tr '[:upper:]_ ' '[:lower:]--' | tr -s '-') + +# We use the host dotnet installation - it's much faster than installing inside the docker container. +set -x +docker run -td --name $container \ + --hostname $uniqueHostname \ + --user $uid:$gid \ + --shm-size=2g \ + -v "$cwd":/sentry-unity \ + -v $ANDROID_HOME:$ANDROID_HOME \ + -v $JAVA_HOME_11_X64:$JAVA_HOME_11_X64 \ + -v /usr/share/dotnet:/usr/share/dotnet \ + -v /opt/microsoft/powershell/7:/opt/microsoft/powershell/7 \ + -e UNITY_VERSION=$unityVersion \ + -e GITHUB_ACTIONS="${GITHUB_ACTIONS}" \ + -e SENTRY_AUTH_TOKEN="${SENTRY_AUTH_TOKEN:-}" \ + --workdir /sentry-unity $image + +# Generate unique machine-id to avoid any hardcoded values and license-fetch congestion +$suexec $container rm -f /etc/machine-id +$suexec $container dbus-uuidgen --ensure=/etc/machine-id + +$suexec $container groupadd -g $gid $user +$suexec $container useradd -u $uid -g $gid --create-home $user + +$suexec $container ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet +$suexec $container ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh + +$suexec $container mkdir -p /usr/share/unity3d/config/ +echo $licenseConfig | $suexec -i $container sh -c "cat > /usr/share/unity3d/config/services-config.json" +$suexec $container chown -R $uid /usr/share/unity3d/config/ + +# Unity 2021+ tries to write to this directory during asset import... +$suexec $container chmod -R 755 /opt/unity/Editor/Data/UnityReferenceAssemblies/ + +echo "Container started successfully: " +docker ps --filter "name=^/$container$" diff --git a/scripts/find-unity.ps1 b/scripts/find-unity.ps1 index 94f14b295..51409619f 100644 --- a/scripts/find-unity.ps1 +++ b/scripts/find-unity.ps1 @@ -61,7 +61,7 @@ $rootName = if ($IsMacOS) { 'Unity.app' } else { 'Editor' } # Each "install" candidate is a directory like // that contains # either Editor/ (win/linux) or Unity.app/ (mac). $installs = [System.Collections.Generic.List[string]]::new() -if ($IsLinux -and $env:UNITY_PATH) { $installs.Add((Split-Path (Split-Path $env:UNITY_PATH))) } +if ($IsLinux -and $env:UNITY_PATH) { $installs.Add($env:UNITY_PATH) } if ($HubInstallDir -and $UnityVersion) { $installs.Add((Join-Path $HubInstallDir $UnityVersion)) } if ($HubInstallDir -and $HubDefaultEditor -and $UnityVersion -ne $HubDefaultEditor) { $installs.Add((Join-Path $HubInstallDir $HubDefaultEditor)) diff --git a/scripts/setup-unity.ps1 b/scripts/setup-unity.ps1 index bf8045cdc..4a875311a 100644 --- a/scripts/setup-unity.ps1 +++ b/scripts/setup-unity.ps1 @@ -8,7 +8,6 @@ $PSNativeCommandUseErrorActionPreference = $true $CliVersion = '1.0.0-beta.14' $CliBinaries = @{ - 'linux-x64' = @('unity-linux-x64', 'd9a2c1716ce723b970898f7f40adc09cceee04e84ce2f1f1638f07ac3e9898aa') 'darwin-arm64' = @('unity-darwin-arm64', '367ea124c61e91dc22409699cb40d2e65d23952f3220e911ccea1f6d8a1ff37f') 'win32-x64' = @('unity-windows-x64.exe', '78761a0547cd4a9bc212e27a217c66e6a621bf48c753ba440e4b2327ee7ff8ac') } @@ -21,7 +20,7 @@ $env:UNITY_NON_INTERACTIVE = '1' $env:UNITY_NO_BANNER = '1' $env:UNITY_NO_PAGER = '1' -# Unity CLI, pinned by version and checksum +# Unity CLI, pinned by version and checksum. Linux CI uses the GameCI Docker images instead (scripts/ci-docker.sh). $os = $IsWindows ? 'win32' : $IsMacOS ? 'darwin' : 'linux' $arch = "$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)".ToLower() $cliFile, $cliSha = $CliBinaries["$os-$arch"] @@ -34,15 +33,6 @@ Invoke-WebRequest -Uri "https://public-cdn.cloud.unity3d.com/hub/prod/cli/$CliVe if ((Get-FileHash $cli -Algorithm SHA256).Hash -ne $cliSha) { throw "Unity CLI checksum mismatch for $cliFile" } if (-not $IsWindows) { chmod +x $cli } -if ($IsLinux) { - # Ubuntu 24.04 package names: editor runtime libraries, xvfb for batchmode, unzip for module extraction, - # and the native toolchain for IL2CPP and WebGL - $packages = @('xvfb', 'libglu1-mesa', 'libgtk-3-0t64', 'libasound2t64', 'libnss3', 'libxtst6', 'libxss1', 'libnotify4', 'libcap2', 'cpio', 'xz-utils', 'unzip') - if ($moduleList -match 'il2cpp|webgl') { $packages += @('build-essential', 'clang', 'lld') } - sudo apt-get update -q - sudo apt-get install -y -q --no-install-recommends @packages -} - $installArgs = @('install', $unity.version, '--changeset', $unity.changeset, '--child-modules', '--accept-eula', '--yes') if ($moduleList) { $installArgs += @('--module') + $moduleList } & $cli @installArgs @@ -50,40 +40,18 @@ if ($moduleList) { $installArgs += @('--module') + $moduleList } $editor = (& $cli editors --installed --verbose --json | ConvertFrom-Json).data | Where-Object version -EQ $unity.version | Select-Object -First 1 if (-not $editor) { throw "Unity $($unity.version) not listed after install" } $location = $editor.location -$unityPath = @($location, "$location/Contents/MacOS/Unity", "$location/Unity.exe", "$location/Unity", "$location/Editor/Unity.exe", "$location/Editor/Unity") | +$unityPath = @($location, "$location/Contents/MacOS/Unity", "$location/Unity.exe", "$location/Editor/Unity.exe") | Where-Object { Test-Path $_ -PathType Leaf } | Select-Object -First 1 if (-not $unityPath) { throw "Unity executable not found at $location" } Write-Host "Unity $($unity.version) installed at $unityPath" -if ($IsLinux -and $unity.version.StartsWith('2021.')) { - # Unity 2021 compiles scripts on a bundled .NET 5 that only loads OpenSSL 1.x; Ubuntu 24.04 ships OpenSSL 3. - $libssl = Join-Path $cliDir 'libssl1.1.deb' - Invoke-WebRequest -Uri 'https://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb' -OutFile $libssl - if ((Get-FileHash $libssl -Algorithm SHA256).Hash -ne '7cf39d70a639017d1dd7c8d36daa2258063608688e449fddf40ffdd46f992a78') { throw 'libssl1.1 checksum mismatch' } - sudo dpkg -i $libssl - - # Unity 2021's bee_backend deadlocks on exit on Ubuntu 24.04: its --stdin-canary thread holds the stdin - # lock while exit() waits for it. Batchmode never cancels builds, so drop the canary. - $bee = Join-Path (Split-Path $unityPath) 'Data/bee_backend' - Move-Item $bee "$bee.real" - Set-Content -Path $bee -Value @' -#!/bin/sh -for arg; do - shift - [ "$arg" = --stdin-canary ] || set -- "$@" "$arg" -done -exec "$0.real" "$@" -'@ - chmod +x $bee -} - if ($env:UNITY_LICENSE_SERVER_CONFIG) { if ($IsWindows) { New-Item -ItemType Directory -Force -Path 'C:/ProgramData/Unity/config' | Out-Null Set-Content -Path 'C:/ProgramData/Unity/config/services-config.json' -Value $env:UNITY_LICENSE_SERVER_CONFIG } else { - $unityDataDir = $IsMacOS ? '/Library/Application Support/Unity' : '/usr/share/unity3d' + $unityDataDir = '/Library/Application Support/Unity' $configFile = Join-Path $cliDir 'services-config.json' Set-Content -Path $configFile -Value $env:UNITY_LICENSE_SERVER_CONFIG sudo mkdir -p "$unityDataDir/config" @@ -94,4 +62,3 @@ if ($env:UNITY_LICENSE_SERVER_CONFIG) { } if ($env:GITHUB_ENV) { "UNITY_PATH=$unityPath" >> $env:GITHUB_ENV } -if ($env:GITHUB_OUTPUT) { "unity-version=$($unity.version)" >> $env:GITHUB_OUTPUT } diff --git a/scripts/unity-utils.ps1 b/scripts/unity-utils.ps1 index cf90430f7..742ad74b1 100644 --- a/scripts/unity-utils.ps1 +++ b/scripts/unity-utils.ps1 @@ -4,7 +4,21 @@ $ClearUnityLogTimeoutSeconds = 30 function RunUnity([string] $unityPath, [string[]] $arguments, [switch] $ReturnLogOutput) { - If ($IsLinux -and "$env:XDG_CURRENT_DESKTOP" -eq "" -and $unityPath -ne "xvfb-run") + If ($unityPath.StartsWith("docker ")) + { + # Move docker arguments from $unityPath to $arguments, leaving "docker" as $unityPath + $arguments = ($unityPath.Split(" ") | Select-Object -Skip 1) + $arguments + $unityPath = "docker" + } + + If ($unityPath -eq "docker") + { + # Remove "-batchmode" which ends up being duplicate because the referenced unity-editor script already adds it + Write-Host "Removing argument '-batchmode' - it would be duplicate and cause a build to fail" + $arguments = $arguments | Where-Object { $_ –ne "-batchmode" } + Write-Host "Updated arguments: $arguments" + } + ElseIf ($IsLinux -and "$env:XDG_CURRENT_DESKTOP" -eq "" -and $unityPath -ne "xvfb-run") { $arguments = @("-ae", "/dev/stdout", "$unityPath") + $arguments $unityPath = "xvfb-run" diff --git a/test/Scripts.Integration.Test/add-sentry.ps1 b/test/Scripts.Integration.Test/add-sentry.ps1 index faf0c68ba..926ba9ac0 100644 --- a/test/Scripts.Integration.Test/add-sentry.ps1 +++ b/test/Scripts.Integration.Test/add-sentry.ps1 @@ -13,6 +13,7 @@ if (-not $Global:NewProjectPathCache) $UnityPath = FormatUnityPath $UnityPath # Convert relative paths to absolute (relative to ProjectRoot) +# This ensures the path works both locally and in Docker (where RunUnityCustom handles path translation) if (-not [System.IO.Path]::IsPathRooted($PackagePath)) { $PackagePath = "$(ProjectRoot)/$PackagePath" diff --git a/test/Scripts.Integration.Test/build-project.ps1 b/test/Scripts.Integration.Test/build-project.ps1 index 1a10d91cd..01a0e5902 100644 --- a/test/Scripts.Integration.Test/build-project.ps1 +++ b/test/Scripts.Integration.Test/build-project.ps1 @@ -26,7 +26,7 @@ if ($Platform -eq "Switch") $unityArgs += @("-buildTarget", "Switch") } -RunUnity $unityPath $unityArgs +RunUnityCustom $unityPath $unityArgs if ($Platform -eq "Android-Export") { diff --git a/test/Scripts.Integration.Test/common.ps1 b/test/Scripts.Integration.Test/common.ps1 index 0c4025ae5..d9865ef9d 100644 --- a/test/Scripts.Integration.Test/common.ps1 +++ b/test/Scripts.Integration.Test/common.ps1 @@ -75,7 +75,7 @@ function Write-PhaseFailed function RunUnityAndExpect([string] $UnityPath, [string] $name, [string] $successMessage, [string[]] $arguments) { - $stdout = RunUnity $UnityPath $arguments -ReturnLogOutput + $stdout = RunUnityCustom $UnityPath $arguments -ReturnLogOutput $lineWithSuccess = $stdout | Select-String $successMessage If ($null -ne $lineWithSuccess) { diff --git a/test/Scripts.Integration.Test/create-project.ps1 b/test/Scripts.Integration.Test/create-project.ps1 index c198dcbbb..6bafe4f60 100644 --- a/test/Scripts.Integration.Test/create-project.ps1 +++ b/test/Scripts.Integration.Test/create-project.ps1 @@ -24,7 +24,7 @@ New-Item -Path "$(ProjectRoot)/samples" -Name $(GetNewProjectName) -ItemType "di Write-Detail "Directory created" Write-Log "Creating integration project..." -RunUnity $UnityPath @("-batchmode", "-createProject", "$(GetNewProjectPath)", "-quit") +RunUnityCustom $UnityPath @("-batchmode", "-createProject", "$(GetNewProjectPath)", "-quit") Write-Log "Copying Editor scripts to integration project..." New-Item -Path "$(GetNewProjectAssetsPath)" -Name "Editor" -ItemType "directory" | Out-Null diff --git a/test/Scripts.Integration.Test/globals.ps1 b/test/Scripts.Integration.Test/globals.ps1 index 2b23b84e0..275438f5d 100644 --- a/test/Scripts.Integration.Test/globals.ps1 +++ b/test/Scripts.Integration.Test/globals.ps1 @@ -107,7 +107,10 @@ function FormatUnityPath Throw "Unity path is required." } - If ($IsMacOS) + If ($unityPath.StartsWith("docker ")) + { + } + ElseIf ($IsMacOS) { If (-not $unityPath.EndsWith("Contents/MacOS/Unity")) { @@ -176,3 +179,15 @@ function BuildMethodFor([string] $platform) Default { Throw "Unsupported build platform: '$platform'" } } } + +function RunUnityCustom([string] $unityPath, [string[]] $arguments, [switch] $ReturnLogOutput) +{ + If ($unityPath.StartsWith("docker ")) + { + # Fix paths (they're supposed to be the current working directory in the docker container) + Write-Detail "Replacing project root ($(ProjectRoot)) in docker arguments" + $arguments = $arguments | ForEach-Object { $_.Replace("$(ProjectRoot)", "/sentry-unity") } + } + + return RunUnity $unityPath $arguments -ReturnLogOutput:$ReturnLogOutput +} From db1edb24070ef5820ba119ceec0ae1fbd53d5b24 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 22 Oct 2026 12:32:18 +0200 Subject: [PATCH 16/20] Retry Unity once when it is killed --- scripts/unity-utils.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/unity-utils.ps1 b/scripts/unity-utils.ps1 index 742ad74b1..0dc8a0301 100644 --- a/scripts/unity-utils.ps1 +++ b/scripts/unity-utils.ps1 @@ -81,6 +81,13 @@ function RunUnity([string] $unityPath, [string[]] $arguments, [switch] $ReturnLo Throw $msg } } + ElseIf ($process.ExitCode -eq 137 -and -not $retriedKilled) + { + # Unity 6.6 on Linux intermittently SIGKILLs itself during startup. + Write-Host "::warning::Unity was killed (exit code 137). Retrying once." + $retriedKilled = $true + $try = $try + 1 + } else { break From 5133097bc6add509b116ddaa7a61033ca791864d Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 22 Oct 2026 13:39:51 +0200 Subject: [PATCH 17/20] Tolerate a missing linux-modules-extra package for Redroid --- .github/workflows/test-run-android.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-run-android.yml b/.github/workflows/test-run-android.yml index dcb471dab..0e6387a46 100644 --- a/.github/workflows/test-run-android.yml +++ b/.github/workflows/test-run-android.yml @@ -122,15 +122,20 @@ jobs: $PSNativeCommandUseErrorActionPreference = $true $kernel = uname -r sudo apt-get update - sudo apt-get install -y adb aapt "linux-modules-extra-$kernel" - sudo modprobe binder_linux devices="binder,hwbinder,vndbinder" + sudo apt-get install -y adb aapt + # Not every runner kernel has a published modules-extra package, and newer kernels may ship binder + # elsewhere, so let the binder check below decide. $PSNativeCommandUseErrorActionPreference = $false + sudo apt-get install -y "linux-modules-extra-$kernel" + sudo modprobe binder_linux devices="binder,hwbinder,vndbinder" sudo modprobe ashmem_linux # built into the kernel on newer releases; ignore if absent $PSNativeCommandUseErrorActionPreference = $true $hasBinder = (Test-Path /dev/binderfs) -or (Select-String -Path /proc/filesystems -Pattern '\bbinder\b' -Quiet) -or (Test-Path /dev/binder) if (-not $hasBinder) { + $PSNativeCommandUseErrorActionPreference = $false + modinfo binder_linux 2>&1 | Write-Host Write-Error "binder is unavailable on this kernel ($kernel); Redroid cannot run." exit 1 } From 09261374b1fe0f2352f8adba300f00b52d83200c Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 22 Oct 2026 13:45:31 +0200 Subject: [PATCH 18/20] Initialize the killed-retry flag for strict mode --- scripts/unity-utils.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/unity-utils.ps1 b/scripts/unity-utils.ps1 index 0dc8a0301..c4dca3851 100644 --- a/scripts/unity-utils.ps1 +++ b/scripts/unity-utils.ps1 @@ -43,6 +43,7 @@ function RunUnity([string] $unityPath, [string[]] $arguments, [switch] $ReturnLo $stopwatch = [System.Diagnostics.Stopwatch]::new() $stdout = "" $try = 1 + $retriedKilled = $false do { $stopwatch.Restart() From 3fd67c1472f13d9e54fbbb7188e45ca77248c22e Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 22 Oct 2026 15:38:11 +0200 Subject: [PATCH 19/20] Install linux-modules-extra only when the kernel lacks binder --- .github/workflows/test-run-android.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-run-android.yml b/.github/workflows/test-run-android.yml index 0e6387a46..d29cf4e09 100644 --- a/.github/workflows/test-run-android.yml +++ b/.github/workflows/test-run-android.yml @@ -123,19 +123,21 @@ jobs: $kernel = uname -r sudo apt-get update sudo apt-get install -y adb aapt - # Not every runner kernel has a published modules-extra package, and newer kernels may ship binder - # elsewhere, so let the binder check below decide. + # Kernels before 7.0 ship binder in linux-modules-extra; 7.0 ships it in linux-modules. $PSNativeCommandUseErrorActionPreference = $false - sudo apt-get install -y "linux-modules-extra-$kernel" + modinfo binder_linux *> $null + $PSNativeCommandUseErrorActionPreference = $true + if ($LASTEXITCODE -ne 0) { + sudo apt-get install -y "linux-modules-extra-$kernel" + } sudo modprobe binder_linux devices="binder,hwbinder,vndbinder" + $PSNativeCommandUseErrorActionPreference = $false sudo modprobe ashmem_linux # built into the kernel on newer releases; ignore if absent $PSNativeCommandUseErrorActionPreference = $true $hasBinder = (Test-Path /dev/binderfs) -or (Select-String -Path /proc/filesystems -Pattern '\bbinder\b' -Quiet) -or (Test-Path /dev/binder) if (-not $hasBinder) { - $PSNativeCommandUseErrorActionPreference = $false - modinfo binder_linux 2>&1 | Write-Host Write-Error "binder is unavailable on this kernel ($kernel); Redroid cannot run." exit 1 } From 2af3aad3fa7410d5e5524bc2e0a9284a085e1098 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 22 Oct 2026 16:03:26 +0200 Subject: [PATCH 20/20] Move CI back to ubuntu-latest and pin JDK 17 for the Android SDK build --- .github/workflows/build.yml | 2 +- .github/workflows/ci.yml | 14 +++++++------- .github/workflows/create-unity-matrix.yml | 2 +- .github/workflows/danger.yml | 2 +- .github/workflows/format-code.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/sdk.yml | 8 ++++++++ .github/workflows/test-build-android.yml | 12 +----------- .github/workflows/test-build-ios.yml | 2 +- .github/workflows/test-build-linux.yml | 2 +- .github/workflows/test-create.yml | 2 +- .github/workflows/test-run-android.yml | 2 +- .github/workflows/test-run-desktop.yml | 2 +- .github/workflows/test-run-webgl.yml | 2 +- .github/workflows/update-deps.yml | 4 ++-- .github/workflows/validate-pr.yml | 2 +- 16 files changed, 30 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cff3308ec..51fb96f3c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ defaults: jobs: build: name: Build - ${{ inputs.unity-version }} - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest permissions: actions: read checks: write diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad148a4aa..6151395e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ defaults: jobs: cancel-previous-workflow: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1 @@ -38,11 +38,11 @@ jobs: matrix: include: - target: Android - host: ubuntu-24.04 + host: ubuntu-latest - target: Linux - host: ubuntu-24.04 + host: ubuntu-latest - target: LinuxNative - host: ubuntu-24.04 + host: ubuntu-latest - target: Windows host: windows-latest - target: WindowsNative @@ -75,7 +75,7 @@ jobs: package-validation: name: UPM Package validation - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -135,7 +135,7 @@ jobs: name: Build ${{ matrix.platform }} ${{ matrix.unity-version }} Test if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [test-create, create-unity-matrix] - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -565,7 +565,7 @@ jobs: build-size-summary: name: Build Size - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [test-build-webgl, test-build-android, test-compile-ios, test-build-linux, test-build-windows, test-build-macos] steps: diff --git a/.github/workflows/create-unity-matrix.yml b/.github/workflows/create-unity-matrix.yml index bd2d30579..2ad5eb93d 100644 --- a/.github/workflows/create-unity-matrix.yml +++ b/.github/workflows/create-unity-matrix.yml @@ -25,7 +25,7 @@ env: jobs: create-unity-matrix: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest outputs: unity-matrix: ${{ steps.set-matrix.outputs.matrix }} steps: diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index aeae42afc..0ec9dcccf 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -5,6 +5,6 @@ on: jobs: danger: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - uses: getsentry/github-workflows/danger@26f565c05d0dd49f703d238706b775883037d76b # v3 diff --git a/.github/workflows/format-code.yml b/.github/workflows/format-code.yml index 720bddf4e..6be001e9b 100644 --- a/.github/workflows/format-code.yml +++ b/.github/workflows/format-code.yml @@ -5,7 +5,7 @@ on: jobs: format-code: name: Format Code - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 01f60ec1f..f37c48d98 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ permissions: jobs: job_release: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest name: 'Release a new version: ${{ github.event.inputs.version }}' steps: - name: Get auth token diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml index 93da1db3c..27adc7e62 100644 --- a/.github/workflows/sdk.yml +++ b/.github/workflows/sdk.yml @@ -86,6 +86,14 @@ jobs: - name: Restore .NET Workload if: ${{ steps.cache.outputs.cache-hit != 'true' }} run: dotnet workload restore + + # javac 25 (default on ubuntu-26.04) warns on generated sources and sentry-native's ndk builds with -Werror. + - name: Setup Java + if: ${{ env.TARGET == 'Android' && steps.cache.outputs.cache-hit != 'true' }} + uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 + with: + distribution: temurin + java-version: '17' - name: Build if: steps.cache.outputs.cache-hit != 'true' diff --git a/.github/workflows/test-build-android.yml b/.github/workflows/test-build-android.yml index b3fb9f8d2..1524018ed 100644 --- a/.github/workflows/test-build-android.yml +++ b/.github/workflows/test-build-android.yml @@ -20,7 +20,7 @@ defaults: jobs: build: name: ${{ inputs.unity-version }} - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest-4-cores env: GITHUB_ACTOR: ${{ github.actor }} UNITY_PATH: docker exec unity unity-editor @@ -30,16 +30,6 @@ jobs: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Free Disk Space - uses: jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8 # v1.3.0 - with: - android: true - dotnet: false - haskell: true - large-packages: false - docker-images: false - swap-storage: true - - name: Docker Login uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 with: diff --git a/.github/workflows/test-build-ios.yml b/.github/workflows/test-build-ios.yml index 118bb4c06..9dab592ec 100644 --- a/.github/workflows/test-build-ios.yml +++ b/.github/workflows/test-build-ios.yml @@ -20,7 +20,7 @@ defaults: jobs: build: name: ${{ inputs.unity-version }} - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest strategy: matrix: include: diff --git a/.github/workflows/test-build-linux.yml b/.github/workflows/test-build-linux.yml index 1f2b2309d..5535dc050 100644 --- a/.github/workflows/test-build-linux.yml +++ b/.github/workflows/test-build-linux.yml @@ -20,7 +20,7 @@ defaults: jobs: build: name: Linux ${{ inputs.unity-version }} - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest env: GITHUB_ACTOR: ${{ github.actor }} UNITY_PATH: docker exec unity unity-editor diff --git a/.github/workflows/test-create.yml b/.github/workflows/test-create.yml index 33ce665b8..067df280d 100644 --- a/.github/workflows/test-create.yml +++ b/.github/workflows/test-create.yml @@ -16,7 +16,7 @@ defaults: jobs: create: name: ${{ inputs.unity-version }} - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest env: GITHUB_ACTOR: ${{ github.actor }} UNITY_PATH: docker exec unity unity-editor diff --git a/.github/workflows/test-run-android.yml b/.github/workflows/test-run-android.yml index d29cf4e09..6400e761d 100644 --- a/.github/workflows/test-run-android.yml +++ b/.github/workflows/test-run-android.yml @@ -26,7 +26,7 @@ jobs: name: ${{ inputs.unity-version }} ${{ inputs.api-level }} ${{ inputs.init-type }} # Unity 6000.x builds ARM64 so we run Redroid (containerized arm64 Android) on an # arm64 Linux runner. - runs-on: ${{ fromJSON(inputs.unity-version) >= 6000 && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} + runs-on: ${{ fromJSON(inputs.unity-version) >= 6000 && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} env: ARTIFACTS_PATH: samples/IntegrationTest/test-artifacts/ HOMEBREW_NO_INSTALL_CLEANUP: 1 diff --git a/.github/workflows/test-run-desktop.yml b/.github/workflows/test-run-desktop.yml index e5b0ffa13..4cf4f7e24 100644 --- a/.github/workflows/test-run-desktop.yml +++ b/.github/workflows/test-run-desktop.yml @@ -37,7 +37,7 @@ defaults: jobs: run: name: ${{ inputs.platform }}${{ inputs.architecture && format(' {0}', inputs.architecture) || '' }}${{ inputs.scripting && format(' {0}', inputs.scripting) || '' }}${{ inputs.backend && format(' ({0})', inputs.backend) || '' }} ${{ inputs.unity-version }} - runs-on: ${{ inputs.platform == 'linux' && 'ubuntu-24.04' || inputs.platform == 'macos' && 'macos-latest' || 'windows-latest' }} + runs-on: ${{ inputs.platform == 'linux' && 'ubuntu-latest' || inputs.platform == 'macos' && 'macos-latest' || 'windows-latest' }} env: SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} diff --git a/.github/workflows/test-run-webgl.yml b/.github/workflows/test-run-webgl.yml index 8d243ca5e..cff15cb81 100644 --- a/.github/workflows/test-run-webgl.yml +++ b/.github/workflows/test-run-webgl.yml @@ -18,7 +18,7 @@ defaults: jobs: run: name: WebGL ${{ inputs.unity-version }} - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest env: SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} diff --git a/.github/workflows/update-deps.yml b/.github/workflows/update-deps.yml index 4c8ee93ad..90be275f6 100644 --- a/.github/workflows/update-deps.yml +++ b/.github/workflows/update-deps.yml @@ -27,7 +27,7 @@ jobs: post-update-script: scripts/sync-dotnet-global-json.ps1 - name: CLI path: modules/sentry-cli.properties - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - uses: getsentry/github-workflows/updater@959162c159b866489d3fabe93327f48f9b8cb7ee # 3.4.1 with: @@ -40,7 +40,7 @@ jobs: name: Unity ${{ matrix.unity-prefix }} PR # Note: we're using the negative check here so this runs also for workflow_dispatch. if: github.event.schedule != '0 3 * * *' - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest defaults: run: shell: pwsh diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index 10fe89406..b77e303c6 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -6,7 +6,7 @@ on: jobs: validate-pr: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest permissions: pull-requests: write steps: