-
Notifications
You must be signed in to change notification settings - Fork 5
82 lines (80 loc) · 3 KB
/
ci.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
name: CI
on:
push:
paths-ignore:
- "**.gitignore"
- "**.md"
pull_request:
paths-ignore:
- "**.gitignore"
- "**.md"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
name: Build, test, coverage
# Run on macOS, as currently it is the only runner with hardware acceleration (HAXM) installed
runs-on: macOS-latest
strategy:
matrix:
# System Image for API 30 not yet available through the
# reactivecircus/android-emulator-runner Action, apparently
api-level: [ 29 ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
cache: 'gradle'
# Emulator preparation - AVD snapshot caching
- name: AVD cache
uses: actions/cache@v2
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 }}
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."
# Test and coverage
- name: Android tests (unit and instrumented)
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
# Runs: Build, unit tests, instrumented tests, then combines coverage reports
script: ./gradlew jacocoCombinedTestReports
- name: Upload coverage to Code-Climate
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
JACOCO_SOURCE_PATH: "${{github.workspace}}/app/src/main/java"
with:
coverageLocations: ${{github.workspace}}/app/build/reports/coverage/jacocoCombinedTestReports/jacocoCombinedTestReports.xml:jacoco
# Artifacts
- name: Upload unit test results as artifact
uses: actions/upload-artifact@v2
with:
name: Test results (unit)
path: app/build/reports/tests/testDebugUnitTest
- name: Upload instrumented test results as artifact
uses: actions/upload-artifact@v2
with:
name: Test results (instrumented)
path: app/build/reports/androidTests/connected
- name: Upload coverage report artifact
uses: actions/upload-artifact@v2
with:
name: coverage
path: app/build/reports/coverage/jacocoCombinedTestReports