Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Unify main & non-main CI runs #1941

Merged
merged 48 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
d5cdc09
reworked android device tests
bitsandfoxes Dec 16, 2024
24ab788
fix emulator
bitsandfoxes Dec 16, 2024
6324708
fixed log
bitsandfoxes Dec 16, 2024
20c69d0
closing this should not be that hard
bitsandfoxes Dec 16, 2024
91c4bfa
wait for emulator
bitsandfoxes Dec 17, 2024
5ca3ee2
API levels
bitsandfoxes Dec 17, 2024
c8cea8c
fail test
bitsandfoxes Dec 17, 2024
8bc2a64
fixed KVM permissions
bitsandfoxes Dec 17, 2024
bf2fc93
exit instead of return
bitsandfoxes Dec 17, 2024
a727aa8
simplify emulator setup
bitsandfoxes Dec 17, 2024
b40efd1
increase timeout. by a lot.
bitsandfoxes Dec 17, 2024
7a23993
fix OnQuit detection
bitsandfoxes Dec 18, 2024
5271f5f
log structure
bitsandfoxes Dec 18, 2024
8d94d03
timeout for getpid
bitsandfoxes Dec 18, 2024
28e92ae
log quit even later
bitsandfoxes Dec 18, 2024
7ccbc10
logging and delay
bitsandfoxes Dec 18, 2024
deb2c35
smoke tester logging
bitsandfoxes Dec 18, 2024
6bc40fe
always log logcat
bitsandfoxes Dec 18, 2024
1f44a1e
make it run solo
bitsandfoxes Dec 18, 2024
ba08950
need to cache the logs
bitsandfoxes Dec 18, 2024
157eb7e
don't clear logcat
bitsandfoxes Dec 18, 2024
5c7c3ee
forgot to initialize
bitsandfoxes Dec 18, 2024
e263851
reduce timeout
bitsandfoxes Dec 18, 2024
979d39d
always retry
bitsandfoxes Dec 18, 2024
c9232c8
fixed log caching
bitsandfoxes Dec 18, 2024
04690b9
fixed retry
bitsandfoxes Dec 18, 2024
f00e990
increased timeout
bitsandfoxes Dec 18, 2024
e0e72eb
added timing logging
bitsandfoxes Dec 18, 2024
a68505e
fixed retry success check
bitsandfoxes Dec 18, 2024
ea025cb
fixed API
bitsandfoxes Dec 18, 2024
9ab10eb
run CI
bitsandfoxes Dec 18, 2024
bf8ae36
wrap running tests in retry
bitsandfoxes Dec 18, 2024
d4ad433
typo
bitsandfoxes Dec 18, 2024
460f0b3
don't exit on pid issue
bitsandfoxes Dec 18, 2024
a16e677
can't write-error
bitsandfoxes Dec 18, 2024
1e61dde
logging
bitsandfoxes Dec 18, 2024
d1a9755
restored flow
bitsandfoxes Dec 18, 2024
9163732
timeout for starting activity
bitsandfoxes Dec 18, 2024
4beee9d
removed retry wrapper for android smoke test job
bitsandfoxes Dec 19, 2024
d624243
simplification
bitsandfoxes Dec 19, 2024
11e8564
fixed boolean
bitsandfoxes Dec 19, 2024
2b3e6b4
fixed missing platform on iOS
bitsandfoxes Dec 19, 2024
64453c3
using 0/1 instead of string
bitsandfoxes Dec 19, 2024
dbbea6a
no more non-main nonsense
bitsandfoxes Dec 19, 2024
59de327
missed one check
bitsandfoxes Dec 20, 2024
ddb5b2b
merged
bitsandfoxes Dec 20, 2024
c2ae0b3
Merge branch 'main' into feat/init-native-first
bitsandfoxes Jan 8, 2025
edcfedf
Apply suggestions from code review
bitsandfoxes Jan 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions .github/workflows/android-smoke-test-wrapper.yml

This file was deleted.

51 changes: 27 additions & 24 deletions .github/workflows/android-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ on:
api-level:
required: true
type: string
try:
required: true
type: number
# Map the workflow outputs to job outputs
outputs:
outcome:
description:
value: ${{ jobs.run.outputs.outcome }}
status:
description: "Smoke test status"
value: ${{ jobs.run.outputs.status }}

