-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (121 loc) · 4.69 KB
/
e2e-android.yml
File metadata and controls
134 lines (121 loc) · 4.69 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
name: Android E2E
on:
workflow_call:
inputs:
devices:
description: 'JSON array of device names to test (e.g. ["max"] or ["min","max"])'
type: string
default: '["max"]'
timeout-minutes:
description: 'Job timeout in minutes'
type: number
default: 30
boot-timeout:
description: 'Emulator boot timeout in seconds'
type: number
default: 180
test-timeout:
description: 'Test timeout in seconds'
type: number
default: 300
free-disk-space:
description: 'Free disk space before build (recommended for single-device runs)'
type: boolean
default: true
run-apk-detection-tests:
description: 'Run APK detection tests before E2E'
type: boolean
default: false
artifact-prefix:
description: 'Prefix for artifact names'
type: string
default: 'android'
jobs:
android-e2e:
name: Android E2E - ${{ matrix.device }}
runs-on: ubuntu-24.04
timeout-minutes: ${{ inputs.timeout-minutes }}
strategy:
fail-fast: false
matrix:
device: ${{ fromJSON(inputs.devices) }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- 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: Setup Gradle cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/configuration-cache
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Free disk space
if: inputs.free-disk-space
run: |
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc \
/usr/local/share/powershell /usr/local/share/chromium \
/usr/local/share/boost /opt/hostedtoolcache
sudo apt-get clean
df -h /
- name: Install Devbox
uses: jetify-com/devbox-install-action@8c6a66ed6273138b1915457069de78cb52fe3bd7 # v0.15.0
with:
enable-cache: true
- name: Rewrite plugin URLs to local
run: bash scripts/dev/rewrite-plugin-urls.sh --to-local examples/
- name: Run Android apk-detection tests
if: inputs.run-apk-detection-tests
working-directory: examples/android
run: devbox run bash ../../plugins/tests/android/test-apk-detection.sh
- name: Run Android E2E test
id: e2e
working-directory: examples/android
env:
BOOT_TIMEOUT: ${{ inputs.boot-timeout }}
TEST_TIMEOUT: ${{ inputs.test-timeout }}
ANDROID_DEFAULT_DEVICE: ${{ matrix.device }}
ANDROID_DEVICES: ${{ matrix.device }}
TEST_TUI: false
run: |
START=$SECONDS
set +e
devbox run --pure -e EMU_HEADLESS=1 -e ANDROID_DEVICES=${{ matrix.device }} test:e2e
E2E_EXIT=$?
set -e
echo "e2e_duration=$(( SECONDS - START ))" >> "$GITHUB_OUTPUT"
exit $E2E_EXIT
- name: Write timing summary
if: always()
run: |
DURATION="${{ steps.e2e.outputs.e2e_duration }}"
RESULT="${{ steps.e2e.outcome }}"
DEVICE="${{ matrix.device }}"
MINUTES=$(( ${DURATION:-0} / 60 ))
SECS=$(( ${DURATION:-0} % 60 ))
mkdir -p examples/android/reports
cat > examples/android/reports/timing.json <<TJSON
{"platform":"android","device":"${DEVICE}","e2e_seconds":${DURATION:-0},"result":"${RESULT}","run_id":"${{ github.run_id }}"}
TJSON
echo "## Android E2E Timing - ${DEVICE}" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "| Metric | Value |" >> "$GITHUB_STEP_SUMMARY"
echo "|--------|-------|" >> "$GITHUB_STEP_SUMMARY"
echo "| Device | ${DEVICE} |" >> "$GITHUB_STEP_SUMMARY"
echo "| E2E duration | ${MINUTES}m ${SECS}s |" >> "$GITHUB_STEP_SUMMARY"
echo "| Result | ${RESULT} |" >> "$GITHUB_STEP_SUMMARY"
- name: Upload reports and logs
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: ${{ inputs.artifact-prefix }}-${{ matrix.device }}-reports
path: |
examples/android/reports/
examples/android/app/build/outputs/
retention-days: 7