generated from grodin/kotlin-android-template
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (113 loc) · 4.67 KB
/
data-integration-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
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
name: Data layer integration tests
on:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
merge_group:
push:
branches:
- 'develop'
pull_request:
concurrency:
group: 'ci-${{ github.event.merge_group.head_ref || github.head_ref }}-${{ github.workflow }}'
cancel-in-progress: true
jobs:
data-layer-integration-tests:
name: Data layer integration tests run against Firebase emulator in Docker
runs-on: ubuntu-latest
strategy:
matrix:
# api-level: [ 30 ]
# target: [ google_apis ]
include:
- api-level: 30
target: google_atd
steps:
- name: Enable KVM group perms
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
ls /dev/kvm
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
gradle-home-cache-cleanup: true
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-${{ matrix.target }}
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
profile: "Galaxy Nexus"
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
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."
## Build before running tests
- name: Build instrumented integration tests
run: ./gradlew :app:packageDebug :integration-tests:firebase:packageDebug
- name: Start Firebase emulator and wait for it to be ready
id: start-emulator
run: docker compose -f ./integration-tests/firebase/docker-compose.yml up --wait
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: Run instrumented integration tests
uses: reactivecircus/android-emulator-runner@v2
with:
profile: "Galaxy Nexus"
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
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: |
# Workaround for https://github.com/ReactiveCircus/android-emulator-runner/issues/319
adb uninstall "com.omricat.maplibrarian.integrationtesting.debug" || true
adb uninstall "com.omricat.maplibrarian.debug" || true
./gradlew installDebug
./scripts/run-instrumented-integration-tests.sh
killall -INT crashpad_handler || true
- name: Extract logs from firebase emulator container
if: ${{ always() }}
run: |
mkdir -p ./build/logs || true
docker compose -f ./integration-tests/firebase/docker-compose.yml cp "firebase-emulator:/home/firebase-emulator" ./build/logs
- name: Upload firebase emulator logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: firebase-debug-logs-api-${{ matrix.api-level }}-${{ matrix.target }}
path: ./build/logs/firebase-emulator/**/*.log
- name: Upload test results/logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: instrumentation-test-results-api-${{ matrix.api-level }}-${{ matrix.target }}
path: |
./**/build/logs/logcat.log
./**/build/reports/androidTests/connected/**
./**/build/outputs/androidTest-results/**
./**/build/outputs/connected_android_test_additional_output/**