Skip to content

Commit 3fc6c63

Browse files
authored
Initial coveralls setup (#165)
* Initial coveralls setup * Add badge to README.md
1 parent 1013ffb commit 3fc6c63

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ jobs:
5050
--target=integration_test/webcrypto_test.dart \
5151
-d chrome
5252
- run: xvfb-run flutter pub run test -p vm,chrome,firefox
53+
# Test with coverage collection as a separate step.
54+
# This will run in debug mode, so we test both with and without coverage.
55+
- run: xvfb-run flutter pub run test -p vm,chrome,firefox --coverage ./coverage
56+
# Report collected coverage
57+
- name: Convert coverage to lcov
58+
run: dart run coverage:format_coverage -i ./coverage -o ./coverage/lcov.info --lcov --report-on lib/
59+
- uses: coverallsapp/github-action@v2
60+
with:
61+
flag-name: linux
62+
parallel: true
5363
macos-14:
5464
name: webcrypto on macOS 14 desktop / Chrome
5565
runs-on: macos-14 # Test with xcode 15
@@ -141,6 +151,16 @@ jobs:
141151
--target=integration_test/webcrypto_test.dart \
142152
-d chrome
143153
- run: flutter pub run test -p vm,chrome,firefox
154+
# Test with coverage collection as a separate step.
155+
# This will run in debug mode, so we test both with and without coverage.
156+
- run: xvfb-run flutter pub run test -p vm,chrome,firefox --coverage ./coverage
157+
# Report collected coverage
158+
- name: Convert coverage to lcov
159+
run: dart run coverage:format_coverage -i ./coverage -o ./coverage/lcov.info --lcov --report-on lib/
160+
- uses: coverallsapp/github-action@v2
161+
with:
162+
flag-name: windows
163+
parallel: true
144164
ios:
145165
name: webcrypto on iOS emulator (iPhone)
146166
runs-on: macos-14
@@ -187,3 +207,13 @@ jobs:
187207
api-level: 28
188208
working-directory: ./example
189209
script: flutter test integration_test/webcrypto_test.dart -d android
210+
coverage:
211+
name: Report to coveralls
212+
runs-on: ubuntu-latest
213+
needs:
214+
- linux
215+
- windows
216+
steps:
217+
- uses: coverallsapp/github-action@v2
218+
with:
219+
parallel-finished: true

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Future<void> main() async {
2525
}
2626
```
2727

28+
[![Coverage Status](https://coveralls.io/repos/github/google/webcrypto.dart/badge.svg?branch=master)](https://coveralls.io/github/google/webcrypto.dart?branch=master)
29+
2830
**Features:**
2931
* Get random bytes
3032
* Digest (sha-1/sha-256/sha-384/sha-512)

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ dev_dependencies:
3838
flutter_lints: ^4.0.0
3939
flutter_test:
4040
sdk: flutter
41+
coverage: any # we only need format_coverage, don't care what version
4142

4243
flutter:
4344
plugin:

0 commit comments

Comments
 (0)