Repository navigation
129 lines (112 loc) · 3.93 KB
/
Copy pathui-tests.yml
File metadata and controls
129 lines (112 loc) · 3.93 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
name: Android Instrumented Tests
on:
push:
branches: [ "master" ]
workflow_dispatch:
inputs:
suites:
description: "integration (non-Compose), all, or comma-separated annotation names"
required: false
default: "integration"
type: string
workflow_call:
inputs:
suites:
required: true
type: string
permissions:
contents: read
packages: read
concurrency:
group: ${{ github.workflow }}-instrumented-${{ inputs.suites || 'integration' }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ui-tests:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout the code
uses: actions/checkout@v7
- name: Set up JDK 17
uses: actions/setup-java@v6
with:
java-version: '17'
distribution: 'temurin'
- name: Cache gradle
uses: actions/cache@v6
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-
- name: Decode google-services.json
run: |
set -euo pipefail
if [ -z "${GOOGLE_SERVICES_JSON_BASE64:-}" ]; then
echo "GOOGLE_SERVICES_JSON_BASE64 is empty; using checked-in placeholder."
exit 0
fi
mkdir -p app/src/debug
printf '%s' "$GOOGLE_SERVICES_JSON_BASE64" | base64 -d > app/src/debug/google-services.json
env:
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
- name: Make gradlew executable
run: chmod +x gradlew
- name: Build debug app
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHATWOOT_API: ${{ secrets.CHATWOOT_API }}
run: |
./gradlew assembleDevDebug assembleDevDebugAndroidTest
ls -la app/build/outputs/apk/dev/debug/
ls -la app/build/outputs/apk/androidTest/dev/debug/
- 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@v6
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-30-default-x86_64
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 30
target: default
arch: x86_64
profile: pixel_4
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Run UI tests on Android Emulator
uses: reactivecircus/android-emulator-runner@v2
env:
ANDROID_TEST_SUITES: ${{ inputs.suites || 'integration' }}
with:
api-level: 30
target: default
arch: x86_64
profile: pixel_4
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: bash .github/scripts/run-ui-tests.sh
- name: Upload UI test report
if: always()
uses: actions/upload-artifact@v7
with:
name: android_test_report_${{ inputs.suites || 'integration' }}
path: |
app/build/reports/androidTests/connected/**/*
app/build/outputs/androidTest-results/connected/**/*
if-no-files-found: warn