generated from grodin/kotlin-android-template
-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (120 loc) · 4.8 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
131
132
133
134
135
136
137
138
139
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
# Use macos because GH linux runners don't have nested virtualization
# Which is required to use gradle managed devices
runs-on: macos-latest
strategy:
matrix:
# api-level: [ 30 ]
# target: [ google_apis ]
include:
- api-level: 30
target: google_atd
steps:
- name: Setup docker
uses: crazy-max/ghaction-setup-docker@v2
env:
SIGN_QEMU_BINARY: 1
- name: Install coreutils
run: |
brew install coreutils
timeout --version
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup gradle
uses: gradle/gradle-build-action@v2
with:
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
gradle-home-cache-cleanup: true
- name: AVD cache
uses: actions/cache@v3
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
uses: gradle/gradle-build-action@v2
with:
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
arguments: |
:app:packageDebug :integration-tests:firebase:packageDebug
- name: Start Firebase emulator and wait for it to be ready
id: start-emulator
run: scripts/start-firebase-emulator-in-docker-and-wait-for-ready.sh
# 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/capture-logcat-logs.sh ./scripts/run-instrumented-integration-tests.sh
- name: Extract logs from firebase emulator container
if: ${{ always() }}
run: |
mkdir -p ./build/logs/firebase-emulator
docker cp "firebase-emulator:/home/firebase-emulator" ./build/logs/firebase-emulator
- name: Upload firebase emulator logs
if: ${{ always() }}
uses: actions/upload-artifact@v3
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@v3
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/**