-
-
Notifications
You must be signed in to change notification settings - Fork 152
156 lines (156 loc) · 4.29 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
154
155
156
name: Android CI
on:
workflow_dispatch:
push:
branches:
- main
- staging
- trying
pull_request:
branches:
- main
permissions:
actions: none
checks: none
contents: read
deployments: none
discussions: none
id-token: none
issues: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
env:
JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64
jobs:
build:
runs-on: ubuntu-latest
steps:
# Get source code
- uses: actions/[email protected]
# Set up Java
- name: set up OpenJDK 17
run: |
sudo apt-get update
sudo apt-get install -y openjdk-17-jdk-headless
sudo update-alternatives --auto java
# Build the app
- name: Build
run: ./gradlew assembleRelease
# Upload build
- name: Upload build
uses: actions/[email protected]
with:
name: Build
path: app/build/outputs/apk/
check-translations:
runs-on: ubuntu-latest
steps:
# Get source code
- uses: actions/[email protected]
# Check translations
- name: Fail on bad translations
run: if grep -ri "<xliff" app/src/main/res/values*/strings.xml; then echo "Invalidly escaped translations found"; exit 1; fi
instrumented-tests:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
api-level: [21, 34]
flavor: [Foss, Gplay]
steps:
# Get source code
- uses: actions/[email protected]
# Get built APKs
- name: Download artifacts
uses: actions/[email protected]
with:
name: Build
path: app/build/outputs/apk/
# Instrumented tests
- 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: Run instrumented tests
uses: ReactiveCircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
script: ./gradlew connected${{ matrix.flavor }}DebugAndroidTest
lint:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
flavor: [Foss, Gplay]
steps:
# Get source code
- uses: actions/[email protected]
# Get built APKs
- name: Download artifacts
uses: actions/[email protected]
with:
name: Build
path: app/build/outputs/apk/
# Set up Java
- name: set up OpenJDK 17
run: |
sudo apt-get update
sudo apt-get install -y openjdk-17-jdk-headless
sudo update-alternatives --auto java
# Lint
- name: Check lint
run: ./gradlew lint${{ matrix.flavor }}Release
spotbugs:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
flavor: [Foss, Gplay]
steps:
# Get source code
- uses: actions/[email protected]
# Get built APKs
- name: Download artifacts
uses: actions/[email protected]
with:
name: Build
path: app/build/outputs/apk/
# Set up Java
- name: set up OpenJDK 17
run: |
sudo apt-get update
sudo apt-get install -y openjdk-17-jdk-headless
sudo update-alternatives --auto java
# Spotbugs
- name: SpotBugs
run: ./gradlew spotbugs${{ matrix.flavor }}Release
unit-tests:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
flavor: [Foss, Gplay]
steps:
# Get source code
- uses: actions/[email protected]
# Get built APKs
- name: Download artifacts
uses: actions/[email protected]
with:
name: Build
path: app/build/outputs/apk/
# Set up Java
- name: set up OpenJDK 17
run: |
sudo apt-get update
sudo apt-get install -y openjdk-17-jdk-headless
sudo update-alternatives --auto java
# Unit test
- name: Run unit tests
run: timeout 5m ./gradlew test${{ matrix.flavor }}ReleaseUnitTest || { ./gradlew --stop && timeout 5m ./gradlew test${{ matrix.flavor }}ReleaseUnitTest; }