jobs:
run:
name: try-${{ inputs.try }}
runs-on: macos-latest
name: Android Smoke Test
runs-on: ubuntu-latest
env:
ARTIFACTS_PATH: samples/IntegrationTest/test-artifacts/
HOMEBREW_NO_INSTALL_CLEANUP: 1
Expand All @@ -28,17 +25,24 @@ jobs:
shell: pwsh
# Map the job outputs to step outputs
outputs:
outcome: ${{ steps.smoke-test.outcome }}
status: ${{ steps.smoke-test.outputs.status }}
steps:
- name: Checkout
uses: actions/checkout@v3

uses: actions/checkout@v4
bitsandfoxes marked this conversation as resolved.
Show resolved Hide resolved
- name: Download test app artifact
uses: actions/download-artifact@v4
with:
name: testapp-Android-compiled-${{ inputs.unity-version }}
path: samples/IntegrationTest/Build

# See https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

# outputs variables: api-level, label, target
- name: Configure Android Settings
id: config
Expand All @@ -64,29 +68,28 @@ jobs:
"target=$target" >> $env:GITHUB_OUTPUT
"api-level=$apiLevel" >> $env:GITHUB_OUTPUT
"label=$($label ?? $apiLevel)" >> $env:GITHUB_OUTPUT

- name: Android API ${{ steps.config.outputs.label }} emulator setup + Smoke test
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b # pin@v2.28.0
bitsandfoxes marked this conversation as resolved.
Show resolved Hide resolved
- name: Run Android Smoke Tests
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b # pin@v233.0
bitsandfoxes marked this conversation as resolved.
Show resolved Hide resolved
id: smoke-test
timeout-minutes: 40
continue-on-error: true
timeout-minutes: 30
with:
api-level: ${{ steps.config.outputs.api-level }}
target: ${{ steps.config.outputs.target }}
force-avd-creation: false
ram-size: 2048M
arch: x86_64
cores: 3
emulator-boot-timeout: 1800
disk-size: 4096M # Some runs have out of storage error when installing the smoke test.
emulator-options: -no-snapshot-save -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -accel on
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: pwsh ./scripts/smoke-test-android.ps1 -IsIntegrationTest -WarnIfFlaky
arch: x86_64
script: |
adb wait-for-device
adb shell input keyevent 82
adb devices -l
pwsh ./scripts/smoke-test-android.ps1 -IsIntegrationTest -WarnIfFlaky

- name: Upload artifacts on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: testapp-android-logs-${{ inputs.api-level }}-${{ inputs.unity-version }}-${{ inputs.try }}
path: ${{ env.ARTIFACTS_PATH }}
retention-days: 14
retention-days: 14
bitsandfoxes marked this conversation as resolved.
Show resolved Hide resolved
86 changes: 21 additions & 65 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,19 @@ jobs:
unity-version: ["2019", "2022", "6000"]
platform: ["Android", "WebGL", "Linux", "iOS"]
include:
- platform: iOS
check_symbols: false
build_platform: iOS
- platform: Android
check_symbols: false
build_platform: Android-Export
- platform: WebGL
check_symbols: true
build_platform: WebGL
- platform: Linux
image-suffix: "-il2cpp"
check_symbols: true
build_platform: Linux
env:
UNITY_PATH: docker exec unity unity-editor
steps:
Expand Down Expand Up @@ -309,54 +320,10 @@ jobs:
run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}"

- name: Configure Sentry
run: |
$isAndroid = ('${{ matrix.platform }}' -eq 'Android')
$isNotMainBranch = ('${{ github.ref_name }}' -ne 'main')
$platform = if ($isAndroid -and $isNotMainBranch) { 'Android-Export' } else { '${{ matrix.platform }}' }

./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform $platform -CheckSymbols

