-
Notifications
You must be signed in to change notification settings - Fork 527
152 lines (133 loc) · 5.51 KB
/
main.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
140
141
142
143
144
145
146
147
148
149
150
151
152
# Contains jobs corresponding to Gradle tests (particularly Robolectric unit tests).
name: Unit Tests (Robolectric -- Gradle)
# Controls when the action will run. Triggers the workflow on pull request
# events or push events in the develop branch.
on:
workflow_dispatch:
pull_request:
push:
branches:
# Push events on develop branch
- develop
# This workflow has the following jobs:
# robolectric_tests: Robolectric tests for all modules except the app module
# app_tests: Non-flaky Robolectric tests for the app module
jobs:
robolectric_tests:
name: Non-app Module Robolectric Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
id: cache
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-jars-{{ checksum "build.gradle" }}
- name: Set up JDK 1.9
uses: actions/setup-java@v1
with:
java-version: 1.9
- name: Check Java version & path
run: |
which java
java -version
echo "Java home: $JAVA_HOME"
$JAVA_HOME/bin/java -version
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: ./gradlew --full-stacktrace androidDependencies -Dorg.gradle.java.home=$JAVA_HOME
- name: Check Gradle environment
run: ./gradlew -Dorg.gradle.java.home=$JAVA_HOME -v
- name: Build App
# We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58
run: sudo ./gradlew --full-stacktrace assembleDebug -Dorg.gradle.java.home=$JAVA_HOME
- name: Utility tests
if: always()
# We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58
run: sudo ./gradlew --full-stacktrace :utility:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME
- name: Upload Utility Test Reports
uses: actions/upload-artifact@v2
if: ${{ always() }} # IMPORTANT: Upload reports regardless of status
with:
name: utility reports
path: utility/build/reports
- name: Data tests
if: always()
# We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58
run: sudo ./gradlew --full-stacktrace :data:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME
- name: Upload Data Test Reports
uses: actions/upload-artifact@v2
if: ${{ always() }} # IMPORTANT: Upload reports regardless of status
with:
name: data reports
path: data/build/reports
- name: Domain tests
if: always()
# We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58
run: sudo ./gradlew --full-stacktrace :domain:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME
- name: Upload Domain Test Reports
uses: actions/upload-artifact@v2
if: ${{ always() }} # IMPORTANT: Upload reports regardless of status
with:
name: domain reports
path: domain/build/reports
- name: Testing tests
if: always()
# We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58
run: sudo ./gradlew --full-stacktrace :testing:testDebugUnitTest -Dorg.gradle.java.home=$JAVA_HOME
- name: Upload Testing Test Reports
uses: actions/upload-artifact@v2
if: ${{ always() }} # IMPORTANT: Upload reports regardless of status
with:
name: testing reports
path: testing/build/reports
run_app_module_test:
name: Run app module Robolectric test shard
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
shard: [shard0, shard1, shard2, shard3, shard4, shard5, shard6, shard7]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-jars-{{ checksum "build.gradle" }}
- name: Set up JDK 1.9
uses: actions/setup-java@v1
with:
java-version: 1.9
- name: Check Java version & path
run: |
which java
java -version
echo "Java home: $JAVA_HOME"
$JAVA_HOME/bin/java -version
- name: Check Gradle environment
run: ./gradlew -Dorg.gradle.java.home=$JAVA_HOME -v
- name: Robolectric tests - App Module
# We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58
run: |
sudo ./gradlew --full-stacktrace :app:testDebugUnitTest --${{ matrix.shard }} -Dorg.gradle.java.home=$JAVA_HOME
- name: Upload App Test Reports
uses: actions/upload-artifact@v2
if: ${{ always() }} # IMPORTANT: Upload reports regardless of status
with:
name: app reports ${{ matrix.shard }}
path: app/build/reports
app_tests:
name: App Module Robolectric Tests
needs: run_app_module_test
if: ${{ always() }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- name: Check tests passed (for tests that ran)
if: ${{ needs.run_app_module_test.result != 'success' }}
run: exit 1