ffigen #1825
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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, stable] | |
| 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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e | |
| with: | |
| channel: 'stable' | |
| - id: install | |
| name: Install dependencies | |
| run: flutter pub get && flutter pub get --directory="example/shared_bindings" && flutter pub get --directory="../objective_c" && flutter 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: flutter analyze --fatal-infos | |
| test-linux: | |
| needs: analyze | |
| runs-on: ubuntu-22.04 | |
| defaults: | |
| run: | |
| working-directory: pkgs/ffigen/ | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e | |
| with: | |
| channel: 'stable' | |
| - name: Install dependencies | |
| run: flutter 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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e | |
| with: | |
| channel: stable | |
| - name: Install dependencies | |
| run: flutter pub get && flutter 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 pub global run coverage:test_with_coverage --scope-output=ffigen --scope-output=objective_c | |
| - 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@648a8eb78e6d50909eff900e4ec85cab4524a45b | |
| 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@648a8eb78e6d50909eff900e4ec85cab4524a45b | |
| 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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e | |
| with: | |
| channel: master | |
| - name: Install dependencies | |
| run: flutter pub get && flutter 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 and collect coverage | |
| run: dart test | |
| test-mac-flutter: | |
| needs: analyze | |
| runs-on: 'macos-latest' | |
| defaults: | |
| run: | |
| working-directory: pkgs/ffigen/ | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e | |
| with: | |
| channel: 'stable' | |
| - name: Install dependencies | |
| run: flutter pub get && flutter pub get --directory="../objective_c" | |
| - name: Build test dylib and bindings | |
| run: dart --enable-asserts test/setup.dart --main-thread-dispatcher | |
| - name: Run Flutter tests | |
| run: flutter test | |
| test-windows: | |
| needs: analyze | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| working-directory: pkgs/ffigen/ | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e | |
| with: | |
| channel: 'stable' | |
| - name: Install dependencies | |
| run: flutter 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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e | |
| with: | |
| channel: "master" | |
| - 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/ |