name: sentry-flutter on: push: branches: - main - release/** pull_request: paths-ignore: - 'logging/**' - 'dio/**' jobs: build: name: ${{ matrix.target }} | ${{ matrix.os }} | ${{ matrix.sdk }} runs-on: ${{ matrix.os }} timeout-minutes: 30 defaults: run: shell: bash strategy: fail-fast: false # max-parallel: 4 matrix: os: [ubuntu-latest, windows-latest, macos-latest] target: ['ios', 'android', 'web', 'macos', 'linux', 'windows'] sdk: ['stable', 'beta'] exclude: - os: ubuntu-latest target: ios - os: ubuntu-latest target: macos - os: ubuntu-latest target: windows - os: windows-latest target: ios - os: windows-latest target: macos - os: windows-latest target: linux # macos-latest is taking hours due to limited resources - os: macos-latest target: android - os: macos-latest target: web - os: macos-latest target: linux - os: macos-latest target: windows # Bad CPU type in executable - os: macos-latest sdk: beta steps: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: distribution: 'adopt' java-version: '8' # 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 sudo apt install -y network-manager upower if: matrix.os == 'ubuntu-latest' - uses: subosito/flutter-action@1e6ee87cb840500837bcd50a667fb28815d8e310 # pin@v2 with: channel: ${{ matrix.sdk }} - run: flutter upgrade - name: Pub Get run: | cd flutter flutter pub get - name: Test chrome if: runner.os == 'Linux' run: | cd flutter flutter test --platform chrome --test-randomize-ordering-seed=random - name: Test VM with coverage if: runner.os != 'macOS' run: | cd flutter flutter test --coverage --test-randomize-ordering-seed=random # remove comment after https://github.com/codecov/codecov-action/issues/600 # - uses: codecov/codecov-action@v2 # if: runner.os == 'Linux' && matrix.sdk == 'stable' && matrix.target == 'linux' # with: # name: sentry_flutter # file: ./flutter/coverage/lcov.info - uses: VeryGoodOpenSource/very_good_coverage@feed99cc060453828a8f12e74b404baace8e4502 # pin@v1.2.1 if: runner.os == 'Linux' && matrix.sdk == 'stable' && matrix.target == 'linux' with: path: './flutter/coverage/lcov.info' min_coverage: 90 - name: Build ${{ matrix.target }} run: | flutter config --enable-windows-desktop flutter config --enable-macos-desktop flutter config --enable-linux-desktop cd flutter/example 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: runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@1e6ee87cb840500837bcd50a667fb28815d8e310 # pin@v2 - run: | cd flutter flutter pub get flutter format -n --set-exit-if-changed ./ flutter analyze package-analysis: # `axel-op/dart-package-analyzer` is using `flutter pub upgrade` instead of `get`, # which ignores pubspec.yaml `dependency_overrides`. Because of that, all `release/*` branches are failing, # because the package cannot find the "about to be released" version of our sentry-dart package that it depends on. if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@v3 - uses: axel-op/dart-package-analyzer@7a6c3c66bce78d82b729a1ffef2d9458fde6c8d2 # pin@v3 id: analysis with: githubToken: ${{ secrets.GITHUB_TOKEN }} relativePath: flutter/ - name: Check scores env: TOTAL: ${{ steps.analysis.outputs.total }} TOTAL_MAX: ${{ steps.analysis.outputs.total_max }} run: | PERCENTAGE=$(( $TOTAL * 100 / $TOTAL_MAX )) if (( $PERCENTAGE < 90 )) then echo Score too low! exit 1 fi pod-lint: runs-on: macos-latest defaults: run: working-directory: ./flutter steps: - uses: actions/checkout@v3 # https://github.com/CocoaPods/CocoaPods/issues/5275#issuecomment-315461879 - run: pod lib lint ios/sentry_flutter.podspec --configuration=Debug --skip-import-validation --allow-warnings swift-lint: runs-on: ubuntu-latest defaults: run: working-directory: ./flutter steps: - uses: actions/checkout@v3 - uses: norio-nomura/action-swiftlint@9f4dcd7fd46b4e75d7935cf2f4df406d5cae3684 # pin@3.2.1 ktlint: runs-on: ubuntu-latest defaults: run: working-directory: ./flutter steps: - uses: actions/checkout@v3 - name: ktlint uses: ScaCap/action-ktlint@f22fa77f33cbfaf0a1a332aae1f176c8712c8a3c # pin@1.4 with: github_token: ${{ secrets.github_token }} reporter: github-pr-review android: true detekt: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 # To recreate baseline run: detekt -i flutter/android,flutter/example/android -b flutter/config/detekt-bl.xml -cb - uses: natiginfo/action-detekt-all@e01de6ff0eef7c24131e8a133bf598cfac6ceeab # pin@1.21.0 with: args: -i flutter/android,flutter/example/android --baseline flutter/config/detekt-bl.xml