Skip to content

chore: Generate coverage reports and upload them. #3

chore: Generate coverage reports and upload them.

chore: Generate coverage reports and upload them. #3

Workflow file for this run

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
sleep 5s
cd ../../packages/postgrest
elif [[ "$d" == "gotrue/"* ]]; then
cd ../../infra/gotrue
docker compose down
docker compose up -d
sleep 5s
cd ../../packages/gotrue
elif [[ "$d" == "storage_client/"* ]]; then
cd ../../infra/storage_client
docker compose down
docker compose up -d
sleep 5s
cd ../../packages/storage_client
fi
# Run tests with coverage
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
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: actions/upload-artifact@v4
with:
name: combined-coverage-report
path: coverage/lcov.info