From a7d842cdc773e5cfc0e0e6dfc3d6992f76b6f3d8 Mon Sep 17 00:00:00 2001 From: Jonas Finnemann Jensen Date: Wed, 23 Oct 2024 13:16:36 +0200 Subject: [PATCH 1/2] Initial coveralls setup --- .github/workflows/test.yml | 30 ++++++++++++++++++++++++++++++ pubspec.yaml | 1 + 2 files changed, 31 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7c5050f4..92c378d5 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 @@ -129,6 +139,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 @@ -175,3 +195,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/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: From 81d914789de03c42b90f856389b3e1f8538acce5 Mon Sep 17 00:00:00 2001 From: Jonas Finnemann Jensen Date: Wed, 23 Oct 2024 13:23:42 +0200 Subject: [PATCH 2/2] Add badge to README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) 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)