v0.2.0 #46
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test-and-coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Dart | |
| uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: stable | |
| - name: Cache pub dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.pub-cache | |
| key: ${{ runner.os }}-pub-stable-${{ hashFiles('**/pubspec.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pub-stable- | |
| ${{ runner.os }}-pub- | |
| - name: Install dependencies | |
| run: | | |
| if [ -f example/pubspec.yaml ]; then | |
| mv example/pubspec.yaml example/pubspec.yaml.bak | |
| fi | |
| dart pub get | |
| if [ -f example/pubspec.yaml.bak ]; then | |
| mv example/pubspec.yaml.bak example/pubspec.yaml | |
| fi | |
| - name: Analyze project | |
| run: dart analyze --fatal-infos | |
| - name: Run tests with coverage | |
| run: dart test --coverage=coverage | |
| - name: Generate lcov report | |
| run: | | |
| # Use the local dev_dependency to format coverage into lcov | |
| dart run coverage:format_coverage \ | |
| --lcov \ | |
| --in=coverage \ | |
| --out=coverage/lcov.info \ | |
| --packages=.dart_tool/package_config.json \ | |
| --report-on=lib | |
| - name: Validate coverage file exists | |
| run: | | |
| ls -la coverage || true | |
| if [ ! -f coverage/lcov.info ]; then | |
| echo "ERROR: coverage/lcov.info not found"; exit 1; fi | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| files: coverage/lcov.info | |
| fail_ci_if_error: false |