This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
420 lines (403 loc) · 14.9 KB
/
test-package.yaml
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
# Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Note: There's a script under `jnigen/tool` which runs a subset of these
# tests on local machine. It's a useful little script for checking the
# code before making a PR. If you add a task here, you might want to add
# the equivalent in that script as well.
name: Dart CI
on:
# Run on PRs and pushes to the default branch.
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 0 * * 0'
env:
PUB_ENVIRONMENT: bot.github
jobs:
analyze_jnigen:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./jnigen
strategy:
fail-fast: false
matrix:
sdk: [stable]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: ${{ matrix.sdk }}
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: axel-op/googlejavaformat-action@fe78db8a90171b6a836449f8d0e982d5d71e5c5a
name: 'Check Java formatting with google-java-format'
with:
args: '--set-exit-if-changed'
- id: install
name: Install dependencies
run: dart pub get
- name: install dependencies for android test runner
run: flutter pub get
working-directory: ./jnigen/android_test_runner
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
if: always() && steps.install.outcome == 'success'
- name: Analyze code
run: flutter analyze --fatal-infos
if: always() && steps.install.outcome == 'success'
test_jnigen:
needs: [analyze_jnigen]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./jnigen
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
sdk: [stable, beta]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: ${{ matrix.sdk }}
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: 'zulu'
java-version: '11'
cache: maven
## Committed bindings are formatted with clang-format.
## So this is required to format generated bindings identically
- name: install clang tools
run: |
sudo apt-get update -y
sudo apt-get install -y clang-format
- name: Install dependencies
run: dart pub get
- name: build in_app_java APK
run: flutter build apk --target-platform=android-arm64
working-directory: ./jnigen/example/in_app_java
- name: build notification_plugin example APK
run: flutter build apk --target-platform=android-arm64
working-directory: ./jnigen/example/notification_plugin/example
- name: Run summarizer tests
run: mvn surefire:test
working-directory: ./jnigen/java
- name: Build summarizer
run: dart run jnigen:setup
- name: Generate runtime tests
run: dart run tool/generate_runtime_tests.dart
- name: Run VM tests
run: dart test --test-randomize-ordering-seed random
- name: Install coverage
run: dart pub global activate coverage
- name: Collect coverage
run: dart pub global run coverage:test_with_coverage
- name: Upload coverage
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: jnigen_tests
parallel: true
path-to-lcov: ./jnigen/coverage/lcov.info
if: ${{ matrix.sdk == 'stable' }}
analyze_jni:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./jni
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: 'zulu'
java-version: '11'
- uses: axel-op/googlejavaformat-action@fe78db8a90171b6a836449f8d0e982d5d71e5c5a
name: 'Check Java formatting with google-java-format'
with:
args: '--set-exit-if-changed'
- name: install clang tools & CMake
run: |
sudo apt-get update -y
sudo apt-get install -y clang-format build-essential cmake
- run: flutter pub get
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
- name: Run lints
run: flutter analyze --fatal-infos
- name: Check C code formatting using clang-format
run: clang-format --dry-run -Werror dartjni.c dartjni.h third_party/*.c third_party/*.h
working-directory: ./jni/src
- name: verify that tool/generate_ide_files.dart generates a file
run: |
dart run tool/generate_ide_files.dart
ls src/compile_commands.json
test_jni:
runs-on: ubuntu-latest
needs: [analyze_jni]
defaults:
run:
working-directory: ./jni
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: 'zulu'
java-version: '11'
- run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev libclang-dev
- run: dart pub get
- run: dart run jni:setup
- name: Get dependencies
run: dart pub get
- name: Run tests
run: dart test --test-randomize-ordering-seed random
- name: Install coverage
run: dart pub global activate coverage
- name: Collect coverage
run: dart pub global run coverage:test_with_coverage
- name: Upload coverage
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: jni_tests
parallel: true
path-to-lcov: ./jni/coverage/lcov.info
# TODO(https://github.com/dart-lang/ffigen/issues/555): Ffigen generated
# on my machine has macOS specific stuff and CI does not.
# We should just generate the struct as opaque, but we currently can't.
#
# - name: regenerate & compare ffigen bindings
# ## Use git to verify no source files have changed
# run: |
# dart run tool/generate_ffi_bindings.dart
# git diff --exit-code -- lib/src/third_party src/third_party
## Run tests for package:jni on windows, just to confirm it works.
## Do not, for example, collect coverage or check formatting.
test_jni_windows_minimal:
needs: [analyze_jni]
runs-on: windows-latest
defaults:
run:
working-directory: ./jni
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: 'zulu'
java-version: '11'
- run: Add-Content $env:GITHUB_PATH "$env:JAVA_HOME\bin\server"
- run: dart pub get
- run: dart run jni:setup
- run: dart test --test-randomize-ordering-seed random
test_jnigen_windows_minimal:
needs: [analyze_jnigen]
runs-on: windows-latest
defaults:
run:
working-directory: ./jnigen
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Setup clang
uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d
with:
version: latest
platform: x64
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: 'zulu'
java-version: '11'
- run: git config --global core.autocrlf true
- run: Add-Content $env:GITHUB_PATH "$env:JAVA_HOME\bin\server"
- run: dart pub get
- run: dart run jnigen:setup
- name: Build summarizer
run: dart run jnigen:setup
- name: Generate runtime tests
run: dart run tool/generate_runtime_tests.dart
- name: Run tests
run: dart test --test-randomize-ordering-seed random
test_jni_macos_minimal:
needs: [analyze_jni]
runs-on: macos-latest
defaults:
run:
working-directory: ./jni
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: 'temurin'
java-version: '11'
- run: dart pub get
- run: dart run jni:setup
- run: dart test --test-randomize-ordering-seed random
test_jnigen_macos_minimal:
needs: [analyze_jnigen]
runs-on: macos-latest
defaults:
run:
working-directory: ./jnigen
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Setup clang format
uses: ConorMacBride/install-package@3e7ad059e07782ee54fa35f827df52aae0626f30
with:
brew: clang-format
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: 'temurin'
java-version: '11'
- run: git config --global core.autocrlf true
- run: dart pub get
- name: Build summarizer
run: dart run jnigen:setup
- name: Generate runtime tests
run: dart run tool/generate_runtime_tests.dart
- name: Run tests
run: dart test --test-randomize-ordering-seed random
build_jni_example_linux:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./jni/example
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: 'zulu'
java-version: '11'
- run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev
- run: flutter config --enable-linux-desktop
- run: flutter pub get
- run: dart run jni:setup
- run: flutter build linux
build_jni_example_windows:
runs-on: windows-latest
defaults:
run:
working-directory: ./jni/example
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: 'zulu'
java-version: '11'
- run: flutter config --enable-windows-desktop
- run: flutter pub get
- run: flutter build windows
build_jni_example_android:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./jni/example
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: 'zulu'
java-version: '11'
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- run: flutter pub get
- run: flutter build apk
run_pdfbox_example_linux:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./jnigen/example/pdfbox_plugin
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
distribution: 'zulu'
java-version: '11'
- run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev clang-format
- run: flutter config --enable-linux-desktop
- run: dart pub get
- name: Generate full bindings
run: dart run jnigen --config jnigen.yaml --override classes="org.apache.pdfbox"
- name: Analyze generated bindings
run: |
flutter pub get # dart-analyze errors on flutter example
flutter analyze
- name: Run standalone example
run: |
dart pub get
dart run jni:setup
wget 'https://dart.dev/guides/language/specifications/DartLangSpec-v2.2.pdf'
dart run bin/pdf_info.dart DartLangSpec-v2.2.pdf
working-directory: ./jnigen/example/pdfbox_plugin/dart_example
- name: Build flutter example for pdfbox_plugin
run: |
flutter pub get
flutter build linux
working-directory: ./jnigen/example/pdfbox_plugin/example
coveralls_finish:
needs: [test_jnigen, test_jni]
runs-on: ubuntu-latest
steps:
- name: Coveralls finished
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true