Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ICPFLUTTER-1065' into 8.3.0-mod
Browse files Browse the repository at this point in the history
  • Loading branch information
al-farisi committed Jul 12, 2024
2 parents 67a0238 + d72d349 commit 6329898
Show file tree
Hide file tree
Showing 333 changed files with 21,058 additions and 6,727 deletions.
7 changes: 6 additions & 1 deletion .craft.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
minVersion: 0.29.2
minVersion: 1.21.0
changelogPolicy: auto
artifactProvider:
name: none
targets:
- name: pub-dev
# This is temporarily needed because we keep the package:web dependency implicit
# See https://github.com/getsentry/sentry-dart/pull/2113 for more context
skipValidation: true
packages:
dart:
flutter:
Expand All @@ -13,6 +16,7 @@ targets:
sqflite:
hive:
drift:
isar:
- name: github
- name: registry
sdks:
Expand All @@ -24,3 +28,4 @@ targets:
pub:sentry_sqflite:
pub:sentry_drift:
pub:sentry_hive:
pub:sentry_isar:
41 changes: 41 additions & 0 deletions .github/actions/coverage/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Dart tests
description: Run Dart Tests and collect coverage
inputs:
directory:
description: The directory to run tests in
required: false
default: ''
coverage:
description: Codecov name
required: false
default: ''
min-coverage:
description: Minimum coverage percentage
required: false
default: '0'
token:
description: Codecov token
required: true

runs:
using: composite

steps:
- name: Format coverage info
if: ${{ inputs.coverage != '' }}
run: dart pub run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib
shell: bash
working-directory: ${{ inputs.directory }}

- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # pin@v3
if: ${{ inputs.coverage != '' }}
with:
name: ${{ inputs.coverage != '' }}
files: ./${{ inputs.directory }}/coverage/lcov.info
token: ${{ inputs.token }}

- uses: VeryGoodOpenSource/very_good_coverage@c953fca3e24a915e111cc6f55f03f756dcb3964c # pin@v3.0.0
if: ${{ inputs.coverage != '' }}
with:
path: './${{ inputs.directory }}/coverage/lcov.info'
min_coverage: ${{ inputs.min-coverage }}
40 changes: 40 additions & 0 deletions .github/actions/dart-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Dart tests
description: Run Dart tests
inputs:
directory:
description: The directory to run tests in
required: false
default: ''
web:
description: Whether to run tests for web
required: false
default: 'true'

runs:
using: composite

steps:
- uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 # pin@v1
with:
sdk: ${{ matrix.sdk }}

- run: dart pub get
shell: bash
working-directory: ${{ inputs.directory }}

- name: Test VM
run: dart test -p vm ${{ (runner.os == 'Linux' && matrix.sdk == 'stable' && '--coverage=coverage') || '' }} --test-randomize-ordering-seed=random --chain-stack-traces
shell: bash
working-directory: ${{ inputs.directory }}

- name: Test dart2js
if: ${{ inputs.web == 'true' }}
run: dart test -p chrome --test-randomize-ordering-seed=random --chain-stack-traces
shell: bash
working-directory: ${{ inputs.directory }}

- name: Test dart2wasm
if: ${{ inputs.web == 'true' && (matrix.sdk == 'stable' || matrix.sdk == 'beta') && runner.os != 'Windows' }}
run: dart test -p chrome --compiler dart2wasm --test-randomize-ordering-seed=random --chain-stack-traces
shell: bash
working-directory: ${{ inputs.directory }}
16 changes: 8 additions & 8 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@01ce38bf961b4e243a6342cbade0dbc8ba3f0432 # pin@0.12.0
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # pin@0.12.1
with:
access_token: ${{ github.token }}

Expand All @@ -32,16 +32,16 @@ jobs:
working-directory: ${{ inputs.package }}
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 # pin@v1
if: ${{ inputs.sdk == 'dart' }}
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225 # pin@v2.12.0
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # pin@v2.16.0
if: ${{ inputs.sdk == 'flutter' }}

- run: ${{ inputs.sdk }} pub get
- run: dart format --set-exit-if-changed ./

- name: dart analyze
uses: invertase/github-action-dart-analyzer@1cda5922c6369263b1c7e2fbe281f69704f4d63e # pin@v2.0.0
uses: invertase/github-action-dart-analyzer@e981b01a458d0bab71ee5da182e5b26687b7101b # pin@v3.0.0
with:
annotate: true
fatal-infos: true
Expand All @@ -56,7 +56,7 @@ jobs:
# 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/') && inputs.panaThreshold > 0 }}
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
Expand All @@ -65,7 +65,7 @@ jobs:
working-directory: ${{ inputs.package }}
run: |
sed -i.bak 's|sentry:.*|sentry:\n path: /github/workspace/dart|g' pubspec.yaml
- uses: axel-op/dart-package-analyzer@7a6c3c66bce78d82b729a1ffef2d9458fde6c8d2 # pin@v3
- uses: axel-op/dart-package-analyzer@56afb7e6737bd2b7cee05382ae7f0e8111138080 # pin@v3
id: analysis
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -78,6 +78,6 @@ jobs:
PERCENTAGE=$(( $TOTAL * 100 / $TOTAL_MAX ))
if (( $PERCENTAGE < ${{ inputs.panaThreshold }} ))
then
echo Score too low!
echo "Score too low ($PERCENTAGE % is less than the expected ${{ inputs.panaThreshold }} %)!"
exit 1
fi
90 changes: 36 additions & 54 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,85 +5,67 @@ on:
- main
- release/**
pull_request:
paths-ignore:
- "**/*.md"
- "logging/**"
- "dio/**"
- "file/**"
- "sqflite/**"
- "hive/**"
- "drift/**"
paths:
- '!**/*.md'
- '!**/class-diagram.svg'
- '.github/workflows/dart.yml'
- 'dart/**'

