perf(flutter): Move Android JNI work to core worker to avoid work on main isolate #13607
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: sentry-flutter | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release/** | |
| pull_request: | |
| paths: | |
| - '.github/workflows/flutter.yml' | |
| - '.github/workflows/analyze.yml' | |
| - '.github/actions/flutter-test/**' | |
| - '.github/actions/coverage/**' | |
| - '.github/actions/test-results/**' | |
| - '!**/*.md' | |
| - '!**/class-diagram.svg' | |
| - 'packages/dart/**' | |
| - 'packages/flutter/**' | |
| - 'metrics/flutter.properties' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: '${{ matrix.target }} | ${{ matrix.os }} | ${{ matrix.sdk }}' | |
| runs-on: ${{ matrix.os == 'macos' && 'macos-15' || matrix.os == 'ubuntu' && 'ubuntu-latest' || matrix.os == 'windows' && 'windows-latest' }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: [android, ios, macos, linux, windows, js, wasm] | |
| sdk: [stable, beta] | |
| include: | |
| - target: android | |
| os: ubuntu | |
| - target: ios | |
| os: macos | |
| - target: macos | |
| os: macos | |
| - target: linux | |
| os: ubuntu | |
| - target: windows | |
| os: windows | |
| - target: js | |
| os: ubuntu | |
| exclude: | |
| # Flutter WASM tests don't compile on beta currently and hangs on stable. | |
| # https://github.com/getsentry/sentry-dart/issues/3477 | |
| - target: wasm | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| # QuickFix for failing iOS 18.0 builds https://github.com/actions/runner-images/issues/12758#issuecomment-3187115656 | |
| - name: Switch to Xcode 16.4 for iOS 18.5 | |
| if: matrix.os == 'macos' | |
| run: sudo xcode-select --switch /Applications/Xcode_16.4.app | |
| # Flutter derives the local SwiftPM package identity from the plugin path basename on macOS. | |
| # Our package lives in packages/flutter, which makes Xcode resolve it as "flutter" and fail with: | |
| # "unable to override package 'sentry_flutter' because its identity 'flutter' doesn't match override's identity (directory name) 'sentry_flutter'" | |
| - name: Rename sentry_flutter package for macOS SwiftPM | |
| if: matrix.target == 'macos' | |
| run: mv packages/flutter packages/sentry_flutter | |
| - uses: ./.github/actions/flutter-test | |
| with: | |
| directory: ${{ matrix.target == 'macos' && 'packages/sentry_flutter' || 'packages/flutter' }} | |
| - uses: ./.github/actions/coverage | |
| if: matrix.target == 'linux' && matrix.sdk == 'stable' | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| directory: packages/flutter | |
| coverage: sentry_flutter | |
| min-coverage: 85 | |
| - uses: ./.github/actions/test-results | |
| if: ${{ !cancelled() && (matrix.target == 'linux' || matrix.target == 'windows' || matrix.target == 'macos') }} | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: sentry_flutter-${{ matrix.target }}-${{ matrix.sdk }} | |
| - name: Prepare example for ${{ matrix.target }} | |
| # The example currently doesn't support compiling for WASM. Should be OK once we add package:web in v9. | |
| if: matrix.target != 'wasm' | |
| working-directory: ${{ matrix.target == 'macos' && 'packages/sentry_flutter/example' || 'packages/flutter/example' }} | |
| shell: bash | |
| run: | | |
| flutter config --enable-windows-desktop | |
| flutter config --enable-macos-desktop | |
| flutter config --enable-linux-desktop | |
| TARGET=${{ matrix.target }} | |
| flutter pub get | |
| - name: Build example for ${{ matrix.target }} | |
| # The example currently doesn't support compiling for WASM. Should be OK once we add package:web in v9. | |
| if: matrix.target != 'wasm' | |
| working-directory: ${{ matrix.target == 'macos' && 'packages/sentry_flutter/example' || 'packages/flutter/example' }} | |
| shell: bash | |
| run: | | |
| TARGET=${{ matrix.target }} | |
| clear_swiftpm_cache() { | |
| bash ../../../.github/scripts/clear-swiftpm-cache.sh | |
| } | |
| case $TARGET in | |
| ios) | |
| flutter build ios --no-codesign || { | |
| clear_swiftpm_cache | |
| flutter build ios --no-codesign | |
| } | |
| ;; | |
| macos) | |
| flutter build macos || { | |
| clear_swiftpm_cache | |
| flutter build macos | |
| } | |
| ;; | |
| android) | |
| flutter build appbundle | |
| ;; | |
| js) | |
| flutter build web | |
| ;; | |
| linux) | |
| flutter build linux | |
| ;; | |
| windows) | |
| flutter build windows | |
| ;; | |
| esac | |
| cocoapods: | |
| name: 'CocoaPods | ${{ matrix.target }}' | |
| runs-on: macos-15 | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: [ios, macos] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # pin@v2.21.0 | |
| with: | |
| channel: stable | |
| - run: flutter config --no-enable-swift-package-manager | |
| - name: Log Flutter version | |
| run: flutter --version | |
| # QuickFix for failing iOS 18.0 builds https://github.com/actions/runner-images/issues/12758#issuecomment-3187115656 | |
| - name: Switch to Xcode 16.4 for iOS 18.5 | |
| run: sudo xcode-select --switch /Applications/Xcode_16.4.app | |
| - name: Run on iOS | |
| if: matrix.target == 'ios' | |
| working-directory: packages/flutter/example | |
| run: flutter build ios --no-codesign | |
| - name: Run on macOS | |
| if: matrix.target == 'macos' | |
| working-directory: packages/flutter/example | |
| run: flutter build macos --debug | |
| analyze: | |
| uses: ./.github/workflows/analyze.yml | |
| with: | |
| package: packages/flutter | |
| sdk: flutter | |
| pod-lint: | |
| runs-on: macos-15 | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| working-directory: packages/flutter | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| # https://github.com/CocoaPods/CocoaPods/issues/5275#issuecomment-315461879 | |
| # QuickFix for failing iOS 18.0 builds https://github.com/actions/runner-images/issues/12758#issuecomment-3187115656 | |
| - name: Switch to Xcode 16.4 for iOS 18.5 | |
| run: sudo xcode-select --switch /Applications/Xcode_16.4.app | |
| - run: pod lib lint ios/sentry_flutter.podspec --configuration=Debug --skip-import-validation --allow-warnings --verbose | |
| swift-lint: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| working-directory: packages/flutter | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - uses: norio-nomura/action-swiftlint@9f4dcd7fd46b4e75d7935cf2f4df406d5cae3684 # pin@3.2.1 | |
| with: | |
| args: --strict | |
| ktlint: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| working-directory: packages/flutter | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: ktlint | |
| uses: ScaCap/action-ktlint@26c5e9b625966139d9956cbbb6217375480d4e14 # pin@1.9.0 | |
| with: | |
| github_token: ${{ secrets.github_token }} | |
| reporter: github-pr-review | |
| android: true | |
| fail_on_error: true | |
| # TODO: disabled until the following is fixed https://github.com/natiginfo/action-detekt-all/issues/73 | |
| # detekt: | |
| # runs-on: ubuntu-latest | |
| # timeout-minutes: 20 | |
| # steps: | |
| # - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| # # To recreate baseline run: detekt -i packages/flutter/android,packages/flutter/example/android -b packages/flutter/config/detekt-bl.xml -cb | |
| # - uses: natiginfo/action-detekt-all@45229fbbe47eaff1160b6c956d7ffe14dc23c206 # pin@1.23.8 | |
| # with: | |
| # args: -i packages/flutter/android,packages/flutter/example/android --baseline packages/flutter/config/detekt-bl.xml --jvm-target 1.8 --build-upon-default-config --all-rules |