From 33cc94c160e496034f2b72b39a424b5a5daffbe2 Mon Sep 17 00:00:00 2001 From: Andrew Kahr <22359829+AndrewKahr@users.noreply.github.com> Date: Mon, 8 Jan 2024 06:38:45 -0800 Subject: [PATCH] Fix Image Build Errors on 2023.2.4f1+ (#236) * Bump artifact upload/download versions. Fix for new Unity modules.json format * Update test.yml to conform with new activation requirements * Revert artifact action to v3 due to intermittent issues * Move minimum test version to 2019.3 * Only do test builds when not a PR due to needing access to secrets * Bump ubuntu hub version, cancel superseded checks --- .github/workflows/test.yml | 56 +++++++++++++------ images/ubuntu/hub/Dockerfile | 2 +- .../editor/scripts/HelperFunctions.ps1 | 37 ++++++++---- 3 files changed, 64 insertions(+), 31 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 552e8116..40be7ef6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,16 +5,19 @@ on: push: paths: - "**/Dockerfile" + - "**/scripts/**" - ".github/workflows/test.yml" - "reference-project-test/**" pull_request: paths: - "**/Dockerfile" + - "**/scripts/**" - ".github/workflows/test.yml" - "reference-project-test/**" -env: - UNITY_LICENSE: "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \nm0Db8UK+ktnOLJBtHybkfetpcKo=o/pUbSQAukz7+ZYAWhnA0AJbIlyyCPL7bKVEM2lVqbrXt7cyey+umkCXamuOgsWPVUKBMkXtMH8L\n5etLmD0getWIhTGhzOnDCk+gtIPfL4jMo9tkEuOCROQAXCci23VFscKcrkB+3X6h4wEOtA2APhOY\nB+wvC794o8/82ffjP79aVAi57rp3Wmzx+9pe9yMwoJuljAy2sc2tIMgdQGWVmOGBpQm3JqsidyzI\nJWG2kjnc7pDXK9pwYzXoKiqUqqrut90d+kQqRyv7MSZXR50HFqD/LI69h68b7P8Bjo3bPXOhNXGR\n9YCoemH6EkfCJxp2gIjzjWW+l2Hj2EsFQi8YXw==" +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: ########################## @@ -105,27 +108,24 @@ jobs: id: setup run: | # Get the Unity versions for test. (The latest patch versions for each minor version.) - VERSIONS=`npx unity-changeset list --versions --latest-patch --json --min 2018.3` + VERSIONS=`npx unity-changeset list --versions --latest-patch --json --min 2019.3` echo "Versions: $VERSIONS" echo "versions=$VERSIONS" >> $GITHUB_OUTPUT - # Exclude il2cpp for Unity 2019.2 or earlier - LINUX_EXCLUDES="$LINUX_EXCLUDES `echo \"$VERSIONS\" | jq -c '[ .[] | select(test(\"2018|2019.1|2019.2\")) | { version: ., module: \"linux-il2cpp\"} ]'`" + # Unity 2021.1 and 2021.2 do not build il2cpp properly and will be skipped + WINDOWS_EXCLUDES="$WINDOWS_EXCLUDES `echo \"$VERSIONS\" | jq -c '[ .[] | select(test(\"2021.1|2021.2\")) | { version: ., module: \"windows-il2cpp\"} ]'`" - # Exclude il2cpp for Unity 2019.2 or earlier. Unity 2021.1 and 2021.2 also do not build properly and will be skipped - WINDOWS_EXCLUDES="$WINDOWS_EXCLUDES `echo \"$VERSIONS\" | jq -c '[ .[] | select(test(\"2018|2019.1|2019.2|2021.1|2021.2\")) | { version: ., module: \"windows-il2cpp\"} ]'`" + # Issues with 2021.1 and 2021.2 on Universal Windows Platform so they are skipped + WINDOWS_EXCLUDES="$WINDOWS_EXCLUDES `echo \"$VERSIONS\" | jq -c '[ .[] | select(test(\"2021.1|2021.2\")) | { version: ., module: \"universal-windows-platform\"} ]'`" - # Universal Windows Platform is added in 2019. Issues with 2021.1 and 2021.2 so they are skipped too - WINDOWS_EXCLUDES="$WINDOWS_EXCLUDES `echo \"$VERSIONS\" | jq -c '[ .[] | select(test(\"2018|2019.1|2021.1|2021.2\")) | { version: ., module: \"universal-windows-platform\"} ]'`" + # Issues with 2021.1 and 2021.2 on AppleTV so they are skipped + WINDOWS_EXCLUDES="$WINDOWS_EXCLUDES `echo \"$VERSIONS\" | jq -c '[ .[] | select(test(\"2021.1|2021.2\")) | { version: ., module: \"appletv\"} ]'`" - # AppleTV isn't stable until 2019.2. Issues with 2021.1 and 2021.2 so they are skipped too - WINDOWS_EXCLUDES="$WINDOWS_EXCLUDES `echo \"$VERSIONS\" | jq -c '[ .[] | select(test(\"2018|2019.1|2021.1|2021.2\")) | { version: ., module: \"appletv\"} ]'`" + # Issues with 2021.1 and 2021.2 on Android so they are skipped + WINDOWS_EXCLUDES="$WINDOWS_EXCLUDES `echo \"$VERSIONS\" | jq -c '[ .[] | select(test(\"2021.1|2021.2\")) | { version: ., module: \"android\"} ]'`" - # No Windows 2018 Android Builds. Issues with 2021.1 and 2021.2 so they are skipped too - WINDOWS_EXCLUDES="$WINDOWS_EXCLUDES `echo \"$VERSIONS\" | jq -c '[ .[] | select(test(\"2018|2021.1|2021.2\")) | { version: ., module: \"android\"} ]'`" - - # No Windows mono Builds for Unity 2019.2 or earlier. Issues with 2021.1 and 2021.2 so they are skipped too - WINDOWS_EXCLUDES="$WINDOWS_EXCLUDES `echo \"$VERSIONS\" | jq -c '[ .[] | select(test(\"2018|2019.1|2019.2|2021.1|2021.2\")) | { version: ., module: \"base\"} ]'`" + # Issues with 2021.1 and 2021.2 on Mono so they are skipped + WINDOWS_EXCLUDES="$WINDOWS_EXCLUDES `echo \"$VERSIONS\" | jq -c '[ .[] | select(test(\"2021.1|2021.2\")) | { version: ., module: \"base\"} ]'`" LINUX_EXCLUDES=`echo "$LINUX_EXCLUDES" | jq -s -c 'flatten'` WINDOWS_EXCLUDES=`echo "$WINDOWS_EXCLUDES" | jq -s -c 'flatten'` @@ -369,6 +369,12 @@ jobs: - name: Build project uses: game-ci/unity-builder@main timeout-minutes: 35 + # Only run if not a PR as we need access to secrets + if: github.base_ref == '' + env: + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} with: unityVersion: ${{ matrix.version }} customImage: editor:ubuntu-dev @@ -385,9 +391,13 @@ jobs: # Set WebGL compression format to gzip sed -i -e 's/webGLCompressionFormat: .*$/webGLCompressionFormat: 1/' reference-project-test/ProjectSettings/ProjectSettings.asset - name: Build project (GZip) - if: env.MODULE == 'webgl' + if: env.MODULE == 'webgl' && github.base_ref == '' uses: game-ci/unity-builder@main timeout-minutes: 15 + env: + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} with: unityVersion: ${{ matrix.version }} customImage: editor:ubuntu-dev @@ -404,9 +414,13 @@ jobs: # Set WebGL compression format to brotli sed -i -e 's/webGLCompressionFormat: .*$/webGLCompressionFormat: 0/' reference-project-test/ProjectSettings/ProjectSettings.asset - name: Build project (Brotli) - if: env.MODULE == 'webgl' + if: env.MODULE == 'webgl' && github.base_ref == '' uses: game-ci/unity-builder@main timeout-minutes: 15 + env: + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} with: unityVersion: ${{ matrix.version }} customImage: editor:ubuntu-dev @@ -420,6 +434,12 @@ jobs: - name: Test project timeout-minutes: 10 uses: game-ci/unity-test-runner@main + # Only run if not a PR as we need access to secrets + if: github.base_ref == '' + env: + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} with: unityVersion: ${{ matrix.version }} customImage: editor:ubuntu-dev diff --git a/images/ubuntu/hub/Dockerfile b/images/ubuntu/hub/Dockerfile index e3df9488..c7adf185 100644 --- a/images/ubuntu/hub/Dockerfile +++ b/images/ubuntu/hub/Dockerfile @@ -1,6 +1,6 @@ ARG baseImage="unityci/base" FROM $baseImage -ARG hubVersion="3.4.2" +ARG hubVersion="3.7.0" # Hub dependencies RUN apt-get -q update \ diff --git a/images/windows/editor/scripts/HelperFunctions.ps1 b/images/windows/editor/scripts/HelperFunctions.ps1 index eee111df..c71828f0 100644 --- a/images/windows/editor/scripts/HelperFunctions.ps1 +++ b/images/windows/editor/scripts/HelperFunctions.ps1 @@ -6,15 +6,15 @@ function CheckLastExitCode { param ([int[]]$SuccessCodes = @(0), [scriptblock]$CleanupScript=$null) if ($SuccessCodes -notcontains $LastExitCode) { - if ($CleanupScript) { - "Executing cleanup script: $CleanupScript" - &$CleanupScript - } - $msg = @" + if ($CleanupScript) { + "Executing cleanup script: $CleanupScript" + &$CleanupScript + } + $msg = @" EXE RETURNED EXIT CODE $LastExitCode CALLSTACK:$(Get-PSCallStack | Out-String) "@ - throw $msg + throw $msg } } @@ -25,24 +25,37 @@ CALLSTACK:$(Get-PSCallStack | Out-String) function Get-ModuleDestinationPath { param ( - $ModuleList, - $ModuleID, - $UnityPath + $ModuleList, + $ModuleID, + $UnityPath ) $index=$ModuleList.FindIndex( {$args[0].id.contains($ModuleID)} ) $rawPath=$ModuleList[$index].destination + + if ($null -eq $rawPath) { + throw "Unable to get a destination path for $ModuleID" + } + return $rawPath.Replace('{UNITY_PATH}', $UnityPath) } function Get-ModuleRenamedPath { param ( - $ModuleList, - $ModuleID, - $UnityPath + $ModuleList, + $ModuleID, + $UnityPath ) $index=$ModuleList.FindIndex( {$args[0].id.contains($ModuleID)} ) $rawPath=$ModuleList[$index].extractedPathRename.to + +if ($null -eq $rawPath) { + $rawPath=$ModuleList[$index].renameTo + if ($null -eq $rawPath) { + throw "Unable to get a ModuleRenamedPath for $ModuleID" + } +} + return $rawPath.Replace('{UNITY_PATH}', $UnityPath) }