Skip to content

Commit

Permalink
Run tests on every PR for every packages and upload combined coverage…
Browse files Browse the repository at this point in the history
… report
  • Loading branch information
dshukertjr committed Jan 20, 2025
1 parent 114ca0f commit 166b0f6
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 116 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Combined Coverage Report

on:
workflow_run:
workflows:
- 'functions_client'
- 'gotrue'
- 'postgrest'
- 'realtime_client'
- 'storage_client'
- 'supabase'
- 'supabase_flutter'
- 'yet_another_json_isolate'
types:
- completed

jobs:
combine-coverage:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable

- name: Install coverage tool
run: dart pub global activate coverage

- name: Create coverage directory
run: mkdir -p coverage

- name: Download coverage artifacts
uses: actions/download-artifact@v4
with:
pattern: coverage-flutter-*
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}

- name: Combine coverage reports
run: |
find coverage -name "lcov.info" -exec cat {} + > coverage/combined_lcov.info
- name: Upload combined coverage to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/combined_lcov.info
19 changes: 6 additions & 13 deletions .github/workflows/functions_client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,7 @@ on:
push:
branches:
- main
paths:
- 'packages/functions_client/**'
- '.github/workflows/functions_client.yml'
- 'packages/yet_another_json_isolate/**'

pull_request:
paths:
- 'packages/functions_client/**'
- '.github/workflows/functions_client.yml'
- 'packages/yet_another_json_isolate/**'

jobs:
test:
Expand Down Expand Up @@ -62,12 +53,14 @@ jobs:
run: dart test --coverage=./coverage

- name: Format coverage
if: ${{ matrix.sdk == 'stable'}}
run: |
dart pub global activate coverage
dart pub global run coverage:format_coverage --lcov --in="./coverage/test" --out="./coverage/lcov.info" --report-on="./lib"
- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@master
- name: Upload coverage artifact
if: ${{ matrix.sdk == 'stable'}}
uses: actions/upload-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./packages/functions_client/coverage/lcov.info
name: coverage-flutter-functions-client
path: ./packages/functions_client/coverage/lcov.info
16 changes: 5 additions & 11 deletions .github/workflows/gotrue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ on:
push:
branches:
- main
paths:
- 'packages/gotrue/**'
- '.github/workflows/gotrue.yml'

pull_request:
paths:
- 'packages/gotrue/**'
- '.github/workflows/gotrue.yml'

jobs:
test:
Expand Down Expand Up @@ -74,8 +67,9 @@ jobs:
dart pub global activate coverage
dart pub global run coverage:format_coverage --lcov --in="./coverage/test" --out="./coverage/lcov.info" --report-on="./lib"
- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@master
- name: Upload coverage artifact
if: ${{ matrix.sdk == 'stable'}}
uses: actions/upload-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./packages/gotrue/coverage/lcov.info
name: coverage-flutter-gotrue
path: ./packages/gotrue/coverage/lcov.info
18 changes: 5 additions & 13 deletions .github/workflows/postgrest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,7 @@ on:
push:
branches:
- main
paths:
- 'packages/postgrest/**'
- '.github/workflows/postgrest.yml'
- 'packages/yet_another_json_isolate/**'

pull_request:
paths:
- 'packages/postgrest/**'
- '.github/workflows/postgrest.yml'
- 'packages/yet_another_json_isolate/**'

jobs:
test:
Expand Down Expand Up @@ -76,8 +67,9 @@ jobs:
dart pub global activate coverage
dart pub global run coverage:format_coverage --lcov --in="./coverage/test" --out="./coverage/lcov.info" --report-on="./lib"
- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@master
- name: Upload coverage artifact
if: ${{ matrix.sdk == 'stable'}}
uses: actions/upload-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./packages/postgrest/coverage/lcov.info
name: coverage-flutter-postgrest
path: ./packages/postgrest/coverage/lcov.info
16 changes: 5 additions & 11 deletions .github/workflows/realtime_client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ on:
push:
branches:
- main
paths:
- 'packages/realtime_client/**'
- '.github/workflows/realtime_client.yml'

pull_request:
paths:
- 'packages/realtime_client/**'
- '.github/workflows/realtime_client.yml'

jobs:
test:
Expand Down Expand Up @@ -63,8 +56,9 @@ jobs:
dart pub global activate coverage
dart pub global run coverage:format_coverage --lcov --in="./coverage/test" --out="./coverage/lcov.info" --report-on="./lib"
- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@master
- name: Upload coverage artifact
if: ${{ matrix.sdk == 'stable'}}
uses: actions/upload-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./packages/realtime_client/coverage/lcov.info
name: coverage-flutter-realtime-client
path: ./packages/realtime_client/coverage/lcov.info
15 changes: 5 additions & 10 deletions .github/workflows/storage_client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ on:
push:
branches:
- main
paths:
- 'packages/storage_client/**'
- '.github/workflows/storage_client.yml'
pull_request:
paths:
- 'packages/storage_client/**'
- '.github/workflows/storage_client.yml'

