Skip to content

Commit 305164d

Browse files
committed
Let the coverage workflow take care of everything about test coverage
1 parent 166b0f6 commit 305164d

9 files changed

+56
-141
lines changed

.github/workflows/coverage.yml

Lines changed: 47 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,59 @@
11
name: Combined Coverage Report
22

33
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:
168

179
jobs:
18-
combine-coverage:
10+
coverage:
11+
name: Generate Combined Coverage
1912
runs-on: ubuntu-latest
20-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
2113

2214
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
3918
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+
4451
- name: Combine coverage reports
4552
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
5057
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

.github/workflows/functions_client.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,4 @@ jobs:
5050
run: dart analyze
5151

5252
- name: Run tests
53-
run: dart test --coverage=./coverage
54-
55-
- name: Format coverage
56-
if: ${{ matrix.sdk == 'stable'}}
57-
run: |
58-
dart pub global activate coverage
59-
dart pub global run coverage:format_coverage --lcov --in="./coverage/test" --out="./coverage/lcov.info" --report-on="./lib"
60-
61-
- name: Upload coverage artifact
62-
if: ${{ matrix.sdk == 'stable'}}
63-
uses: actions/upload-artifact@v4
64-
with:
65-
name: coverage-flutter-functions-client
66-
path: ./packages/functions_client/coverage/lcov.info
53+
run: dart test

.github/workflows/gotrue.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,4 @@ jobs:
6060
time: '5s'
6161

6262
- name: Run tests
63-
run: dart test --concurrency=1 --coverage=./coverage
64-
65-
- name: Format coverage
66-
run: |
67-
dart pub global activate coverage
68-
dart pub global run coverage:format_coverage --lcov --in="./coverage/test" --out="./coverage/lcov.info" --report-on="./lib"
69-
70-
- name: Upload coverage artifact
71-
if: ${{ matrix.sdk == 'stable'}}
72-
uses: actions/upload-artifact@v4
73-
with:
74-
name: coverage-flutter-gotrue
75-
path: ./packages/gotrue/coverage/lcov.info
63+
run: dart test --concurrency=1

.github/workflows/postgrest.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,4 @@ jobs:
6060
time: '5s'
6161

6262
- name: Run tests
63-
run: dart test --concurrency=1 --coverage=./coverage
64-
65-
- name: Format coverage
66-
run: |
67-
dart pub global activate coverage
68-
dart pub global run coverage:format_coverage --lcov --in="./coverage/test" --out="./coverage/lcov.info" --report-on="./lib"
69-
70-
- name: Upload coverage artifact
71-
if: ${{ matrix.sdk == 'stable'}}
72-
uses: actions/upload-artifact@v4
73-
with:
74-
name: coverage-flutter-postgrest
75-
path: ./packages/postgrest/coverage/lcov.info
63+
run: dart test --concurrency=1

.github/workflows/realtime_client.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,4 @@ jobs:
4949
run: dart analyze
5050

5151
- name: Run tests
52-
run: dart test --concurrency=1 --coverage=./coverage
53-
54-
- name: Format coverage
55-
run: |
56-
dart pub global activate coverage
57-
dart pub global run coverage:format_coverage --lcov --in="./coverage/test" --out="./coverage/lcov.info" --report-on="./lib"
58-
59-
- name: Upload coverage artifact
60-
if: ${{ matrix.sdk == 'stable'}}
61-
uses: actions/upload-artifact@v4
62-
with:
63-
name: coverage-flutter-realtime-client
64-
path: ./packages/realtime_client/coverage/lcov.info
52+
run: dart test --concurrency=1

.github/workflows/storage_client.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,4 @@ jobs:
6060
time: '5s'
6161

6262
- name: Run tests
63-
run: dart test --coverage=./coverage
64-
65-
- name: Format coverage
66-
run: |
67-
dart pub global activate coverage
68-
dart pub global run coverage:format_coverage --lcov --in="./coverage/test" --out="./coverage/lcov.info" --report-on="./lib"
69-
70-
- name: Upload coverage artifact
71-
if: ${{ matrix.sdk == 'stable'}}
72-
uses: actions/upload-artifact@v4
73-
with:
74-
name: coverage-flutter-storage-client
75-
path: ./packages/storage_client/coverage/lcov.info
63+
run: dart test

.github/workflows/supabase.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,4 @@ jobs:
4949
run: dart analyze
5050

5151
- name: Run tests
52-
run: dart test --concurrency=1 --coverage=./coverage
53-
54-
- name: Format coverage
55-
run: |
56-
dart pub global activate coverage
57-
dart pub global run coverage:format_coverage --lcov --in="./coverage/test" --out="./coverage/lcov.info" --report-on="./lib"
58-
59-
- name: Upload coverage artifact
60-
if: ${{ matrix.sdk == 'stable'}}
61-
uses: actions/upload-artifact@v4
62-
with:
63-
name: coverage-flutter-supabase
64-
path: ./packages/supabase/coverage/lcov.info
52+
run: dart test --concurrency=1

.github/workflows/supabase_flutter.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
run: flutter analyze --fatal-warnings --fatal-infos .
4848

4949
- name: Run tests
50-
run: flutter test --concurrency=1 --coverage
50+
run: flutter test --concurrency=1
5151

5252
- name: Run tests with downgraded app_links
5353
run: |
@@ -57,11 +57,4 @@ jobs:
5757
- name: Verify if Flutter web build is successful
5858
run: |
5959
cd example
60-
flutter build web
61-
62-
- name: Upload coverage artifact
63-
if: ${{ matrix.sdk == 'stable'}}
64-
uses: actions/upload-artifact@v4
65-
with:
66-
name: coverage-flutter-supabase-flutter
67-
path: ./packages/supabase_flutter/coverage/lcov.info
60+
flutter build web

.github/workflows/yet_another_json_isolate.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,4 @@ jobs:
4949
run: dart analyze
5050

5151
- name: Run tests
52-
run: dart test --coverage=./coverage
53-
54-
- name: Format coverage
55-
run: |
56-
dart pub global activate coverage
57-
dart pub global run coverage:format_coverage --lcov --in="./coverage/test" --out="./coverage/lcov.info" --report-on="./lib"
58-
59-
- name: Upload coverage artifact
60-
if: ${{ matrix.sdk == 'stable'}}
61-
uses: actions/upload-artifact@v4
62-
with:
63-
name: coverage-flutter-yet-another-json-isolate
64-
path: ./packages/yet_another_json_isolate/coverage/lcov.info
52+
run: dart test

0 commit comments

Comments
 (0)