# 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`
# and breaking all further steps in CI
# Things I tried:
# 1. Setting the flag and restarting the editor prior to build
# 2. Setting the flag and reloading the domain in a step prior to building
# 3. Reloading the domain prior to building (does not work - build fails with a domain reload pending)
- name: Pre-Build Project for Unity 6 and Android
continue-on-error: true
if: ${{ matrix.unity-version == '6000' && matrix.platform == 'Android' }}
run: |
$platform = '${{ matrix.platform }}'
if ('${{ github.ref_name }}' -ne 'main')
{
$checkSymbols = $false
$platform = 'Android-Export'
}
else
{
$checkSymbols = $false
}

./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform $platform -CheckSymbols:$checkSymbols -UnityVersion "${{ matrix.unity-version }}"
Remove-Item -Path samples/IntegrationTest/Build -Recurse -Force -Confirm:$false

run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols

- name: Build Project
run: |
$platform = '${{ matrix.platform }}'
if ($platform -eq 'iOS')
{
$checkSymbols = $false
}
elseif (($platform -eq 'Android') -and ('${{ github.ref_name }}' -ne 'main'))
{
$checkSymbols = $false
$platform = 'Android-Export'
}
else
{
$checkSymbols = $true
}
./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform $platform -CheckSymbols:$checkSymbols -UnityVersion "${{ matrix.unity-version }}"
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$${{ matrix.check_symbols }} -UnityVersion "${{ matrix.unity-version }}"

# We create tar explicitly because upload-artifact is slow for many files.
- name: Create archive
Expand Down Expand Up @@ -463,26 +430,15 @@ jobs:
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [mobile-smoke-test-compile]
name: ${{ matrix.unity-version }} Android ${{ matrix.api-level }} Run Smoke Test
uses: ./.github/workflows/android-smoke-test-wrapper.yml
uses: ./.github/workflows/android-smoke-test.yml
with:
unity-version: ${{ matrix.unity-version }}
api-level: ${{ matrix.api-level }}
strategy:
fail-fast: false
matrix:
api-level: [27, 28, 29, 30, 31] # last updated October 2022
api-level: [27, 31, 34] # last updated Dezember 2024
bitsandfoxes marked this conversation as resolved.
Show resolved Hide resolved
unity-version: ["2019", "2022", "6000"]
include:
# API 21 is barely used but let's check it as the minimum supported version for now.
- api-level: 21
unity-version: "2019"
exclude:
# Seems like there's an error in Unity with Android API 30 - disabling.
# https://github.com/getsentry/sentry-unity/issues/719#issuecomment-1129129952
- api-level: 30
unity-version: "2021"
- api-level: 30
unity-version: "2022"

mobile-smoke-test-compile:
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
Expand Down Expand Up @@ -517,11 +473,11 @@ jobs:

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

- name: Setup NDK
uses: nttld/setup-ndk@8c3b609ff4d54576ea420551943fd34b4d03b0dc # pin@v1
if: ${{ matrix.platform == 'Android' && github.ref_name != 'main' }}
if: ${{ matrix.platform == 'Android' }}
id: setup-ndk
with:
ndk-version: ${{ matrix.ndk }}
Expand All @@ -530,22 +486,22 @@ jobs:
# We modify the exported gradle project to deal with the different build-environment
# I.e. we're fixing the paths for SDK & NDK that have been hardcoded to point at the Unity installation
- name: Modify gradle project
if: ${{ matrix.platform == 'Android' && github.ref_name != 'main' }}
if: ${{ matrix.platform == 'Android' }}
run: |
./test/Scripts.Integration.Test/modify-gradle-project.ps1 `
-AndroidSdkRoot $env:ANDROID_SDK_ROOT `
-NdkPath ${{ steps.setup-ndk.outputs.ndk-path }} `
-UnityVersion ${{ matrix.unity-version }}

- name: Setup JDK 17 for Unity 6
if: ${{ matrix.platform == 'Android' && github.ref_name != 'main' && matrix.unity-version == '6000' }}
if: ${{ matrix.platform == 'Android' && matrix.unity-version == '6000' }}
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Android smoke test
if: ${{ matrix.platform == 'Android' && github.ref_name != 'main' }}
if: ${{ matrix.platform == 'Android' }}
run: ./scripts/smoke-test-android.ps1 Build -IsIntegrationTest -UnityVersion "${{ matrix.unity-version }}"
env:
JAVA_HOME: ${{ env.JAVA_HOME }}
Expand Down
Loading
Loading