Skip to content

Bump the github-actions group with 3 updates #393

Bump the github-actions group with 3 updates

Bump the github-actions group with 3 updates #393

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: jnigen
on:
# Run on PRs and pushes to the default branch.
push:
branches: [main]
paths:
- '.github/workflows/jnigen.yaml'
- 'pkgs/jnigen/**'
- 'pkgs/jni/**'
pull_request:
branches: [main]
paths:
- '.github/workflows/jnigen.yaml'
- 'pkgs/jnigen/**'
- 'pkgs/jni/**'
schedule:
- cron: '0 0 * * 0'
env:
PUB_ENVIRONMENT: bot.github
jobs:
analyze_jnigen:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./pkgs/jnigen
strategy:
fail-fast: false
matrix:
sdk: [stable]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
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: ./pkgs/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: ./pkgs/jnigen
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
sdk: [stable, beta]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: ${{ matrix.sdk }}
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'zulu'
java-version: '17'
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: ./pkgs/jnigen/example/in_app_java
- 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: Build summarizer
run: dart run jnigen:setup
- 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@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8
with:
flag-name: jnigen
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
path-to-lcov: ./pkgs/jnigen/coverage/lcov.info
if: ${{ matrix.sdk == 'stable' }}
analyze_jni:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./pkgs/jni
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'zulu'
java-version: '17'
- 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: ./pkgs/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: ./pkgs/jni
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'zulu'
java-version: '17'
- 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@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8
with:
flag-name: jni
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
path-to-lcov: ./pkgs/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: ./pkgs/jni
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'zulu'
java-version: '17'
- 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: ./pkgs/jnigen
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Setup clang
uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d
with:
version: latest
platform: x64
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'zulu'
java-version: '17'
- 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: 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: ./pkgs/jni
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'temurin'
java-version: '17'
- 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: ./pkgs/jnigen
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Setup clang format
uses: ConorMacBride/install-package@3e7ad059e07782ee54fa35f827df52aae0626f30
with:
brew: clang-format
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'temurin'
java-version: '17'
- run: git config --global core.autocrlf true
- run: dart pub get
- name: Build summarizer
run: dart run jnigen:setup
- name: Run tests
run: dart test --test-randomize-ordering-seed random
build_jni_example_linux:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./pkgs/jni/example
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'zulu'
java-version: '17'
- 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: ./pkgs/jni/example
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'zulu'
java-version: '17'
- 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: ./pkgs/jni/example
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'zulu'
java-version: '17'
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
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: ./pkgs/jnigen/example/pdfbox_plugin
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'zulu'
java-version: '17'
- 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://raw.githubusercontent.com/dart-lang/site-www/a7f170389e210adc2aef810cc9a6fdbfa78059a5/src/guides/language/specifications/DartLangSpec-v2.2.pdf'
dart run bin/pdf_info.dart DartLangSpec-v2.2.pdf
working-directory: ./pkgs/jnigen/example/pdfbox_plugin/dart_example
- name: Build flutter example for pdfbox_plugin
run: |
flutter pub get
flutter build linux
working-directory: ./pkgs/jnigen/example/pdfbox_plugin/example
coveralls_finish:
needs: [test_jnigen, test_jni]
runs-on: ubuntu-latest
steps:
- name: Coveralls finished
uses: coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8
with:
carryforward: "ffigen,jni,jnigen,native_assets_builder_macos,native_assets_builder_ubuntu,native_assets_builder_windows,native_assets_cli_macos,native_assets_cli_ubuntu,native_assets_cli_windows,native_toolchain_c_macos,native_toolchain_c_ubuntu,native_toolchain_c_windows,objective_c,swift2objc"
github-token: ${{ secrets.github_token }}
parallel-finished: true