-
Notifications
You must be signed in to change notification settings - Fork 9
76 lines (73 loc) · 3.01 KB
/
test.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
name: Tests
on: [push, pull_request]
jobs:
unit-test:
runs-on: ubuntu-latest
strategy:
matrix:
module: [sdk, messagingpush, messaginginapp, base]
name: Unit tests (${{ matrix.module }})
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11' # Robolectric requires v9, but we choose LTS: https://adoptopenjdk.net/
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Run unit tests (${{ matrix.module }})
run: ./gradlew :${{ matrix.module }}:runJacocoTestReport
- name: Upload code coverage report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_UPLOAD_TOKEN }} # not required for public repos, but sometimes uploads fail without it so include it anyway
fail_ci_if_error: true # fail if upload fails so we can catch it and fix it right away.
verbose: true
files: ./${{ matrix.module }}/build/reports/jacoco/test/jacocoTestReport.xml,./${{ matrix.module }}/build/reports/jacoco/runJacocoTestReport/runJacocoTestReport.xml
- name: Publish test results (${{ matrix.module }})
uses: mikepenz/action-junit-report@v4
with:
report_paths: '**/build/test-results/test*/TEST-*.xml'
fail_on_failure: true
require_tests: true
if: ${{ always() }} # if running tests fails, we still want to parse the test results
instrumentation-test:
runs-on: macos-latest
timeout-minutes: 45
strategy:
# Add more samples here as they are added to the project.
matrix:
sample: [kotlin_compose, java_layout]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Gradle cache
uses: gradle/gradle-build-action@v2
- name: Start emulator
uses: reactivecircus/android-emulator-runner@v2
with:
# Configuration options for the emulator for the best optimization.
api-level: 29
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
ram-size: 4096M
emulator-boot-timeout: 12000
target: default
arch: x86
emulator-build: 7425822 # https://github.com/ReactiveCircus/android-emulator-runner/issues/160
profile: Nexus 6
# Run the instrumentation tests on the emulator.
script: ./gradlew :samples:${{ matrix.sample }}:connectedDebugAndroidTest
- name: Publish test results
uses: mikepenz/action-junit-report@v4
if: always()
with:
report_paths: 'samples/${{ matrix.sample }}/build/outputs/androidTest-results/connected/TEST-*.xml'