Skip to content

Commit

Permalink
Update scripts (#392)
Browse files Browse the repository at this point in the history
* Update scripts

* Update script

* update ci

* bootstrap

* Updated bootstrap

* Fix
  • Loading branch information
hawkkiller authored Jan 6, 2025
1 parent f4384e0 commit f77e604
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 109 deletions.
50 changes: 4 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,9 @@ jobs:
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 in parallel
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: 🦄 Bootstrap
run: bash ./scripts/bootstrap.bash

- name: Install DCM
uses: CQLabs/[email protected]
Expand All @@ -73,21 +52,8 @@ jobs:
# RUN TESTS + COVERAGE
# ———————————————————————————————————————————————————————

- name: 🧪 Test Main App
run: very_good test --coverage --exclude-coverage "*.*.dart" -j 10
working-directory: .

- name: 🧪 Test App Database
run: very_good test --coverage --exclude-coverage "*.*.dart" -j 10
working-directory: packages/app_database

- name: 🧪 Test Rest Client
run: very_good test --coverage --exclude-coverage "*.*.dart" -j 10
working-directory: packages/rest_client

- name: 🔗 Merge Coverage Reports
run: |
bash ./scripts/merge_coverage.bash
- name: 🧪 Run Tests
run: bash ./scripts/test.bash

- name: 📥 Upload test report
uses: actions/upload-artifact@v4
Expand All @@ -96,14 +62,6 @@ jobs:
name: test-results
path: reports/tests.json

- name: 📈 Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/lcov.info
name: codecov-umbrella
fail_ci_if_error: true

# ———————————————————————————————————————————————————————
# TEST REPORT JOB
# ———————————————————————————————————————————————————————
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_reporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
name: Test Report
path: "**/tests.json"
reporter: flutter-json
fail-on-error: fals
fail-on-error: false
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@ pubspec.lock
.fvm/

# Test reports
reports/
reports/
coverage/
**/coverage/
10 changes: 5 additions & 5 deletions packages/app_database/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ resolution: workspace
dependencies:
flutter:
sdk: flutter
drift: ^2.23.0
drift_flutter: ^0.2.4
drift: 2.23.0
drift_flutter: 0.2.4

dev_dependencies:
flutter_test:
sdk: flutter
drift_dev: ^2.21.2
build_runner: ^2.4.14
sizzle_lints: ^2.1.3
drift_dev: 2.23.0
build_runner: 2.4.14
sizzle_lints: 2.1.3
21 changes: 12 additions & 9 deletions packages/rest_client/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@ resolution: workspace
dependencies:
flutter:
sdk: flutter
cronet_http: ^1.3.2
cupertino_http: ^2.0.1
http: ^1.2.2
intercepted_client: ^0.0.1
path: ^1.9.0
meta: ^1.15.0
cronet_http: 1.3.2
cupertino_http: 2.0.1
http: 1.2.2
intercepted_client: 0.0.1
path: 1.9.0
meta: 1.15.0

dev_dependencies:
flutter_test:
sdk: flutter
mockito: ^5.4.4
build_runner: ^2.4.14
sizzle_lints: ^2.1.3
mockito: 5.4.5
build_runner: 2.4.14
sizzle_lints: 2.1.3

flutter:
uses-material-design: true
55 changes: 28 additions & 27 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,35 @@ dependencies:
sdk: flutter
flutter_localizations:
sdk: flutter
collection: ^1.19.0
async: ^2.11.0
meta: ^1.15.0
intl: ^0.19.0
collection: 1.19.0
async: 2.11.0
meta: 1.15.0
intl: 0.19.0

# Stream
stream_transform: ^2.1.0
rxdart: ^0.28.0
stream_transform: 2.1.1
rxdart: 0.28.0

# BLoC
flutter_bloc: ^8.1.6
flutter_bloc: 8.1.6

# Networking
http: ^1.2.2
cronet_http: ^1.3.2
cupertino_http: ^2.0.1
http: 1.2.2
cronet_http: 1.3.2
cupertino_http: 2.0.1

# Storing data
shared_preferences: ^2.3.2
drift: ^2.21.0
drift_flutter: ^0.2.1
shared_preferences: 2.3.5
drift: 2.23.0
drift_flutter: 0.2.4

# Logging
stack_trace: ^1.11.1
sentry_flutter: ^8.9.0
stack_trace: 1.12.0
sentry_flutter: 8.12.0

# Firebase
firebase_core: ^3.6.0
firebase_analytics: ^11.3.3
firebase_core: 3.9.0
firebase_analytics: 11.3.6

# Packages
rest_client:
Expand All @@ -56,25 +56,26 @@ dependencies:
path: packages/app_database

# Utils
path: ^1.9.0
path_provider: ^2.1.5
clock: ^1.1.1
fake_async: ^1.3.1
package_info_plus: ^8.1.0
path: 1.9.0
path_provider: 2.1.5
clock: 1.1.1
fake_async: 1.3.1
package_info_plus: 8.1.2

dev_dependencies:
# Testing
flutter_test:
sdk: flutter
mockito: ^5.4.4
mockito: 5.4.5

# Lints
sizzle_lints: ^2.1.3
sizzle_lints: 2.1.3

# Utils
flutter_gen_runner: ^5.8.0
flutter_launcher_icons: ^0.14.1
flutter_native_splash: ^2.4.2
flutter_gen_runner: 5.8.0
flutter_launcher_icons: 0.14.2
flutter_native_splash: 2.4.4
build_runner: 2.4.14

flutter:
uses-material-design: true
Expand Down
15 changes: 8 additions & 7 deletions scripts/bootstrap.bash
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/bin/bash
# Get workspace dependencies
flutter pub get

# For each package in packages that has build_runner dependency run build_runner
for dir in packages/*; do
# For each package that has a pubspec.yaml file and build_runner dependency
# run generation
find . -type f -name "pubspec.yaml" -exec grep -q build_runner {} \; -exec dirname {} \; | while read -r dir; do
if [ -f "$dir/pubspec.yaml" ]; then
if grep -q build_runner "$dir/pubspec.yaml"; then
pushd $dir
dart run build_runner build --delete-conflicting-outputs
popd
fi
pushd $dir
printf "\nGenerating files for $dir\n"
dart run build_runner build --delete-conflicting-outputs
popd
fi
done
13 changes: 0 additions & 13 deletions scripts/merge_coverage.bash

This file was deleted.

21 changes: 21 additions & 0 deletions scripts/test.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Enable error handling
set -e

# Find directories with a pubspec.yaml and a test/ folder
find_test_dirs() {
find . -type f -name "pubspec.yaml" -exec dirname {} \; | while read -r dir; do
if [ -d "$dir/test" ]; then
echo "$dir"
fi
done
}

# Capture the output of find_test_dirs and pass it to flutter test
test_dirs=$(find_test_dirs)
if [ -n "$test_dirs" ]; then
flutter test $test_dirs --no-pub --coverage
else
echo "No directories with pubspec.yaml and test/ folder found."
fi

0 comments on commit f77e604

Please sign in to comment.