Skip to content

Commit

Permalink
Fix Image Build Errors on 2023.2.4f1+ (#236)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
AndrewKahr authored Jan 8, 2024
1 parent 8722a6d commit 33cc94c
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 31 deletions.
56 changes: 38 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>\n <License id=\"Terms\">\n <MachineBindings>\n <Binding Key=\"1\" Value=\"576562626572264761624c65526f7578\"/>\n <Binding Key=\"2\" Value=\"576562626572264761624c65526f7578\"/>\n </MachineBindings>\n <MachineID Value=\"D7nTUnjNAmtsUMcnoyrqkgIbYdM=\"/>\n <SerialHash Value=\"2033b8ac3e6faa3742ca9f0bfae44d18f2a96b80\"/>\n <Features>\n <Feature Value=\"33\"/>\n <Feature Value=\"1\"/>\n <Feature Value=\"12\"/>\n <Feature Value=\"2\"/>\n <Feature Value=\"24\"/>\n <Feature Value=\"3\"/>\n <Feature Value=\"36\"/>\n <Feature Value=\"17\"/>\n <Feature Value=\"19\"/>\n <Feature Value=\"62\"/>\n </Features>\n <DeveloperData Value=\"AQAAAEY0LUJHUlgtWEQ0RS1aQ1dWLUM1SlctR0RIQg==\"/>\n <SerialMasked Value=\"F4-BGRX-XD4E-ZCWV-C5JW-XXXX\"/>\n <StartDate Value=\"2021-02-08T00:00:00\"/>\n <UpdateDate Value=\"2021-02-09T00:34:57\"/>\n <InitialActivationDate Value=\"2021-02-08T00:34:56\"/>\n <LicenseVersion Value=\"6.x\"/>\n <ClientProvidedVersion Value=\"2018.4.30f1\"/>\n <AlwaysOnline Value=\"false\"/>\n <Entitlements>\n <Entitlement Ns=\"unity_editor\" Tag=\"UnityPersonal\" Type=\"EDITOR\" ValidTo=\"9999-12-31T00:00:00\"/>\n <Entitlement Ns=\"unity_editor\" Tag=\"DarkSkin\" Type=\"EDITOR_FEATURE\" ValidTo=\"9999-12-31T00:00:00\"/>\n </Entitlements>\n </License>\n<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\"/><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/><Reference URI=\"#Terms\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/><DigestValue>m0Db8UK+ktnOLJBtHybkfetpcKo=</DigestValue></Reference></SignedInfo><SignatureValue>o/pUbSQAukz7+ZYAWhnA0AJbIlyyCPL7bKVEM2lVqbrXt7cyey+umkCXamuOgsWPVUKBMkXtMH8L\n5etLmD0getWIhTGhzOnDCk+gtIPfL4jMo9tkEuOCROQAXCci23VFscKcrkB+3X6h4wEOtA2APhOY\nB+wvC794o8/82ffjP79aVAi57rp3Wmzx+9pe9yMwoJuljAy2sc2tIMgdQGWVmOGBpQm3JqsidyzI\nJWG2kjnc7pDXK9pwYzXoKiqUqqrut90d+kQqRyv7MSZXR50HFqD/LI69h68b7P8Bjo3bPXOhNXGR\n9YCoemH6EkfCJxp2gIjzjWW+l2Hj2EsFQi8YXw==</SignatureValue></Signature></root>"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
##########################
Expand Down Expand Up @@ -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'`
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion images/ubuntu/hub/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
37 changes: 25 additions & 12 deletions images/windows/editor/scripts/HelperFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand All @@ -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)
}

Expand Down

0 comments on commit 33cc94c

Please sign in to comment.