forked from duckduckgo/Android
-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (116 loc) · 3.94 KB
/
ci.yml
File metadata and controls
134 lines (116 loc) · 3.94 KB
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
name: Spotless and Tests
on:
push:
branches:
- main
- develop
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
unit_tests:
name: Spotless and unit tests
runs-on: ubuntu-latest
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout submodules
uses: textbook/git-checkout-submodule-action@master
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Spotless
run: ./gradlew spotlessCheck --stacktrace
- name: Unit Tests
run: ./gradlew testDebugUnitTest --stacktrace
- name: (Fail-only) Bundle the Unit Test report
if: failure()
run: find . -type d -name 'reports' | zip -@ -r unit-test-report.zip
- name: (Fail-only) Upload the Unit Test report
if: failure()
uses: actions/upload-artifact@v2
with:
name: unit-test-error-report
path: unit-test-report.zip
android_tests:
runs-on: macos-latest
name: Android tests
strategy:
matrix:
api-level: [22, 26]
target: [google_apis]
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: set up JDK 14
uses: actions/setup-java@v2
with:
java-version: '14'
distribution: 'adopt'
- name: Gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}
- name: AVD cache
uses: actions/cache@v2
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-emu-${{ 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.19.1
with:
api-level: ${{ matrix.api-level }}
ndk: 21.0.6113669
target: ${{ matrix.target }}
arch: x86_64
profile: Nexus 5
force-avd-creation: true
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Android Tests
uses: reactiveCircus/android-emulator-runner@v2.19.1
with:
api-level: ${{ matrix.api-level }}
ndk: 21.0.6113669
target: ${{ matrix.target }}
arch: x86_64
profile: Nexus 5
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: ./gradlew app:connectedPlayDebugAndroidTest --stacktrace
- name: (Fail-only) Bundle the Android Test report
if: failure()
run: find . -type d -name 'reports' | zip -@ -r android-test-report.zip
- name: (Fail-only) Upload the Android Test report
if: failure()
uses: actions/upload-artifact@v2
with:
name: android-test-error-report
path: android-test-report.zip