Pub workspaces #52
Workflow file for this run
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
name: "Continuous Integration" | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
ci: | |
name: "🚀 CI" | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: 📚 Git Checkout | |
uses: actions/[email protected] | |
- name: 🐦 Setup Flutter | |
uses: subosito/[email protected] | |
with: | |
flutter-version: 3.27.1 | |
channel: stable | |
cache: true | |
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }} | |
- name: 📦 Install Dependencies | |
run: | | |
flutter pub global activate very_good_cli | |
flutter pub global activate coverage | |
flutter pub get | |
- name: 🦄 Generate Code | |
run: | | |
# Run builds with error checking | |
dart run build_runner build -d & | |
main_pid=$! | |
if [ -d "packages/app_database" ]; then | |
(cd packages/app_database && dart run build_runner build -d) & | |
db_pid=$! | |
fi | |
if [ -d "packages/rest_client" ]; then | |
(cd packages/rest_client && dart run build_runner build -d) & | |
rest_pid=$! | |
fi | |
# Wait for all processes and check their exit status | |
for pid in $main_pid $db_pid $rest_pid; do | |
if [ -n "$pid" ]; then | |
wait $pid || exit 1 | |
fi | |
done | |
- name: Install DCM | |
uses: CQLabs/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: ✨ Check Formatting | |
run: find lib test -name "*.dart" ! -name "*.*.dart" -print0 | xargs -0 dart format --set-exit-if-changed --line-length 100 -o none | |
- name: 🕵️ Analyze | |
run: flutter analyze . | |
# TODO: Remove this step if you don't use DCM | |
- name: 🕵️ Analyze with DCM | |
run: dcm analyze . | |
- name: 🧪 Run Tests for Main App | |
run: very_good test --coverage --exclude-coverage "*.*.dart" -j 10 | |
working-directory: . | |
- name: 🧪 Run Tests for App Database | |
run: very_good test --coverage --exclude-coverage "*.*.dart" -j 10 | |
working-directory: packages/app_database | |
- name: 🧪 Run Tests for Rest Client | |
run: very_good test --coverage --exclude-coverage "*.*.dart" -j 10 | |
working-directory: packages/rest_client | |
- name: 🔗 Merge Coverage Reports | |
run: | | |
echo "" > coverage/lcov.info | |
if [ -f "coverage/lcov.info" ]; then cat coverage/lcov.info >> coverage/lcov_combined.info; fi | |
if [ -f "packages/app_database/coverage/lcov.info" ]; then cat packages/app_database/coverage/lcov.info >> coverage/lcov_combined.info; fi | |
if [ -f "packages/rest_client/coverage/lcov.info" ]; then cat packages/rest_client/coverage/lcov.info >> coverage/lcov_combined.info; fi | |
mv coverage/lcov_combined.info coverage/lcov.info | |
- name: 📥 Upload test report | |
uses: actions/upload-artifact@v4 | |
if: (success() || failure()) && ${{ github.actor != 'dependabot[bot]' }} | |
with: | |
name: test-results | |
path: reports/tests.json | |
- name: 📈 Upload Coverage | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage/lcov.info | |
name: codecov-umbrella | |
fail_ci_if_error: true | |
report_tests: | |
name: "🚛 Test report" | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
continue-on-error: true | |
needs: | |
- ci | |
steps: | |
- name: Test report | |
uses: dorny/test-reporter@v1 | |
with: | |
artifact: test-results | |
name: Test Report | |
path: "**/tests.json" | |
reporter: flutter-json | |
fail-on-error: false |