Skip to content

Commit 2774696

Browse files
ChrisJoseAlcerreca
Chris
authored andcommittedAug 27, 2020
Update JetNews CI
Change-Id: I2b51a74fb4f6cee54994b681136123f2ef5dac92
1 parent d47ffea commit 2774696

File tree

4 files changed

+116
-71
lines changed

4 files changed

+116
-71
lines changed
 

‎.github/workflows/JetNews.yaml

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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

‎.github/workflows/ci.yaml

-69
This file was deleted.

‎JetNews/fake-file-to-trigger-ci.txt

Whitespace-only changes.

‎JetNews/checksum.sh ‎scripts/checksum.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
#
1616

1717
#!/bin/bash
18-
RESULT_FILE=$1
18+
SAMPLE=$1
19+
RESULT_FILE=$2
1920

2021
if [ -f $RESULT_FILE ]; then
2122
rm $RESULT_FILE
@@ -29,7 +30,7 @@ checksum_file() {
2930
FILES=()
3031
while read -r -d ''; do
3132
FILES+=("$REPLY")
32-
done < <(find . -type f \( -name "build.gradle*" -o -name "gradle-wrapper.properties" \) -print0)
33+
done < <(find $SAMPLE -type f \( -name "build.gradle*" -o -name "gradle-wrapper.properties" \) -print0)
3334

3435
# Loop through files and append MD5 to result file
3536
for FILE in ${FILES[@]}; do

0 commit comments

Comments
 (0)
Please sign in to comment.