forked from TwidereProject/TwidereX-Android
153 lines (125 loc) · 3.98 KB
/
android.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
153
name: Android CI
on:
push:
branches:
- master
- develop
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
concurrency:
group: android-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
- name: Set up Android SDK License
run: yes | /usr/local/lib/android/sdk/tools/bin/sdkmanager --licenses
- name: Build with Gradle
run: ./gradlew :android:spotlessCheck :android:lint :android:build
- name: Upload build reports
uses: actions/upload-artifact@v2
with:
name: build-reports
path: '**/build/reports'
- name: Upload build mapping
uses: actions/upload-artifact@v2
with:
name: build-mapping
path: ./android/build/outputs/mapping
unit-test:
runs-on: ubuntu-latest
needs: build
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
- name: Set up Android SDK License
run: yes | /usr/local/lib/android/sdk/tools/bin/sdkmanager --licenses
- name: Build with Gradle
run: ./gradlew :android:test
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
with:
name: unit-test-result
path: "**/build/test-results/**/*.xml"
connected-test:
runs-on: macOS-11
needs: build
timeout-minutes: 60
strategy:
# Allow tests to continue on other devices if they fail on one device.
fail-fast: false
matrix:
include:
- api-level: 30
target: google_apis
- api-level: 28
target: default
- api-level: 26
target: default
- api-level: 24
target: default
- api-level: 22
target: default
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
- name: Set up Android SDK License
run: (while sleep 3; do echo "y"; done) | /Users/runner/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager --licenses
- name: Build tests
run: ./gradlew :android:assembleAndroidTest
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
timeout-minutes: 40
with:
api-level: ${{ matrix.api-level }}
profile: 4in WVGA (Nexus S)
ram-size: 2048M
target: ${{ matrix.target }}
script: |
adb logcat > logcat.txt &
./gradlew :android:connectedCheck
- name: Upload logs
if: always()
uses: actions/upload-artifact@v2
with:
name: logs-${{ matrix.api-level }}-${{ matrix.target }}
path: logcat.txt
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
with:
name: test-results-${{ matrix.api-level }}-${{ matrix.target }}
path: "**/build/outputs/**/connected/**/*.xml"