[jnigen] (An attempt to) Improve CI workflows (https://github.com/dart-lang/jnigen/issues/222)
* Move google-java-format to analyze actions
* Remove separate job for running java tests
* Reformat YAML to use single quotes
* Does removing yaml_config test affect coverage?
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml
index 92f5fd3..a4f17bc 100644
--- a/.github/workflows/test-package.yml
+++ b/.github/workflows/test-package.yml
@@ -12,24 +12,16 @@
on:
# Run on PRs and pushes to the default branch.
push:
- branches: [ main ]
+ branches: [main]
pull_request:
- branches: [ main ]
+ branches: [main]
schedule:
- - cron: "0 0 * * 0"
+ - cron: '0 0 * * 0'
env:
PUB_ENVIRONMENT: bot.github
jobs:
- check_java_format:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v2 minimum required
- - uses: axel-op/googlejavaformat-action@fe78db8a90171b6a836449f8d0e982d5d71e5c5a
- with:
- args: "--set-exit-if-changed"
-
analyze_jnigen:
runs-on: ubuntu-latest
defaults:
@@ -46,6 +38,10 @@
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
@@ -93,6 +89,9 @@
- name: build notification_plugin example APK
run: flutter build apk --target-platform=android-arm64
working-directory: ./pkgs/jnigen/example/notification_plugin/example
+ - name: Run summarizer tests
+ run: mvn surefire:test
+ working-directory: ./pkgs/jnigen/java
- name: Run VM tests
run: dart test --platform vm
- name: Install coverage
@@ -108,20 +107,6 @@
path-to-lcov: ./pkgs/jnigen/coverage/lcov.info
if: ${{ matrix.sdk == 'stable' }}
- test_summarizer:
- runs-on: ubuntu-latest
- defaults:
- run:
- working-directory: ./pkgs/jnigen/java
- steps:
- - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
- - uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2
- with:
- distribution: 'zulu'
- java-version: '11'
- - name: run tests using maven surefire
- run: mvn surefire:test
-
analyze_jni:
runs-on: ubuntu-latest
defaults:
@@ -138,6 +123,10 @@
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
@@ -155,7 +144,6 @@
dart run tool/generate_ide_files.dart
ls src/compile_commands.json
-
test_jni:
runs-on: ubuntu-latest
needs: [analyze_jni]
diff --git a/pkgs/jnigen/test/yaml_config_test.dart b/pkgs/jnigen/test/yaml_config_test.dart
deleted file mode 100644
index e995b6a..0000000
--- a/pkgs/jnigen/test/yaml_config_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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.
-
-// End-to-end test confirming yaml config works as expected.
-
-import 'package:jnigen/jnigen.dart';
-import 'package:path/path.dart' hide equals;
-import 'package:test/test.dart';
-
-import 'test_util/test_util.dart';
-
-void main() {
- final thirdParty = join('test', 'jackson_core_test', 'third_party');
- final testLib = join(thirdParty, 'test_lib_yaml');
- final testSrc = join(thirdParty, 'test_src_yaml');
- final lib = join(thirdParty, 'lib');
- final src = join(thirdParty, 'src');
- final configFile = join('test', 'jackson_core_test', 'jnigen.yaml');
- test('generate and compare bindings using YAML config', () async {
- final args = [
- '--config',
- configFile,
- '-Doutput.c.path=$testSrc/',
- '-Doutput.dart.path=$testLib/',
- ];
- final config = Config.parseArgs(args);
- await generateAndCompareBindings(config, lib, src);
- }, timeout: const Timeout.factor(4));
-}