jobs:
cancel-previous-workflow:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@01ce38bf961b4e243a6342cbade0dbc8ba3f0432 # pin@0.12.0
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # pin@0.12.1
with:
access_token: ${{ github.token }}

build:
name: Build ${{matrix.sdk}} on ${{matrix.os}}
runs-on: ${{ matrix.os }}
name: Dart ${{matrix.sdk}} on ${{matrix.os}}
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 30
defaults:
run:
shell: bash
working-directory: ./dart
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
sdk: [stable, beta]
exclude:
- os: windows-latest
sdk: beta
- os: macos-latest
sdk: beta
os: [ubuntu]
sdk:
- '2.18'
- '2.19'
- '3.0'
- '3.1'
- '3.2'
- '3.3'
- '3.4'
- stable
- beta
include:
- os: windows
sdk: stable
- os: macos
sdk: stable
steps:
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1
with:
sdk: ${{ matrix.sdk }}
- uses: actions/checkout@v4

- name: Test (VM and browser)
run: |
dart pub get
dart test -p chrome --test-randomize-ordering-seed=random --chain-stack-traces
dart test -p vm --coverage=coverage --test-randomize-ordering-seed=random --chain-stack-traces
dart pub run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib
- uses: ./.github/actions/dart-test
with:
directory: dart

- name: Install webdev
if: runner.os != 'Windows'
run: dart pub global activate webdev
- uses: ./.github/actions/coverage
if: runner.os == 'Linux' && matrix.sdk == 'stable'
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: dart
coverage: sentry
min-coverage: 85

- name: Build example
working-directory: dart/example
run: |
cd example
dart pub get
dart compile aot-snapshot bin/example.dart
- name: Build Web example
if: runner.os != 'Windows'
run: |
cd example_web
dart pub get
webdev build
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # pin@v3
if: runner.os == 'Linux' && matrix.sdk == 'stable'
with:
name: sentry
files: ./dart/coverage/lcov.info

- uses: VeryGoodOpenSource/very_good_coverage@e5c91bc7ce9843e87c800b3bcafdfb86fbe28491 # pin@v2.1.0
if: runner.os == 'Linux' && matrix.sdk == 'stable'
with:
path: "./dart/coverage/lcov.info"
min_coverage: 85

analyze:
uses: ./.github/workflows/analyze.yml
with:
package: dart
panaThreshold: 87
6 changes: 5 additions & 1 deletion .github/workflows/diagrams.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
name: "Create class diagrams of all packages"
steps:
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 # pin@v1
with:
sdk: stable

Expand Down Expand Up @@ -47,6 +47,10 @@ jobs:
working-directory: ./hive
run: lakos . -i "{test/**,example/**}" | dot -Tsvg -o class-diagram.svg

- name: isar
working-directory: ./isar
run: lakos . -i "{test/**,example/**}" | dot -Tsvg -o class-diagram.svg

# Source: https://stackoverflow.com/a/58035262
- name: Extract branch name
shell: bash
Expand Down
44 changes: 14 additions & 30 deletions .github/workflows/dio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,26 @@ on:
- main
- release/**
pull_request:
paths-ignore:
- "**/*.md"
- "logging/**"
- "flutter/**"
- "file/**"
- "sqflite/**"
- "hive/**"
- "drift/**"
paths:
- '!**/*.md'
- '!**/class-diagram.svg'
- '.github/workflows/dio.yml'
- 'dart/**'
- 'dio/**'

jobs:
cancel-previous-workflow:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@01ce38bf961b4e243a6342cbade0dbc8ba3f0432 # pin@0.12.0
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # pin@0.12.1
with:
access_token: ${{ github.token }}

build:
name: Build ${{matrix.sdk}} on ${{matrix.os}}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
defaults:
run:
shell: bash
working-directory: ./dio
strategy:
fail-fast: false
matrix:
Expand All @@ -42,29 +36,19 @@ jobs:
- os: macos-latest
sdk: beta
steps:
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # pin@v1
with:
sdk: ${{ matrix.sdk }}
- uses: actions/checkout@v4

- name: Test (VM and browser)
run: |
dart pub get
dart test -p chrome --test-randomize-ordering-seed=random --chain-stack-traces
dart test -p vm --coverage=coverage --test-randomize-ordering-seed=random --chain-stack-traces
dart pub run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # pin@v3
if: runner.os == 'Linux' && matrix.sdk == 'stable'
- uses: ./.github/actions/dart-test
with:
name: sentry_dio
files: ./dio/coverage/lcov.info
directory: dio

- uses: VeryGoodOpenSource/very_good_coverage@e5c91bc7ce9843e87c800b3bcafdfb86fbe28491 # pin@v2.1.0
- uses: ./.github/actions/coverage
if: runner.os == 'Linux' && matrix.sdk == 'stable'
with:
path: "./dio/coverage/lcov.info"
min_coverage: 81
token: ${{ secrets.CODECOV_TOKEN }}
directory: dio
coverage: sentry_dio
min-coverage: 81

analyze:
uses: ./.github/workflows/analyze.yml
Expand Down
Loading

0 comments on commit 6329898

Please sign in to comment.