fix(devtools): build web extension + fix pubignore blocking publish #36
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: Coverage | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Pipeline 2 (continuation) — Coverage report | |
| # | |
| # Runs only on push to main (not on PRs) to keep PR feedback fast. | |
| # Skipped entirely when no Dart files changed (docs-only push). | |
| # | |
| # Pinned to the same runner + Flutter version as Pipeline 1 & 2 so that | |
| # coverage numbers are produced in a reproducible environment. | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| env: | |
| FLUTTER_VERSION: "3.41.5" | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| # ── Detect changed paths ─────────────────────────────────────────────────── | |
| path-filter: | |
| name: Detect Changed Packages | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| changed_any_dart: ${{ steps.filter.outputs.any_dart }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: filter | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| any_dart: | |
| - '**/*.dart' | |
| - '**/pubspec.yaml' | |
| - '**/pubspec.lock' | |
| - '**/analysis_options.yaml' | |
| # ── Coverage report ──────────────────────────────────────────────────────── | |
| coverage: | |
| name: Generate Coverage | |
| runs-on: ubuntu-22.04 | |
| needs: path-filter | |
| if: needs.path-filter.outputs.changed_any_dart == 'true' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ env.FLUTTER_VERSION }} | |
| channel: stable | |
| cache: true | |
| - name: Restore pub cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.pub-cache | |
| ${{ env.PUB_CACHE }} | |
| key: pub-ubuntu-${{ hashFiles('**/pubspec.lock') }} | |
| restore-keys: pub-ubuntu- | |
| - name: flutter pub get | |
| run: flutter pub get | |
| - name: Run tests with coverage | |
| run: flutter test --no-pub --coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage/lcov.info | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Check coverage threshold | |
| run: | | |
| sudo apt-get install -y --no-install-recommends lcov | |
| total=$(lcov --summary coverage/lcov.info 2>&1 | grep "lines" | awk '{print $2}' | cut -d'%' -f1) | |
| echo "Coverage: $total%" | |
| if (( $(echo "$total < 65" | bc -l) )); then | |
| echo "❌ Coverage below 65% threshold: $total%" | |
| exit 1 | |
| else | |
| echo "✅ Coverage meets threshold: $total%" | |
| fi | |
| - name: Generate HTML report | |
| run: genhtml coverage/lcov.info -o coverage/html | |
| - name: Upload HTML report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report-${{ github.run_number }} | |
| path: coverage/html | |
| retention-days: 30 |