Skip to content

fix: try/catch critical paths #8690

fix: try/catch critical paths

fix: try/catch critical paths #8690

Workflow file for this run

name: sentry-flutter
on:
push:
branches:
- main
- release/**
pull_request:
paths:
- '.github/workflows/flutter.yml'
- '!**/*.md'
- '!**/class-diagram.svg'
- 'dart/**'
- 'flutter/**'
- 'metrics/flutter.properties'
jobs:
cancel-previous-workflow:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # [email protected]
with:
access_token: ${{ github.token }}
build:
name: '${{ matrix.target }} | ${{ matrix.os }} | ${{ matrix.sdk }}'
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 30
defaults:
run:
shell: bash
working-directory: flutter
strategy:
fail-fast: false
matrix:
target: [android, ios, macos, linux, windows, web]
sdk: [stable, beta]
# Specify which platform to run on for each target:
include:
- target: android
os: ubuntu
- target: ios
os: macos
- target: macos
os: macos
- target: linux
os: ubuntu
- target: windows
os: windows
- target: web
os: ubuntu
# Exclude beta for windows for now until the flutter set up action does not fail anymore
exclude:
- target: windows
sdk: beta
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
if: ${{ matrix.target == 'android' }}
with:
java-version: '17'
distribution: 'adopt'
# Install required dependencies for Flutter on Linux on Ubuntu
- name: 'Setup Linux'
run: |
sudo apt update
sudo apt install -y cmake dbus libblkid-dev libgtk-3-dev liblzma-dev ninja-build pkg-config xvfb libcurl4-openssl-dev
sudo apt install -y network-manager upower
if: matrix.target == 'linux'
- uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 # [email protected]
with:
channel: ${{ matrix.sdk }}
- run: flutter upgrade
- name: Pub Get
run: flutter pub get
- name: Test web (JS)
if: matrix.target == 'web'
run: |
flutter test --platform chrome --test-randomize-ordering-seed=random --exclude-tags canvasKit
flutter test --platform chrome --test-randomize-ordering-seed=random --tags canvasKit --web-renderer canvaskit
- name: Test web (WASM)
if: matrix.target == 'web'
run: |
flutter test --platform chrome --wasm --test-randomize-ordering-seed=random --exclude-tags canvasKit
flutter test --platform chrome --wasm --test-randomize-ordering-seed=random --tags canvasKit --web-renderer canvaskit
- name: Test VM with coverage
if: matrix.target == 'linux' || matrix.target == 'macos' || matrix.target == 'windows'
run: |
flutter test --coverage --test-randomize-ordering-seed=random
dart run remove_from_coverage -f coverage/lcov.info -r 'binding.dart'
- uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # pin@v3
if: matrix.sdk == 'stable' && matrix.target == 'linux'
with:
name: sentry_flutter
file: ./flutter/coverage/lcov.info
functionalities: 'search' # remove after https://github.com/codecov/codecov-action/issues/600
token: ${{ secrets.CODECOV_TOKEN }}
- uses: VeryGoodOpenSource/very_good_coverage@c953fca3e24a915e111cc6f55f03f756dcb3964c # [email protected]
if: matrix.sdk == 'stable' && matrix.target == 'linux'
with:
path: './flutter/coverage/lcov.info'
min_coverage: 90
# 'native/c' for now because we run coverage on Linux where these are not tested yet.
exclude: 'lib/src/native/cocoa/binding.dart lib/src/native/c/*'
- name: Build ${{ matrix.target }}
working-directory: flutter/example
run: |
flutter config --enable-windows-desktop
flutter config --enable-macos-desktop
flutter config --enable-linux-desktop
TARGET=${{ matrix.target }}
flutter pub get
case $TARGET in
ios)
flutter build ios --no-codesign
;;
macos)
flutter build macos
;;
android)
flutter build appbundle
;;
web)
flutter build web
;;
linux)
flutter build linux
;;
windows)
flutter build windows
;;
esac
analyze:
uses: ./.github/workflows/analyze.yml
with:
package: flutter
sdk: flutter
panaThreshold: 87
pod-lint:
runs-on: macos-latest
timeout-minutes: 20
defaults:
run:
working-directory: ./flutter
steps:
- uses: actions/checkout@v4
# https://github.com/CocoaPods/CocoaPods/issues/5275#issuecomment-315461879
- 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: ./flutter
steps:
- uses: actions/checkout@v4
- uses: norio-nomura/action-swiftlint@9f4dcd7fd46b4e75d7935cf2f4df406d5cae3684 # [email protected]
with:
args: --strict
ktlint:
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
working-directory: ./flutter
steps:
- uses: actions/checkout@v4
- name: ktlint
uses: ScaCap/action-ktlint@26c5e9b625966139d9956cbbb6217375480d4e14 # [email protected]
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
android: true
fail_on_error: true
detekt:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
# To recreate baseline run: detekt -i flutter/android,flutter/example/android -b flutter/config/detekt-bl.xml -cb
- uses: natiginfo/action-detekt-all@6bf4342ea96f638ecced05cf7d7dc48acdecc854 # [email protected]
with:
args: -i flutter/android,flutter/example/android --baseline flutter/config/detekt-bl.xml --jvm-target 1.8 --build-upon-default-config --all-rules