Add code coverage (#38) * Add code coverage * Use dev_dependency in package:coverage * Skip code-coverage on 2.12.0 * Adding coveralls badge
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml index 1ec39b5..e1a4953 100644 --- a/.github/workflows/test-package.yml +++ b/.github/workflows/test-package.yml
@@ -47,7 +47,8 @@ matrix: # Add macos-latest and/or windows-latest if relevant for this package. os: [ubuntu-latest] - sdk: [2.12.0, dev] + sdk: [2.12.0, stable, dev] + platform: [vm, chrome] steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 @@ -56,9 +57,24 @@ - id: install name: Install dependencies run: dart pub get - - name: Run VM tests - run: dart test --platform vm + - name: Run tests on ${{ matrix.platform }} + run: dart test --platform ${{ matrix.platform }} --coverage=./coverage if: always() && steps.install.outcome == 'success' - - name: Run Chrome tests - run: dart test --platform chrome - if: always() && steps.install.outcome == 'success' + # We don't collect code coverage from 2.12.0, because it doesn't work + - name: Convert coverage to lcov + run: dart run coverage:format_coverage -i ./coverage -o ./coverage/lcov.info --lcov --report-on lib/ + if: always() && steps.install.outcome == 'success' && matrix.sdk != '2.12.0' + - uses: coverallsapp/github-action@v1 + if: always() && steps.install.outcome == 'success' && matrix.sdk != '2.12.0' + with: + flag-name: os:${{ matrix.os }}/dart:${{ matrix.sdk }}/platform:${{ matrix.platform }} + parallel: true + + report-coverage: + needs: test + if: ${{ always() }} + runs-on: ubuntu-latest + steps: + - uses: coverallsapp/github-action@v1 + with: + parallel-finished: true
diff --git a/README.md b/README.md index 71639c3..f10560b 100644 --- a/README.md +++ b/README.md
@@ -1,6 +1,7 @@ [](https://github.com/dart-lang/yaml_edit/actions/workflows/test-package.yml) [](https://pub.dev/packages/yaml_edit) [](https://pub.dev/packages/yaml_edit/publisher) +[](https://coveralls.io/github/dart-lang/yaml_edit) A library for [YAML](https://yaml.org) manipulation while preserving comments.
diff --git a/pubspec.yaml b/pubspec.yaml index eca8e2b..d726abe 100644 --- a/pubspec.yaml +++ b/pubspec.yaml
@@ -17,3 +17,4 @@ lints: ^1.0.1 path: ^1.8.0 test: ^1.17.12 + coverage: # we only need format_coverage, don't care what version