diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index f920a44..762d510 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -7,9 +7,9 @@ name: Dart on: push: - branches: [ "master" ] + branches: ['master'] pull_request: - branches: [ "master" ] + branches: ['master'] jobs: build: @@ -40,3 +40,30 @@ jobs: # want to change this to 'flutter test'. - name: Run tests run: dart test + + coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + # Note: This workflow uses the latest stable version of the Dart SDK. + # You can specify other versions if desired, see documentation here: + # https://github.com/dart-lang/setup-dart/blob/main/README.md + # - uses: dart-lang/setup-dart@v1 + - uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603 + + - name: Install dependencies + run: dart pub get + + - name: Install coverage tools + run: dart pub global activate coverage + + - name: Run coverage + run: dart pub global run coverage:test_with_coverage + + - name: Upload coverage + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true # optional (default = false) + token: ${{ secrets.CODECOV_TOKEN }} # required + verbose: true # optional (default = false) diff --git a/README.md b/README.md index 71780f2..93bc195 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Dart](https://github.com/MatthiWare/mediator.dart/actions/workflows/dart.yml/badge.svg?branch=master)](https://github.com/MatthiWare/mediator.dart/actions/workflows/dart.yml) [![pub package](https://img.shields.io/pub/v/dart_mediator.svg?label=dart_mediator&color=blue)](https://pub.dartlang.org/packages/dart_mediator) +[![codecov](https://codecov.io/gh/MatthiWare/mediator.dart/graph/badge.svg?token=W1WQDQEZIJ)](https://codecov.io/gh/MatthiWare/mediator.dart) # Description