Skip to content

Commit 6523e6b

Browse files
authored
Add code coverage (dart-archive/yaml_edit#38)
* Add code coverage * Use dev_dependency in package:coverage * Skip code-coverage on 2.12.0 * Adding coveralls badge
1 parent abb3cb5 commit 6523e6b

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

pkgs/yaml_edit/.github/workflows/test-package.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ jobs:
4747
matrix:
4848
# Add macos-latest and/or windows-latest if relevant for this package.
4949
os: [ubuntu-latest]
50-
sdk: [2.12.0, dev]
50+
sdk: [2.12.0, stable, dev]
51+
platform: [vm, chrome]
5152
steps:
5253
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
5354
- uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46
@@ -56,9 +57,24 @@ jobs:
5657
- id: install
5758
name: Install dependencies
5859
run: dart pub get
59-
- name: Run VM tests
60-
run: dart test --platform vm
61-
if: always() && steps.install.outcome == 'success'
62-
- name: Run Chrome tests
63-
run: dart test --platform chrome
60+
- name: Run tests on ${{ matrix.platform }}
61+
run: dart test --platform ${{ matrix.platform }} --coverage=./coverage
6462
if: always() && steps.install.outcome == 'success'
63+
# We don't collect code coverage from 2.12.0, because it doesn't work
64+
- name: Convert coverage to lcov
65+
run: dart run coverage:format_coverage -i ./coverage -o ./coverage/lcov.info --lcov --report-on lib/
66+
if: always() && steps.install.outcome == 'success' && matrix.sdk != '2.12.0'
67+
- uses: coverallsapp/github-action@v1
68+
if: always() && steps.install.outcome == 'success' && matrix.sdk != '2.12.0'
69+
with:
70+
flag-name: os:${{ matrix.os }}/dart:${{ matrix.sdk }}/platform:${{ matrix.platform }}
71+
parallel: true
72+
73+
report-coverage:
74+
needs: test
75+
if: ${{ always() }}
76+
runs-on: ubuntu-latest
77+
steps:
78+
- uses: coverallsapp/github-action@v1
79+
with:
80+
parallel-finished: true

pkgs/yaml_edit/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[![Dart CI](https://github.com/dart-lang/yaml_edit/actions/workflows/test-package.yml/badge.svg)](https://github.com/dart-lang/yaml_edit/actions/workflows/test-package.yml)
22
[![pub package](https://img.shields.io/pub/v/yaml_edit.svg)](https://pub.dev/packages/yaml_edit)
33
[![package publisher](https://img.shields.io/pub/publisher/yaml_edit.svg)](https://pub.dev/packages/yaml_edit/publisher)
4+
[![Coverage Status](https://coveralls.io/repos/github/dart-lang/yaml_edit/badge.svg)](https://coveralls.io/github/dart-lang/yaml_edit)
45

56
A library for [YAML](https://yaml.org) manipulation while preserving comments.
67

pkgs/yaml_edit/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ dev_dependencies:
1717
lints: ^1.0.1
1818
path: ^1.8.0
1919
test: ^1.17.12
20+
coverage: # we only need format_coverage, don't care what version

0 commit comments

Comments
 (0)