Skip to content

Commit 5f435a1

Browse files
authored
feat: Unify main & non-main CI runs (#1941)
1 parent e13d387 commit 5f435a1

File tree

1 file changed

+19
-52
lines changed

1 file changed

+19
-52
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,19 @@ jobs:
255255
unity-version: ["2019", "2022", "6000"]
256256
platform: ["Android", "WebGL", "Linux", "iOS"]
257257
include:
258+
- platform: iOS
259+
check_symbols: false
260+
build_platform: iOS
261+
- platform: Android
262+
check_symbols: false
263+
build_platform: Android-Export
264+
- platform: WebGL
265+
check_symbols: true
266+
build_platform: WebGL
258267
- platform: Linux
259268
image-suffix: "-il2cpp"
269+
check_symbols: true
270+
build_platform: Linux
260271
env:
261272
UNITY_PATH: docker exec unity unity-editor
262273
steps:
@@ -317,54 +328,10 @@ jobs:
317328
run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}"
318329

319330
- name: Configure Sentry
320-
run: |
321-
$isAndroid = ('${{ matrix.platform }}' -eq 'Android')
322-
$isNotMainBranch = ('${{ github.ref_name }}' -ne 'main')
323-
$platform = if ($isAndroid -and $isNotMainBranch) { 'Android-Export' } else { '${{ matrix.platform }}' }
324-
325-
./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform $platform -CheckSymbols
326-
327-
# Dear lord, I don't know why we have to do this: If we do not "pre-build" the project then `exportAsGoogleAndroidProject` will stay `false` in `IPostGenerateGradleAndroidProject`
328-
# and breaking all further steps in CI
329-
# Things I tried:
330-
# 1. Setting the flag and restarting the editor prior to build
331-
# 2. Setting the flag and reloading the domain in a step prior to building
332-
# 3. Reloading the domain prior to building (does not work - build fails with a domain reload pending)
333-
- name: Pre-Build Project for Unity 6 and Android
334-
continue-on-error: true
335-
if: ${{ matrix.unity-version == '6000' && matrix.platform == 'Android' }}
336-
run: |
337-
$platform = '${{ matrix.platform }}'
338-
if ('${{ github.ref_name }}' -ne 'main')
339-
{
340-
$checkSymbols = $false
341-
$platform = 'Android-Export'
342-
}
343-
else
344-
{
345-
$checkSymbols = $false
346-
}
347-
348-
./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform $platform -CheckSymbols:$checkSymbols -UnityVersion "${{ matrix.unity-version }}"
349-
Remove-Item -Path samples/IntegrationTest/Build -Recurse -Force -Confirm:$false
350-
331+
run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols
332+
351333
- name: Build Project
352-
run: |
353-
$platform = '${{ matrix.platform }}'
354-
if ($platform -eq 'iOS')
355-
{
356-
$checkSymbols = $false
357-
}
358-
elseif (($platform -eq 'Android') -and ('${{ github.ref_name }}' -ne 'main'))
359-
{
360-
$checkSymbols = $false
361-
$platform = 'Android-Export'
362-
}
363-
else
364-
{
365-
$checkSymbols = $true
366-
}
367-
./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform $platform -CheckSymbols:$checkSymbols -UnityVersion "${{ matrix.unity-version }}"
334+
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$${{ matrix.check_symbols }} -UnityVersion "${{ matrix.unity-version }}"
368335

369336
# We create tar explicitly because upload-artifact is slow for many files.
370337
- name: Create archive
@@ -514,11 +481,11 @@ jobs:
514481

515482
- name: Setup Android
516483
uses: android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc # pin@v2
517-
if: ${{ matrix.platform == 'Android' && github.ref_name != 'main' }}
484+
if: ${{ matrix.platform == 'Android' }}
518485

519486
- name: Setup NDK
520487
uses: nttld/setup-ndk@8c3b609ff4d54576ea420551943fd34b4d03b0dc # pin@v1
521-
if: ${{ matrix.platform == 'Android' && github.ref_name != 'main' }}
488+
if: ${{ matrix.platform == 'Android' }}
522489
id: setup-ndk
523490
with:
524491
ndk-version: ${{ matrix.ndk }}
@@ -527,22 +494,22 @@ jobs:
527494
# We modify the exported gradle project to deal with the different build-environment
528495
# I.e. we're fixing the paths for SDK & NDK that have been hardcoded to point at the Unity installation
529496
- name: Modify gradle project
530-
if: ${{ matrix.platform == 'Android' && github.ref_name != 'main' }}
497+
if: ${{ matrix.platform == 'Android' }}
531498
run: |
532499
./test/Scripts.Integration.Test/modify-gradle-project.ps1 `
533500
-AndroidSdkRoot $env:ANDROID_SDK_ROOT `
534501
-NdkPath ${{ steps.setup-ndk.outputs.ndk-path }} `
535502
-UnityVersion ${{ matrix.unity-version }}
536503
537504
- name: Setup JDK 17 for Unity 6
538-
if: ${{ matrix.platform == 'Android' && github.ref_name != 'main' && matrix.unity-version == '6000' }}
505+
if: ${{ matrix.platform == 'Android' && matrix.unity-version == '6000' }}
539506
uses: actions/setup-java@v3
540507
with:
541508
java-version: '17'
542509
distribution: 'temurin'
543510

544511
- name: Android smoke test
545-
if: ${{ matrix.platform == 'Android' && github.ref_name != 'main' }}
512+
if: ${{ matrix.platform == 'Android' }}
546513
run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ matrix.unity-version }}"
547514
env:
548515
JAVA_HOME: ${{ env.JAVA_HOME }}

0 commit comments

Comments
 (0)