-
Notifications
You must be signed in to change notification settings - Fork 26
104 lines (90 loc) · 3.08 KB
/
gradle-run-ui-tests.yml
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
name: "Run UI Tests"
on:
merge_group:
push:
branches:
- develop
- release/candidate
- prod
- internal
- main
pull_request:
types: [ opened, synchronize ] # Don't rerun on `edited` to save time
branches:
- develop
- release/candidate
- prod
- internal
- main
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
ui-tests:
runs-on: buildjet-8vcpu-ubuntu-2204
strategy:
matrix:
api-level: [ 29 ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive # Needed in order to fetch Kalium sources for building
fetch-depth: 0
- name: Set up JDK 17
uses: buildjet/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v3
- name: AVD cache
uses: buildjet/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
- 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: ${{ matrix.api-level }}
target: google_apis
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: echo "Generated AVD snapshot for caching."
- name: Android Instrumentation Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: google_apis
script: ./gradlew runAcceptanceTests
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get commit hash
run: echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Copy test results to simplified directory
run: |
mkdir -p acceptanceTests/flavors
cp -r app/build/reports/androidTests/connected/debug/flavors/* acceptanceTests/flavors/
- name: Zip test results
run: |
zip -r integration-tests-android_${{ env.COMMIT_HASH }}.zip acceptanceTests/flavors/
- name: Upload zipped test results
uses: actions/upload-artifact@v4
with:
name: integration-tests-android_${{ env.COMMIT_HASH }}
path: integration-tests-android_${{ env.COMMIT_HASH }}.zip
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties