-
-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Generate coverage reports and upload them. (#1110)
* chore: Update CI to generate coverage report. * chore: Upload coverage results * removed unneccessary code * update command name * test command * verify melos path * Update workflow to format and upload the report * fix functions ci * update path of functionc ci * fix path for all ci * fix: Update type for customAccessToken * set concurrency to 1 for realtime tests * fix: failing realtime tests * add stub to realtime * more stubs * update analyzer check in ci * Run tests on every PR for every packages and upload combined coverage report * Let the coverage workflow take care of everything about test coverage * update coverage workflow to setup test infra * add sleep after docker compose up * move the sleep * take down docker after testing * go back to the infra directory for taking down docker * revert changes on the individual CI files * Properly upload code coverage to coverall
- Loading branch information
1 parent
d04d9e6
commit 6976fae
Showing
12 changed files
with
141 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
name: Combined Coverage Report | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
coverage: | ||
name: Generate Combined Coverage | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: '3.x' | ||
channel: 'stable' | ||
|
||
- name: Install dependencies | ||
run: | | ||
dart pub global activate melos | ||
dart pub global activate coverage | ||
dart pub global activate combine_coverage | ||
melos bootstrap | ||
- name: Run tests with coverage for all packages | ||
run: | | ||
# Create directory for combined coverage | ||
mkdir coverage | ||
# Run tests for each package and generate coverage | ||
cd packages | ||
for d in */ ; do | ||
cd "$d" | ||
if [ -f "pubspec.yaml" ]; then | ||
echo "Running tests for $d" | ||
if [[ "$d" == "supabase_flutter/"* ]]; then | ||
flutter test --coverage --concurrency=1 | ||
else | ||
# Set up Docker containers based on package | ||
if [[ "$d" == "postgrest/"* ]]; then | ||
cd ../../infra/postgrest | ||
docker compose down | ||
docker compose up -d | ||
cd ../../packages/postgrest | ||
dart test --coverage=coverage --concurrency=1 | ||
dart pub global run coverage:format_coverage --packages=.dart_tool/package_config.json --report-on=lib --lcov -o coverage/lcov.info -i coverage | ||
cd ../../infra/postgrest | ||
docker compose down | ||
sleep 5s | ||
cd ../../packages/postgrest | ||
elif [[ "$d" == "gotrue/"* ]]; then | ||
cd ../../infra/gotrue | ||
docker compose down | ||
docker compose up -d | ||
cd ../../packages/gotrue | ||
dart test --coverage=coverage --concurrency=1 | ||
dart pub global run coverage:format_coverage --packages=.dart_tool/package_config.json --report-on=lib --lcov -o coverage/lcov.info -i coverage | ||
cd ../../infra/gotrue | ||
docker compose down | ||
sleep 5s | ||
cd ../../packages/gotrue | ||
elif [[ "$d" == "storage_client/"* ]]; then | ||
cd ../../infra/storage_client | ||
docker compose down | ||
docker compose up -d | ||
cd ../../packages/storage_client | ||
dart test --coverage=coverage --concurrency=1 | ||
dart pub global run coverage:format_coverage --packages=.dart_tool/package_config.json --report-on=lib --lcov -o coverage/lcov.info -i coverage | ||
cd ../../infra/storage_client | ||
docker compose down | ||
sleep 5s | ||
cd ../../packages/storage_client | ||
else | ||
cd ../../packages/$d | ||
dart test --coverage=coverage --concurrency=1 | ||
dart pub global run coverage:format_coverage --packages=.dart_tool/package_config.json --report-on=lib --lcov -o coverage/lcov.info -i coverage | ||
fi | ||
fi | ||
fi | ||
cd .. | ||
done | ||
cd .. | ||
- name: Combine coverage reports | ||
run: | | ||
dart pub global run combine_coverage:combine_coverage --repo-path="./" --output-directory="coverage" | ||
- name: Upload combined coverage report | ||
uses: coverallsapp/github-action@v2 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: ./coverage/lcov.info |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,4 +78,4 @@ jobs: | |
- name: Verify if Flutter web build is successful | ||
run: | | ||
cd example | ||
flutter build web | ||
flutter build web |
This file contains 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
This file contains 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
This file contains 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
This file contains 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