fix: add mounted guard before setState in _CopyButton._copyToClipboard #49
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 | |
| # Exclude test/golden/ — visual snapshot tests don't add coverage signal | |
| # and fail on Linux because reference PNGs were generated on macOS. | |
| # Golden correctness is enforced by the dedicated golden.yml workflow. | |
| run: | | |
| readarray -d '' TEST_FILES < <( | |
| find test -name '*_test.dart' -not -path 'test/golden/*' -print0 | |
| ) | |
| flutter test --no-pub --coverage "${TEST_FILES[@]}" | |
| - 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 < 50" | bc -l) )); then | |
| echo "❌ Coverage below 50% 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 |