| 
1 | 1 | name: Combined Coverage Report  | 
2 | 2 | 
 
  | 
3 | 3 | on:  | 
4 |  | -  workflow_run:  | 
5 |  | -    workflows:  | 
6 |  | -      - 'functions_client'  | 
7 |  | -      - 'gotrue'  | 
8 |  | -      - 'postgrest'  | 
9 |  | -      - 'realtime_client'  | 
10 |  | -      - 'storage_client'  | 
11 |  | -      - 'supabase'  | 
12 |  | -      - 'supabase_flutter'  | 
13 |  | -      - 'yet_another_json_isolate'  | 
14 |  | -    types:  | 
15 |  | -      - completed  | 
 | 4 | +  push:  | 
 | 5 | +    branches:  | 
 | 6 | +      - main  | 
 | 7 | +  pull_request:  | 
16 | 8 | 
 
  | 
17 | 9 | jobs:  | 
18 |  | -  combine-coverage:  | 
 | 10 | +  coverage:  | 
 | 11 | +    name: Generate Combined Coverage  | 
19 | 12 |     runs-on: ubuntu-latest  | 
20 |  | -    if: ${{ github.event.workflow_run.conclusion == 'success' }}  | 
21 | 13 | 
 
  | 
22 | 14 |     steps:  | 
23 |  | -      - name: Checkout repository  | 
24 |  | -        uses: actions/checkout@v4  | 
25 |  | - | 
26 |  | -      - name: Setup Dart  | 
27 |  | -        uses: dart-lang/setup-dart@v1  | 
28 |  | -        with:  | 
29 |  | -          sdk: stable  | 
30 |  | - | 
31 |  | -      - name: Install coverage tool  | 
32 |  | -        run: dart pub global activate coverage  | 
33 |  | - | 
34 |  | -      - name: Create coverage directory  | 
35 |  | -        run: mkdir -p coverage  | 
36 |  | - | 
37 |  | -      - name: Download coverage artifacts  | 
38 |  | -        uses: actions/download-artifact@v4  | 
 | 15 | +      - uses: actions/checkout@v4  | 
 | 16 | +        | 
 | 17 | +      - uses: subosito/flutter-action@v2  | 
39 | 18 |         with:  | 
40 |  | -          pattern: coverage-flutter-*  | 
41 |  | -          github-token: ${{ secrets.GITHUB_TOKEN }}  | 
42 |  | -          run-id: ${{ github.event.workflow_run.id }}  | 
43 |  | - | 
 | 19 | +          flutter-version: '3.x'  | 
 | 20 | +          channel: 'stable'  | 
 | 21 | +            | 
 | 22 | +      - name: Install dependencies  | 
 | 23 | +        run: |  | 
 | 24 | +          dart pub global activate melos  | 
 | 25 | +          dart pub global activate coverage  | 
 | 26 | +          dart pub global activate combine_coverage  | 
 | 27 | +          melos bootstrap  | 
 | 28 | +            | 
 | 29 | +      - name: Run tests with coverage for all packages  | 
 | 30 | +        run: |  | 
 | 31 | +          # Create directory for combined coverage  | 
 | 32 | +          mkdir coverage  | 
 | 33 | +            | 
 | 34 | +          # Run tests for each package and generate coverage  | 
 | 35 | +          cd packages  | 
 | 36 | +          for d in */ ; do  | 
 | 37 | +            cd "$d"  | 
 | 38 | +            if [ -f "pubspec.yaml" ]; then  | 
 | 39 | +              echo "Running tests for $d"  | 
 | 40 | +              if [[ "$d" == "supabase_flutter/"* ]]; then  | 
 | 41 | +                flutter test --coverage --concurrency=1  | 
 | 42 | +              else  | 
 | 43 | +                dart test --coverage=coverage  | 
 | 44 | +                dart pub global run coverage:format_coverage --packages=.dart_tool/package_config.json --report-on=lib --lcov -o coverage/lcov.info -i coverage  | 
 | 45 | +              fi  | 
 | 46 | +            fi  | 
 | 47 | +            cd ..  | 
 | 48 | +          done  | 
 | 49 | +          cd ..  | 
 | 50 | +            | 
44 | 51 |       - name: Combine coverage reports  | 
45 | 52 |         run: |  | 
46 |  | -          find coverage -name "lcov.info" -exec cat {} + > coverage/combined_lcov.info  | 
47 |  | -
  | 
48 |  | -      - name: Upload combined coverage to Coveralls  | 
49 |  | -        uses: coverallsapp/github-action@master  | 
 | 53 | +          dart pub global run combine_coverage:combine_coverage --repo-path="./" --output-directory="coverage"  | 
 | 54 | +            | 
 | 55 | +      - name: Upload combined coverage report  | 
 | 56 | +        uses: actions/upload-artifact@v4  | 
50 | 57 |         with:  | 
51 |  | -          github-token: ${{ secrets.GITHUB_TOKEN }}  | 
52 |  | -          path-to-lcov: coverage/combined_lcov.info  | 
 | 58 | +          name: combined-coverage-report  | 
 | 59 | +          path: coverage/lcov.info  | 
0 commit comments