-
-
Notifications
You must be signed in to change notification settings - Fork 5
270 lines (267 loc) · 7.8 KB
/
ci.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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
name: CI
on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:
# Ensure that new pushes/updates cancel running jobs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
format-dart:
name: "[Dart] Check formatting"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
cache: true
- name: Lint analysis
run: dart format --set-exit-if-changed .
lint-dart:
name: "[Dart] Static code analysis"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
cache: true
- name: "Get Flutter dependencies"
run: dart pub get
- name: Lint analysis
run: dart analyze --fatal-warnings --fatal-infos
lint-kotlin:
name: "[Kotlin] Code quality"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: ktlint
uses: ScaCap/action-ktlint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-check
filter_mode: nofilter
file_glob: "!**/*.g.*"
fail_on_error: true
# integration-test-ios:
# name: "[iOS] Integration tests"
# runs-on: macOS-latest
# defaults:
# run:
# working-directory: example
# steps:
# - uses: actions/checkout@v4
# - uses: futureware-tech/simulator-action@v3
# with:
# model: 'iPhone 15'
# - uses: subosito/flutter-action@v2
# with:
# cache: true
# - run: flutter pub get
# - run: flutter test integration_test --no-pub -r expanded
unit-test:
name: "Unit tests"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [ '3.27.0', '' ]
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: "Setup Flutter SDK"
uses: subosito/flutter-action@v2
with:
cache: true
- name: "Get Flutter dependencies"
run: flutter pub get
- name: "Run unit tests"
run: flutter test --timeout=600s --coverage
- name: "Run Codecov"
uses: codecov/codecov-action@v5
if: ${{ matrix.sdk == '' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
integration-test-android:
name: "[Android] Integration tests"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
api-level: [ 23, 35 ] # TODO: add 21
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: "Setup Flutter SDK"
uses: subosito/flutter-action@v2
with:
cache: true
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'gradle'
- name: "Get Flutter dependencies"
run: flutter pub get
# https://github.com/marketplace/actions/android-emulator-runner#running-hardware-accelerated-emulators-on-linux-runners
- name: "Enable KVM group perms"
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 integration tests"
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
emulator-boot-timeout: 1800 # 30 minutes
script: cd example && flutter test integration_test/main.dart --timeout=1800s -r expanded --coverage --coverage-package maplibre
- name: "Run Codecov"
uses: codecov/codecov-action@v5
if: ${{ matrix.api-level == '35' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# integration-test-web:
# name: "[Web] Integration tests"
# runs-on: ubuntu-latest
# timeout-minutes: 30
# defaults:
# run:
# working-directory: example
# steps:
# - uses: actions/checkout@v4
# - name: "Setup Flutter SDK"
# uses: subosito/flutter-action@v2
# with:
# cache: true
# - name: "Get Flutter dependencies"
# run: flutter pub get
# - name: "Start chromedriver"
# run: |
# sudo chromedriver --enable --port=4444 &
# - name: "Run integration tests"
# run: |
# flutter drive \
# --driver=test_driver/integration_test.dart \
# --target=integration_test/main.dart \
# -d web-server \
# --release \
# --browser-name=chrome
score:
name: "Package score"
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
cache: true
- name: Install pana
run: |
sudo apt-get install webp && \
dart pub global activate pana
- name: Check package score
run: pana --exit-code-threshold 0 --no-dartdoc .
build-android:
name: "[Android] Build APK"
runs-on: ubuntu-latest
defaults:
run:
working-directory: example
strategy:
fail-fast: false
matrix:
sdk: [ '3.27.0', '' ]
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.sdk }}
cache: true
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'gradle'
- name: "Get Flutter dependencies"
run: dart pub get
- name: Build example APK
run: flutter build apk
- name: Upload apk as artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.sdk == '' }}
with:
name: maplibre-flutter-demo.apk
path: example/build/app/outputs/flutter-apk/app-release.apk
# build-iOS:
# name: [iOS] Build package
# runs-on: macos-latest
# timeout-minutes: 30
# defaults:
# run:
# working-directory: example
# strategy:
# fail-fast: false
# matrix:
# sdk: [ '3.27.0', '' ]
# steps:
# - uses: actions/checkout@v4
# - uses: subosito/flutter-action@v2
# with:
# flutter-version: ${{ matrix.sdk }}
# cache: true
# - uses: maxim-lobanov/setup-cocoapods@v1
# with:
# podfile-path: example/ios/Podfile.lock
# - name: "Get Flutter dependencies"
# run: dart pub get
# - name: Build iOS package
# run: flutter build ios --simulator
# - name: Upload Runner.app as artifact
# if: ${{ matrix.sdk == '' }}
# uses: actions/upload-artifact@v4
# with:
# name: maplibre-flutter-demo.app
# path: example/build/ios/iphonesimulator
build-web:
name: "[Web] Build"
runs-on: ubuntu-latest
defaults:
run:
working-directory: example
strategy:
fail-fast: false
matrix:
sdk: [ '3.27.0', '' ]
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.sdk }}
cache: true
- name: "Get Flutter dependencies"
run: dart pub get
- name: Build web
run: flutter build web
build-web-wasm:
name: "[Web] Build WASM"
runs-on: ubuntu-latest
defaults:
run:
working-directory: example
strategy:
fail-fast: false
matrix:
sdk: [ '3.27.0', '' ]
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.sdk }}
cache: true
- name: "Get Flutter dependencies"
run: dart pub get
- name: Build web
run: flutter build web --wasm