1
+ name : JetNews
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - master
7
+ paths :
8
+ - ' JetNews/**'
9
+ pull_request :
10
+ paths :
11
+ - ' JetNews/**'
12
+
13
+ env :
14
+ SAMPLE_PATH : JetNews
15
+
16
+ jobs :
17
+ build :
18
+ runs-on : ubuntu-latest
19
+ timeout-minutes : 30
20
+
21
+ steps :
22
+ - name : Checkout
23
+ uses : actions/checkout@v2
24
+
25
+ - name : Copy CI gradle.properties
26
+ run : mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
27
+
28
+ - name : Set up JDK 1.8
29
+ uses : actions/setup-java@v1
30
+ with :
31
+ java-version : 1.8
32
+
33
+ - name : Generate cache key
34
+ run : ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
35
+
36
+ - uses : actions/cache@v2
37
+ with :
38
+ path : ~/.gradle/caches/modules-2
39
+ key : ${{ runner.os }}-gradlemodules-${{ hashFiles('checksum.txt') }}
40
+
41
+ - uses : actions/cache@v2
42
+ with :
43
+ path : ~/.gradle/caches/jars-3
44
+ key : ${{ runner.os }}-gradlejars-${{ hashFiles('checksum.txt') }}
45
+
46
+ - uses : actions/cache@v2
47
+ with :
48
+ path : ~/.gradle/caches/build-cache-1
49
+ key : ${{ runner.os }}-gradlebuildcache-${{ hashFiles('checksum.txt') }}
50
+
51
+ - name : Build project
52
+ working-directory : ${{ env.SAMPLE_PATH }}
53
+ run : ./gradlew spotlessCheck assembleDebug --stacktrace
54
+
55
+ test :
56
+ needs : build
57
+ runs-on : macOS-latest # enables hardware acceleration in the virtual machine
58
+ timeout-minutes : 30
59
+ strategy :
60
+ matrix :
61
+ api-level : [23, 26, 30]
62
+
63
+ steps :
64
+ - name : Checkout
65
+ uses : actions/checkout@v2
66
+
67
+ - name : Copy CI gradle.properties
68
+ run : mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
69
+
70
+ - name : Set up JDK 1.8
71
+ uses : actions/setup-java@v1
72
+ with :
73
+ java-version : 1.8
74
+
75
+ - name : Generate cache key
76
+ run : ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
77
+
78
+ - uses : actions/cache@v2
79
+ with :
80
+ path : ~/.gradle/caches/modules-2
81
+ key : ${{ runner.os }}-gradlemodules-${{ hashFiles('checksum.txt') }}
82
+
83
+ - uses : actions/cache@v2
84
+ with :
85
+ path : ~/.gradle/caches/jars-3
86
+ key : ${{ runner.os }}-gradlejars-${{ hashFiles('checksum.txt') }}
87
+
88
+ - uses : actions/cache@v2
89
+ with :
90
+ path : ~/.gradle/caches/build-cache-1
91
+ key : ${{ runner.os }}-gradlebuildcache-${{ hashFiles('checksum.txt') }}
92
+
93
+ - name : Run instrumentation tests
94
+ uses : reactivecircus/android-emulator-runner@v2
95
+ with :
96
+ api-level : ${{ matrix.api-level }}
97
+ arch : x86
98
+ disable-animations : true
99
+ script : ./gradlew connectedCheck --stacktrace
100
+ working-directory : ${{ env.SAMPLE_PATH }}
101
+
102
+ - name : Copy test results
103
+ if : always()
104
+ run : |
105
+ mkdir -p junit
106
+ find . -type f -regex "${SAMPLE_PATH}/*/build/test-results/.*xml" -exec cp {} junit/ \;
107
+
108
+ - name : Upload test results
109
+ if : always()
110
+ uses : actions/upload-artifact@v2
111
+ with :
112
+ name : junit-results
113
+ path : junit
0 commit comments