| name: ffigen |
| |
| on: |
| # Run on PRs and pushes to the default branch, in either the ffigen directory, |
| # or the objective_c directory. |
| push: |
| # No `branches:` to enable stacked PRs on GitHub. |
| paths: |
| - '.github/workflows/ffigen.yml' |
| - 'pkgs/ffigen/**' |
| - 'pkgs/objective_c/**' |
| pull_request: |
| branches: [main] |
| paths: |
| - '.github/workflows/ffigen.yml' |
| - 'pkgs/ffigen/**' |
| - 'pkgs/objective_c/**' |
| schedule: |
| - cron: "0 0 * * 0" |
| |
| env: |
| PUB_ENVIRONMENT: bot.github |
| |
| jobs: |
| # Check code formatting and static analysis on a single OS (macos). |
| analyze: |
| runs-on: macos-latest |
| defaults: |
| run: |
| working-directory: pkgs/ffigen/ |
| strategy: |
| fail-fast: false |
| steps: |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e |
| with: |
| channel: stable |
| - id: install |
| name: Install dependencies |
| run: dart pub get && dart pub get --directory="example/shared_bindings" && dart pub get --directory="../objective_c" && dart pub get --directory="example/add" |
| - name: Check formatting |
| run: dart format --output=none --set-exit-if-changed . |
| if: always() && steps.install.outcome == 'success' |
| - name: Build test dylib and bindings |
| run: dart --enable-asserts test/setup.dart |
| - name: Analyze code |
| run: dart analyze --fatal-infos |
| |
| test-linux: |
| needs: analyze |
| runs-on: ubuntu-22.04 |
| defaults: |
| run: |
| working-directory: pkgs/ffigen/ |
| steps: |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e |
| with: |
| channel: stable |
| - name: Install dependencies |
| run: dart pub get && flutter pub get --directory="../jni" |
| - name: Install libclang-14-dev |
| run: sudo apt-get install libclang-14-dev |
| - name: Build test dylib and bindings |
| run: dart --enable-asserts test/setup.dart |
| - name: Run VM tests |
| run: dart test |
| - name: Generate package:jni bindings |
| run: dart --enable-asserts run tool/generate_ffi_bindings.dart |
| working-directory: pkgs/jni/ |
| |
| # Keep in sync with ffigen_weekly.yaml:test-mac-arm64 |
| test-mac: |
| needs: analyze |
| runs-on: 'macos-latest' |
| defaults: |
| run: |
| working-directory: pkgs/ffigen/ |
| steps: |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e |
| with: |
| channel: stable |
| - name: Install dependencies |
| run: dart pub get && dart pub get --directory="../objective_c" && flutter pub get --directory="../jni" |
| - name: Install clang-format |
| uses: ConorMacBride/install-package@3e7ad059e07782ee54fa35f827df52aae0626f30 |
| with: |
| brew: clang-format |
| - name: Build test dylib and bindings |
| run: dart --enable-asserts test/setup.dart |
| - name: Install coverage |
| run: dart pub global activate coverage |
| - name: Run VM tests and collect coverage |
| run: dart test --coverage-path=./coverage/lcov.info |
| - name: Generate package:jni bindings |
| run: dart --enable-asserts run tool/generate_ffi_bindings.dart |
| working-directory: pkgs/jni/ |
| - name: Upload coverage |
| uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e |
| with: |
| flag-name: ffigen |
| github-token: ${{ secrets.GITHUB_TOKEN }} |
| parallel: true |
| path-to-lcov: pkgs/ffigen/coverage/lcov.info |
| - name: Upload coverage |
| uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e |
| with: |
| carryforward: "ffigen,jni,jnigen,native_pkgs_macos,native_pkgs_ubuntu,native_pkgs_windows,objective_c,swift2objc,swiftgen" |
| github-token: ${{ secrets.GITHUB_TOKEN }} |
| parallel-finished: true |
| |
| test-mac-latest: |
| needs: analyze |
| runs-on: 'macos-latest' |
| defaults: |
| run: |
| working-directory: pkgs/ffigen/ |
| steps: |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e |
| with: |
| channel: stable |
| - name: Install dependencies |
| run: dart pub get && dart pub get --directory="../objective_c" && flutter pub get --directory="../jni" |
| - name: Install clang-format |
| uses: ConorMacBride/install-package@3e7ad059e07782ee54fa35f827df52aae0626f30 |
| with: |
| brew: clang-format |
| - name: Build test dylib and bindings |
| run: dart --enable-asserts test/setup.dart |
| - name: Run VM tests |
| run: dart test |
| |
| test-mac-flutter: |
| needs: analyze |
| runs-on: 'macos-latest' |
| defaults: |
| run: |
| working-directory: pkgs/ffigen/ |
| steps: |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e |
| with: |
| channel: stable |
| - name: Install dependencies |
| run: dart pub get && dart pub get --directory="../objective_c" |
| - name: Build test dylib and bindings |
| run: dart --enable-asserts test/setup.dart |
| - name: Run Flutter tests |
| run: dart test |
| |
| test-windows: |
| needs: analyze |
| runs-on: windows-latest |
| defaults: |
| run: |
| working-directory: pkgs/ffigen/ |
| steps: |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e |
| with: |
| channel: stable |
| - name: Install dependencies |
| run: dart pub get && flutter pub get --directory="../jni" |
| - name: Build test dylib and bindings |
| run: dart --enable-asserts test/setup.dart |
| - name: Run VM tests |
| run: dart test |
| - name: Generate package:jni bindings |
| run: dart --enable-asserts run tool/generate_ffi_bindings.dart |
| working-directory: pkgs/jni/ |
| |
| # Sanity check the latest `flutter create --template plugin_ffi`. |
| # This will break if we change the Flutter template or the generated code. |
| # But, getting libclang on the LUCI infrastructure has proven to be |
| # non-trivial. See discussion on |
| # https://github.com/flutter/flutter/issues/105513. |
| # If we need to change the generated code, we should temporarily disable this |
| # test, or temporarily disable the requirement for all bots to be green to |
| # merge PRs. |
| # Running this sanity check on one OS should be sufficient. Chosing Windows |
| # because it is the most likely to break. |
| test-windows-flutter: |
| needs: analyze |
| runs-on: windows-latest |
| defaults: |
| run: |
| working-directory: pkgs/ffigen/ |
| steps: |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e |
| with: |
| channel: stable |
| - name: Install dependencies |
| run: flutter pub get |
| - name: Build test dylib and bindings |
| run: dart --enable-asserts test/setup.dart |
| - name: Run VM tests |
| run: flutter pub run test test_flutter/ |