diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 30250248..694f6806 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,6 +50,16 @@ jobs: --target=integration_test/webcrypto_test.dart \ -d chrome - run: xvfb-run flutter pub run test -p vm,chrome,firefox + # Test with coverage collection as a separate step. + # This will run in debug mode, so we test both with and without coverage. + - run: xvfb-run flutter pub run test -p vm,chrome,firefox --coverage ./coverage + # Report collected coverage + - name: Convert coverage to lcov + run: dart run coverage:format_coverage -i ./coverage -o ./coverage/lcov.info --lcov --report-on lib/ + - uses: coverallsapp/github-action@v2 + with: + flag-name: linux + parallel: true macos-14: name: webcrypto on macOS 14 desktop / Chrome runs-on: macos-14 # Test with xcode 15 @@ -141,6 +151,16 @@ jobs: --target=integration_test/webcrypto_test.dart \ -d chrome - run: flutter pub run test -p vm,chrome,firefox + # Test with coverage collection as a separate step. + # This will run in debug mode, so we test both with and without coverage. + - run: xvfb-run flutter pub run test -p vm,chrome,firefox --coverage ./coverage + # Report collected coverage + - name: Convert coverage to lcov + run: dart run coverage:format_coverage -i ./coverage -o ./coverage/lcov.info --lcov --report-on lib/ + - uses: coverallsapp/github-action@v2 + with: + flag-name: windows + parallel: true ios: name: webcrypto on iOS emulator (iPhone) runs-on: macos-14 @@ -187,3 +207,13 @@ jobs: api-level: 28 working-directory: ./example script: flutter test integration_test/webcrypto_test.dart -d android + coverage: + name: Report to coveralls + runs-on: ubuntu-latest + needs: + - linux + - windows + steps: + - uses: coverallsapp/github-action@v2 + with: + parallel-finished: true diff --git a/README.md b/README.md index c349615f..373d7fde 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ Future main() async { } ``` +[![Coverage Status](https://coveralls.io/repos/github/google/webcrypto.dart/badge.svg?branch=master)](https://coveralls.io/github/google/webcrypto.dart?branch=master) + **Features:** * Get random bytes * Digest (sha-1/sha-256/sha-384/sha-512) diff --git a/pubspec.yaml b/pubspec.yaml index f093e354..f7d6a395 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -38,6 +38,7 @@ dev_dependencies: flutter_lints: ^4.0.0 flutter_test: sdk: flutter + coverage: any # we only need format_coverage, don't care what version flutter: plugin: