Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Add JLazyReference and JFinalString #45

Add JLazyReference and JFinalString

Add JLazyReference and JFinalString #45

Workflow file for this run

# 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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
with:
channel: ${{ matrix.sdk }}
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2
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@95b1a2355bd0e526ad2fd62da9fd386ad4c98474
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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2
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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2
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@95b1a2355bd0e526ad2fd62da9fd386ad4c98474
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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2
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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Setup clang
uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d
with:
version: latest
platform: x64
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2
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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2
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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Setup clang format
uses: ConorMacBride/install-package@3e7ad059e07782ee54fa35f827df52aae0626f30
with:
brew: clang-format
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2
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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2
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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2
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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2
with:
distribution: 'zulu'
java-version: '11'
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
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@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2
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@95b1a2355bd0e526ad2fd62da9fd386ad4c98474
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true