| name: ffigen |
| |
| on: |
| # Run on PRs and pushes to the default branch, in either the ffigen directory, |
| # or the objective_c directory. |
| push: |
| branches: [main, stable] |
| 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@9bb56186c3b09b4f86b1c65136769dd318469633 |
| - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 |
| with: |
| flutter-version: 3.19.0 |
| channel: 'stable' |
| - id: install |
| name: Install dependencies |
| run: flutter pub get && flutter pub get --directory="example/shared_bindings" |
| - 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 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@9bb56186c3b09b4f86b1c65136769dd318469633 |
| - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 |
| with: |
| flutter-version: 3.19.0 |
| channel: 'stable' |
| - name: Install dependencies |
| run: flutter pub get |
| - name: Install libclang-14-dev |
| run: sudo apt-get install libclang-14-dev |
| - name: Build test dylib and bindings |
| run: dart test/setup.dart |
| - name: Run VM tests |
| run: dart test |
| |
| # 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@9bb56186c3b09b4f86b1c65136769dd318469633 |
| - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 |
| with: |
| flutter-version: 3.19.0 |
| channel: 'stable' |
| - name: Install dependencies |
| run: flutter pub get |
| - name: Build test dylib and bindings |
| run: dart test/setup.dart |
| - name: Run VM tests |
| run: dart test |
| - name: Collect coverage |
| run: ./tool/coverage.sh |
| - name: Upload coverage |
| uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 |
| with: |
| flag-name: ffigen_macos |
| github-token: ${{ secrets.GITHUB_TOKEN }} |
| parallel: true |
| path-to-lcov: pkgs/ffigen/lcov.info |
| - name: Upload coverage |
| uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 |
| with: |
| carryforward: "jnigen_tests,jni_tests,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" |
| github-token: ${{ secrets.GITHUB_TOKEN }} |
| parallel-finished: true |
| |
| test-windows: |
| needs: analyze |
| runs-on: windows-latest |
| defaults: |
| run: |
| working-directory: pkgs/ffigen/ |
| steps: |
| - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 |
| - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 |
| with: |
| flutter-version: 3.19.0 |
| channel: 'stable' |
| - name: Install dependencies |
| run: flutter pub get |
| - name: Build test dylib and bindings |
| run: dart test/setup.dart |
| - name: Run VM tests |
| run: dart test |
| |
| # 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@9bb56186c3b09b4f86b1c65136769dd318469633 |
| - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 |
| with: |
| channel: "master" |
| - name: Install dependencies |
| run: flutter pub get |
| - name: Build test dylib and bindings |
| run: dart test/setup.dart |
| - name: Run VM tests |
| run: flutter pub run test test_flutter/ |