Repository navigation
149 lines (141 loc) · 4.45 KB
/
Copy pathandroid-ci.yml
File metadata and controls
149 lines (141 loc) · 4.45 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: "Android CI"
on:
push:
paths-ignore:
- '**/*.md'
- '.github/workflows/codeql-analysis.yml'
- '.github/workflows/close-empty-xml.yml'
- '.github/workflows/stale.yml'
- '.github/workflows/compare-src.yml'
- '.github/ISSUE_TEMPLATE/**'
pull_request:
paths-ignore:
- '**/*.md'
- '.github/workflows/codeql-analysis.yml'
- '.github/workflows/close-empty-xml.yml'
- '.github/workflows/stale.yml'
- '.github/workflows/compare-src.yml'
- '.github/ISSUE_TEMPLATE/**'
workflow_dispatch: {}
jobs:
license-header:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v7
- name: license header check
run: ./scripts/check-license-headers.sh
ktlint:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Common setup
uses: ./.github/actions/common-setup
- name: ktlint check
run: bash ./gradlew ktlintCheck --stacktrace
- name: Upload ktlint report
uses: actions/upload-artifact@v7
with:
name: ktlint-report
path: app/build/reports/ktlint
lint:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Common setup
uses: ./.github/actions/common-setup
- name: lint
run: bash ./gradlew lintDebug --stacktrace
- name: Upload lint report
uses: actions/upload-artifact@v7
with:
name: lint-report
path: app/build/reports/lint-results*.*
test:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Common setup
uses: ./.github/actions/common-setup
- name: unit tests
run: bash ./gradlew testDebugUnitTest --stacktrace
- name: Upload test results
uses: actions/upload-artifact@v7
with:
name: test-results
path: app/build/reports/tests
coverage:
runs-on: ubuntu-24.04
needs: test
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Common setup
uses: ./.github/actions/common-setup
- name: coverage
run: bash ./gradlew jacocoTestCoverageVerification --stacktrace
- name: Upload JaCoCo report
uses: actions/upload-artifact@v7
with:
name: jacoco-report
path: app/build/reports/jacoco
- name: upload coverage to Codecov
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./app/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml
build-apk:
runs-on: ubuntu-24.04
needs: [ktlint, lint, test, coverage]
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Common setup
uses: ./.github/actions/common-setup
- name: build apk
run: bash ./gradlew assembleDebug --stacktrace
- name: artifact apk
uses: actions/upload-artifact@v7
with:
name: artifact-apk
path: app/build/outputs/apk/debug
emulator-test:
runs-on: ubuntu-latest
needs: [build-apk]
strategy:
fail-fast: false
matrix:
api-level: [31, 33, 35, '37.0']
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/common-setup
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Build app and test APKs
run: ./gradlew assembleDebug assembleDebugAndroidTest
- name: Run instrumented tests
uses: ./.github/actions/emulator-step
with:
api-level: ${{ matrix.api-level }}
script: |
adb wait-for-device
until adb shell service check package; do sleep 2; done
sleep 5
./gradlew connectedDebugAndroidTest -x assembleDebug -x assembleDebugAndroidTest
- name: Upload test results
uses: actions/upload-artifact@v7
if: always()
with:
name: emulator-test-results-${{ matrix.api-level }}
path: app/build/reports/androidTests
- name: Publish test results
uses: mikepenz/action-junit-report@v6
if: always()
with:
report_paths: 'app/build/outputs/androidTest-results/connected/**/*.xml'