1414 name : Ui tests
1515 runs-on : ubuntu-latest
1616
17- # we copy the secret to the env variable in order to access it in the workflow
18- env :
19- SAUCE_USERNAME : ${{ secrets.SAUCE_USERNAME }}
20- SAUCE_ACCESS_KEY : ${{ secrets.SAUCE_ACCESS_KEY }}
21-
2217 steps :
2318 - name : Git checkout
2419 uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -32,65 +27,45 @@ jobs:
3227 - name : Setup Gradle
3328 uses : gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1
3429
35- # Clean, build and release a test apk, but only if we will run the benchmark
36- - name : Make assembleUiTests
37- if : env.SAUCE_USERNAME != null
38- run : make assembleUiTests
39-
40- - name : Install SauceLabs CLI
41- uses : saucelabs/saucectl-run-action@283660aa934c02723c497efa151d582a3acc5801 # pin@v4.5.0
42- env :
43- GITHUB_TOKEN : ${{ github.token }}
44- with :
45- skip-run : true
46- if : env.SAUCE_USERNAME != null
47-
48- - name : Run Tests
49- id : saucelabs
50- env :
51- GITHUB_TOKEN : ${{ github.token }}
52- run : |
53- exec &> >(tee -a "test_logs.txt")
54- saucectl run -c .sauce/sentry-uitest-android-ui.yml
55- if : env.SAUCE_USERNAME != null
56- continue-on-error : true
57-
58- - name : Verify Test Results
30+ - name : Enable KVM
5931 run : |
60- processCrashed=$(cat test_logs.txt | grep "Instrumentation run failed due to 'Process crashed.'" | wc -l)
61- suiteTimedOut=$(cat test_logs.txt | grep "Suite timed out" | wc -l)
62- if [[ ${{ steps.saucelabs.outcome }} == 'success' ]]; then
63- exit 0
64- elif [[ "$processCrashed" -ne 0 ]]; then
65- exit 0
66- elif [[ "$suiteTimedOut" -ne 0 ]]; then
67- exit 0
68- else
69- exit 1
70- fi
71- if : env.SAUCE_USERNAME != null
32+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
33+ sudo udevadm control --reload-rules
34+ sudo udevadm trigger --name-match=kvm
7235
36+ - name : AVD cache
37+ uses : actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
38+ id : avd-cache
39+ with :
40+ path : |
41+ ~/.android/avd/*
42+ ~/.android/adb*
43+ key : avd-api-35-x86_64-google_apis
7344
74- - name : Install Sentry CLI
75- if : ${{ !cancelled() && env.SAUCE_USERNAME != null }}
76- uses : getsentry/action-setup-cli@70d7e587b84c2e78cf4d37cd33d7b74fb3729c1b # v1
45+ - name : Create AVD and generate snapshot for caching
46+ if : steps.avd-cache.outputs.cache-hit != 'true'
47+ uses : reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # pin@v2
48+ with :
49+ api-level : 35
50+ target : google_apis
51+ channel : canary
52+ arch : x86_64
53+ force-avd-creation : false
54+ disable-animations : true
55+ disable-spellchecker : true
56+ emulator-options : -memory 4096 -no-window -gpu auto -noaudio -no-boot-anim -camera-back none
57+ disk-size : 4096M
58+ script : echo "Generated AVD snapshot for caching."
7759
78- - name : Upload Replay Snapshots to Sentry
79- # Skip on PRs from forks, which don't have access to the upload secret
80- if : ${{ !cancelled() && env.SAUCE_USERNAME != null && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
81- run : |
82- # find instead of `shopt -s globstar`, which macOS's bash 3.2 doesn't support
83- mkdir -p replay-snapshots
84- if [ -d artifacts ]; then
85- find artifacts -type f -name '*.png' -exec cp {} replay-snapshots/ \;
86- fi
87- if [ -n "$(ls -A replay-snapshots)" ]; then
88- sentry-cli snapshots upload ./replay-snapshots \
89- --app-id sentry-android-replay
90- else
91- echo "No replay snapshot files found, skipping upload"
92- fi
93- env :
94- SENTRY_AUTH_TOKEN : ${{ secrets.SENTRY_AUTH_TOKEN }}
95- SENTRY_ORG : sentry-sdks
96- SENTRY_PROJECT : sentry-android
60+ - name : Run tests
61+ uses : reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # pin@v2
62+ with :
63+ api-level : 35
64+ target : google_apis
65+ channel : canary
66+ arch : x86_64
67+ force-avd-creation : false
68+ disable-animations : true
69+ disable-spellchecker : true
70+ emulator-options : -memory 4096 -no-window -gpu auto -noaudio -no-boot-anim -camera-back none -no-snapshot-save
71+ script : ./gradlew :sentry-android-integration-tests:sentry-uitest-android:connectedReleaseAndroidTest -Denvironment=github
0 commit comments