-
-
Notifications
You must be signed in to change notification settings - Fork 475
Expand file tree
/
Copy pathintegration-tests-ui-critical.yml
More file actions
169 lines (149 loc) · 6.95 KB
/
Copy pathintegration-tests-ui-critical.yml
File metadata and controls
169 lines (149 loc) · 6.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: UI Tests Critical
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
BASE_PATH: "sentry-android-integration-tests/sentry-uitest-android-critical"
BUILD_PATH: "build/outputs/apk/release"
APK_NAME: "sentry-uitest-android-critical-release.apk"
APK_ARTIFACT_NAME: "sentry-uitest-android-critical-release"
MAESTRO_VERSION: "2.1.0"
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Java 17
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
with:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: Build debug APK
run: make assembleUiTestCriticalRelease
- name: Upload APK artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: ${{env.APK_ARTIFACT_NAME}}
path: "${{env.BASE_PATH}}/${{env.BUILD_PATH}}/${{env.APK_NAME}}"
retention-days: 1
run-maestro-tests:
name: Run Tests for API Level ${{ matrix.api-level }}
needs: build
runs-on: ubuntu-latest
strategy:
# we want that the matrix keeps running, default is to cancel them if it fails.
fail-fast: false
matrix:
include:
- api-level: 31 # Android 12
target: google_apis
channel: canary # Necessary for ATDs
arch: x86_64
- api-level: 33 # Android 13
target: google_apis
channel: canary # Necessary for ATDs
arch: x86_64
- api-level: 35 # Android 15
target: google_apis
channel: canary # Necessary for ATDs
arch: x86_64
- api-level: 36 # Android 16
target: google_apis
channel: canary # Necessary for ATDs
arch: x86_64
- api-level: "37.0" # Android 17 platform id (quoted — YAML parses 37.0 as float 37)
system-image-api-level: "37"
target: google_apis
channel: canary
arch: x86_64
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Enable KVM
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
- name: AVD cache
uses: actions/cache@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-api-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }}
- name: Probe API 37 system image on GHA
if: matrix.api-level == '37.0'
id: api37-image
run: |
SDKMANAGER="${ANDROID_SDK_ROOT:-/usr/local/lib/android/sdk}/cmdline-tools/latest/bin/sdkmanager"
yes | "$SDKMANAGER" --licenses > /dev/null
if "$SDKMANAGER" --list --channel=3 2>/dev/null | grep -q 'system-images;android-37;google_apis;x86_64'; then
echo "available=true" >> "$GITHUB_OUTPUT"
else
echo "available=false" >> "$GITHUB_OUTPUT"
echo "::warning title=API 37 system image unavailable::system-images;android-37;google_apis;x86_64 is not published on GHA yet. Skipping API 37 emulator tests until the checklist readiness gate passes."
fi
- name: Skip API 37 emulator tests (system image not on GHA)
if: matrix.api-level == '37.0' && steps.api37-image.outputs.available != 'true'
run: echo "API 37 emulator tests skipped — system image not available on GHA runners."
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true' && (matrix.api-level != '37.0' || steps.api37-image.outputs.available == 'true')
uses: reactivecircus/android-emulator-runner@e89f39f1abbbd05b1113a29cf4db69e7540cae5a # pin@v2
with:
api-level: ${{ matrix.api-level }}
system-image-api-level: ${{ matrix.system-image-api-level || matrix.api-level }}
target: ${{ matrix.target }}
channel: ${{ matrix.channel }}
arch: ${{ matrix.arch }}
force-avd-creation: false
disable-animations: true
disable-spellchecker: true
emulator-options: -memory 4096 -no-window -gpu auto -noaudio -no-boot-anim -camera-back none
disk-size: 4096M
script: echo "Generated AVD snapshot for caching."
- name: Download APK artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: ${{env.APK_ARTIFACT_NAME}}
- name: Install Maestro
uses: dniHze/maestro-test-action@bda8a93211c86d0a05b7a4597c5ad134566fbde4 # pin@v1.0.0
with:
version: ${{env.MAESTRO_VERSION}}
- name: Run tests
if: matrix.api-level != '37.0' || steps.api37-image.outputs.available == 'true'
uses: reactivecircus/android-emulator-runner@e89f39f1abbbd05b1113a29cf4db69e7540cae5a # pin@v2.37.0
with:
api-level: ${{ matrix.api-level }}
system-image-api-level: ${{ matrix.system-image-api-level || matrix.api-level }}
target: ${{ matrix.target }}
channel: ${{ matrix.channel }}
arch: ${{ matrix.arch }}
force-avd-creation: false
disable-animations: true
disable-spellchecker: true
emulator-options: -memory 4096 -no-window -gpu auto -noaudio -no-boot-anim -camera-back none -no-snapshot-save
script: |
adb uninstall io.sentry.uitest.android.critical || echo "Already uninstalled (or not found)"
adb install -r -d "${{env.APK_NAME}}"
mkdir "${{env.BASE_PATH}}/maestro-logs/" || true; adb emu screenrecord start --time-limit 360 "${{env.BASE_PATH}}/maestro-logs/recording.webm" || true; maestro test "${{env.BASE_PATH}}/maestro" --test-output-dir="${{env.BASE_PATH}}/maestro-logs/test-output" || MAESTRO_EXIT_CODE=$?; adb emu screenrecord stop || true; adb logcat -d > "${{env.BASE_PATH}}/maestro-logs/logcat.txt" || true; exit ${MAESTRO_EXIT_CODE:-0}
- name: Upload Maestro test results
if: ${{ always() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: maestro-logs-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }}
path: "${{env.BASE_PATH}}/maestro-logs"
retention-days: 1