jobs:
test:
Expand Down Expand Up @@ -73,8 +67,9 @@ jobs:
dart pub global activate coverage
dart pub global run coverage:format_coverage --lcov --in="./coverage/test" --out="./coverage/lcov.info" --report-on="./lib"
- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@master
- name: Upload coverage artifact
if: ${{ matrix.sdk == 'stable'}}
uses: actions/upload-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./packages/storage_client/coverage/lcov.info
name: coverage-flutter-storage-client
path: ./packages/storage_client/coverage/lcov.info
26 changes: 5 additions & 21 deletions .github/workflows/supabase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,7 @@ on:
push:
branches:
- main
paths:
- 'packages/supabase/**'
- '.github/workflows/supabase.yml'
- 'packages/functions_client/**'
- 'packages/gotrue/**'
- 'packages/postgrest/**'
- 'packages/realtime_client/**'
- 'packages/storage_client/**'

pull_request:
paths:
- 'packages/supabase/**'
- '.github/workflows/supabase.yml'
- 'packages/functions_client/**'
- 'packages/gotrue/**'
- 'packages/postgrest/**'
- 'packages/realtime_client/**'
- 'packages/storage_client/**'

jobs:
test:
Expand Down Expand Up @@ -73,8 +56,9 @@ jobs:
dart pub global activate coverage
dart pub global run coverage:format_coverage --lcov --in="./coverage/test" --out="./coverage/lcov.info" --report-on="./lib"
- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@master
- name: Upload coverage artifact
if: ${{ matrix.sdk == 'stable'}}
uses: actions/upload-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./packages/supabase/coverage/lcov.info
name: coverage-flutter-supabase
path: ./packages/supabase/coverage/lcov.info
30 changes: 5 additions & 25 deletions .github/workflows/supabase_flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,7 @@ on:
push:
branches:
- main
paths:
- 'packages/supabase_flutter/**'
- '.github/workflows/supabase_flutter.yml'
- 'packages/functions_client/**'
- 'packages/gotrue/**'
- 'packages/postgrest/**'
- 'packages/realtime_client/**'
- 'packages/storage_client/**'
- 'packages/supabase/**'
- 'packages/yet_another_json_isolate/**'

pull_request:
paths:
- 'packages/supabase_flutter/**'
- '.github/workflows/supabase_flutter.yml'
- 'packages/functions_client/**'
- 'packages/gotrue/**'
- 'packages/postgrest/**'
- 'packages/realtime_client/**'
- 'packages/storage_client/**'
- 'packages/supabase/**'
- 'packages/yet_another_json_isolate/**'

jobs:
test:
Expand Down Expand Up @@ -80,8 +59,9 @@ jobs:
cd example
flutter build web
- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@master
- name: Upload coverage artifact
if: ${{ matrix.sdk == 'stable'}}
uses: actions/upload-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./packages/supabase_flutter/coverage/lcov.info
name: coverage-flutter-supabase-flutter
path: ./packages/supabase_flutter/coverage/lcov.info
16 changes: 5 additions & 11 deletions .github/workflows/yet_another_json_isolate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ on:
push:
branches:
- main
paths:
- 'packages/yet_another_json_isolate/**'
- '.github/workflows/yet_another_json_isolate.yml'

pull_request:
paths:
- 'packages/yet_another_json_isolate/**'
- '.github/workflows/yet_another_json_isolate.yml'

jobs:
test:
Expand Down Expand Up @@ -63,8 +56,9 @@ jobs:
dart pub global activate coverage
dart pub global run coverage:format_coverage --lcov --in="./coverage/test" --out="./coverage/lcov.info" --report-on="./lib"
- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@master
- name: Upload coverage artifact
if: ${{ matrix.sdk == 'stable'}}
uses: actions/upload-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./packages/yet_another_json_isolate/coverage/lcov.info
name: coverage-flutter-yet-another-json-isolate
path: ./packages/yet_another_json_isolate/coverage/lcov.info
3 changes: 2 additions & 1 deletion melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ scripts:
exec: dart pub outdated

update-version:
description: Updates the version.dart file for each packages except yet_another_json_isolate
run: |
# Loop through the packages directory
for d in packages/*/ ; do
Expand All @@ -53,4 +54,4 @@ scripts:
rm packages/yet_another_json_isolate/lib/src/version.dart
# Stage the version.dart file change
git add packages/*/lib/src/version.dart
description: Updates the version.dart file for each packages except yet_another_json_isolate

0 comments on commit 166b0f6

Please sign in to comment.