-
Notifications
You must be signed in to change notification settings - Fork 1
247 lines (240 loc) · 8.29 KB
/
check.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
name: check
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
JAVA_VERSION: "17"
JAVA_DISTRIBUTION: "zulu"
XCODE_VERSION: "13.3"
XCODE_CACHE: "CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++"
IOS_SIMULATOR: "platform=iOS Simulator,name=iPhone 11,OS=15.4"
ANDROID_COMPILE_SDK: "31"
ANDROID_EMULATOR_ARCHITECTURE: "x86_64"
GUARDIAN_API_KEY: ${{ secrets.GUARDIAN_API_KEY }}
GUARDIAN_API_URL: ${{ secrets.GUARDIAN_API_URL }}
jobs:
check-unit-test:
runs-on: ubuntu-20.04
concurrency:
group: ${{ github.ref }}-check-unit-test
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3 # By default, cache is only saved on the 'master' branch
- name: Set up Konan
uses: actions/cache@v4
id: check-unit-test-konan
with:
path: '~/.konan/**'
key: check-unit-test-konan
- name: Set up secrets
run: |
bash secrets.sh
- name: Unit test
run: |
set -o pipefail &&
./gradlew --no-daemon --continue testDebugUnitTest
- name: Generate test report
uses: mikepenz/action-junit-report@v4
if: always() # Ensure all test reports are collected, even after errors
with:
report_paths: |
**/TEST-*.xml
check_name: 'check-unit-test-results'
- name: Artifacts
uses: actions/upload-artifact@v4
if: always() # Ensure all artifacts are collected, even after errors
with:
name: Unit tests
path: |
**/TEST-*.xml
ios-check-build:
runs-on: macos-12
concurrency:
group: ${{ github.ref }}-ios-check-build
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3 # By default, cache is only saved on the 'master' branch
- name: Set up Konan
uses: actions/cache@v4
id: ios-check-build-konan
with:
path: '~/.konan/**'
key: ios-check-build-konan
- name: Set up secrets
run: |
bash secrets.sh
- name: Set up Xcode version
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
- name: Set up Xcode
uses: mikehardy/buildcache-action@v2
- name: Compile iOS app
run: |
cd appIos &&
set -o pipefail &&
xcodebuild ${{ env.XCODE_CACHE }} -workspace appIos.xcworkspace -scheme "appIos" -sdk iphonesimulator -destination '${{ env.IOS_SIMULATOR }}' build | tee xcodebuild.log | xcpretty &&
cd ..
- name: Artifacts
uses: actions/upload-artifact@v4
if: always() # Ensure all artifacts are collected, even after errors
with:
name: iOS Build
path: |
appIos/xcodebuild.log
~/Library/Developer/Xcode/DerivedData/**/Build/Products/**/appIos.app
~/Library/Developer/Xcode/DerivedData/**/Build/Products/**/appIos.app.dSYM
**/build
**/secrets.properties
ios-check-test:
runs-on: macos-12
concurrency:
group: ${{ github.ref }}-ios-check-test
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3 # By default, cache is only saved on the 'master' branch
- name: Set up Konan
uses: actions/cache@v4
id: ios-check-test-konan
with:
path: '~/.konan/**'
key: ios-check-test-konan
- name: Set up secrets
run: |
bash secrets.sh
- name: Set up Xcode version
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
- name: Set up Xcode
uses: mikehardy/buildcache-action@v2
- name: iOS tests
run: |
cd appIos &&
set -o pipefail &&
xcodebuild ${{ env.XCODE_CACHE }} -workspace appIos.xcworkspace -scheme "appIos" -sdk iphonesimulator -destination '${{ env.IOS_SIMULATOR }}' test | tee xcodebuild.log | xcpretty &&
cd ..
- name: Artifacts
uses: actions/upload-artifact@v4
if: always() # Ensure all artifacts are collected, even after errors
with:
name: iOS Tests
path: |
appIos/xcodebuild.log
android-check-build:
runs-on: ubuntu-20.04
concurrency:
group: ${{ github.ref }}-android-check-build
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3 # By default, cache is only saved on the 'master' branch
- name: Set up Konan
uses: actions/cache@v4
id: android-check-build-konan
with:
path: '~/.konan/**'
key: android-check-build-konan
- name: Set up secrets
run: |
bash secrets.sh
- name: Compile Android app
run: |
set -o pipefail &&
./gradlew android:app:assembleDebug
- name: Artifacts
uses: actions/upload-artifact@v4
if: always() # Ensure all artifacts are collected, even after errors
with:
name: Android Build
path: |
**/*.apk
**/build
**/secrets.properties
android-check-test:
runs-on: macos-11 # Allows Android emulator hardware acceleration
concurrency:
group: ${{ github.ref }}-android-check-test
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3 # By default, cache is only saved on the 'master' branch
- name: Set up Konan
uses: actions/cache@v4
id: android-check-test-konan
with:
path: '~/.konan/**'
key: android-check-test-konan
- name: Set up secrets
run: |
bash secrets.sh
- name: Set up AVD
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ env.ANDROID_COMPILE_SDK }}
- name: Generate AVD cache snapshot
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.ANDROID_COMPILE_SDK }}
arch: ${{ env.ANDROID_EMULATOR_ARCHITECTURE }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD cache snapshot"
- name: Android tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.ANDROID_COMPILE_SDK }}
arch: ${{ env.ANDROID_EMULATOR_ARCHITECTURE }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: set -o pipefail && ./gradlew connectedAndroidTest
- name: Artifacts
uses: actions/upload-artifact@v4
if: always() # Ensure all artifacts are collected, even after errors
with:
name: Android Tests
path: |
**/test-result.pb