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/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/.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-macos.yml b/.github/workflows/test-build-macos.yml index 318f71bd5..2ce2bfd49 100644 --- a/.github/workflows/test-build-macos.yml +++ b/.github/workflows/test-build-macos.yml @@ -29,24 +29,8 @@ 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 - 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 + run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules mac-il2cpp env: UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} diff --git a/.github/workflows/test-build-windows-mono.yml b/.github/workflows/test-build-windows-mono.yml index 2fad1218c..6a40abce9 100644 --- a/.github/workflows/test-build-windows-mono.yml +++ b/.github/workflows/test-build-windows-mono.yml @@ -29,24 +29,8 @@ 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 - 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" + run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules windows-il2cpp env: UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} diff --git a/.github/workflows/test-build-windows-x86.yml b/.github/workflows/test-build-windows-x86.yml index fac318d77..94513f524 100644 --- a/.github/workflows/test-build-windows-x86.yml +++ b/.github/workflows/test-build-windows-x86.yml @@ -29,24 +29,8 @@ 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 - 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" + run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules windows-il2cpp env: UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} diff --git a/.github/workflows/test-build-windows.yml b/.github/workflows/test-build-windows.yml index 89dedc474..611816ae9 100644 --- a/.github/workflows/test-build-windows.yml +++ b/.github/workflows/test-build-windows.yml @@ -29,24 +29,8 @@ 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 - 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" + run: ./scripts/setup-unity.ps1 -UnityVersion "${{ inputs.unity-version }}" -Modules windows-il2cpp env: UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }} diff --git a/.github/workflows/test-run-android.yml b/.github/workflows/test-run-android.yml index 67b6471f6..6400e761d 100644 --- a/.github/workflows/test-run-android.yml +++ b/.github/workflows/test-run-android.yml @@ -122,7 +122,14 @@ jobs: $PSNativeCommandUseErrorActionPreference = $true $kernel = uname -r sudo apt-get update - sudo apt-get install -y adb aapt "linux-modules-extra-$kernel" + sudo apt-get install -y adb aapt + # Kernels before 7.0 ship binder in linux-modules-extra; 7.0 ships it in linux-modules. + $PSNativeCommandUseErrorActionPreference = $false + 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 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: 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/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/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/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/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 \ diff --git a/scripts/setup-unity.ps1 b/scripts/setup-unity.ps1 new file mode 100644 index 000000000..4a875311a --- /dev/null +++ b/scripts/setup-unity.ps1 @@ -0,0 +1,64 @@ +param( + [Parameter(Mandatory = $true)][string] $UnityVersion, + [string] $Modules = '' +) + +$ErrorActionPreference = 'Stop' +$PSNativeCommandUseErrorActionPreference = $true + +$CliVersion = '1.0.0-beta.14' +$CliBinaries = @{ + 'darwin-arm64' = @('unity-darwin-arm64', '367ea124c61e91dc22409699cb40d2e65d23952f3220e911ccea1f6d8a1ff37f') + 'win32-x64' = @('unity-windows-x64.exe', '78761a0547cd4a9bc212e27a217c66e6a621bf48c753ba440e4b2327ee7ff8ac') +} + +$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 + +$env:UNITY_NON_INTERACTIVE = '1' +$env:UNITY_NO_BANNER = '1' +$env:UNITY_NO_PAGER = '1' + +# 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"] +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 } + +$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/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 ($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 = '/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" + 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 } 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 diff --git a/scripts/unity-utils.ps1 b/scripts/unity-utils.ps1 index 742ad74b1..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() @@ -81,6 +82,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 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" } }