Fixed action for code coverage. #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: main | |
on: | |
pull_request: | |
types: [review_requested, opened, synchronize] | |
paths-ignore: | |
- '.gitignore' | |
- 'CHANGELOG.md' | |
- 'LICENSE' | |
- 'README.md' | |
- 'TODO.md' | |
push: | |
branches: | |
- '*' | |
paths-ignore: | |
- '.gitignore' | |
- 'CHANGELOG.md' | |
- 'LICENSE' | |
- 'README.md' | |
- 'TODO.md' | |
jobs: | |
build-and-test: | |
strategy: | |
matrix: | |
sdk: [3.3.0, stable, beta, dev] | |
osRuns: [macos-latest, windows-latest] | |
runs-on: ${{ matrix.osRuns }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dart-lang/setup-dart@v1 | |
with: | |
sdk: ${{ matrix.sdk }} | |
- name: Get packages | |
run: dart pub get | |
- name: Analyze | |
run: dart analyze | |
- name: Run unit tests | |
run: dart test --coverage=coverage | |
- name: Install coverage tools | |
if: ${{ matrix.sdk }} == 'stable' && ${{ matrix.osRuns == 'macos-latest' }} | |
run: dart pub global activate coverage | |
- name: Format coverage file | |
if: ${{ matrix.sdk }} == 'stable' && ${{ matrix.osRuns == 'macos-latest' }} | |
run: $HOME/.pub-cache/bin/format_coverage --lcov --in=coverage --out=coverage.lcov --report-on=lib | |
- name: Upload coverage reports to Codecov | |
if: ${{ matrix.sdk }} == 'stable' && ${{ matrix.osRuns == 'macos-latest' }} | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
files: coverage.lcov | |