Skip to content

Commit

Permalink
feat: better test script
Browse files Browse the repository at this point in the history
  • Loading branch information
SiongSng committed Jul 28, 2023
1 parent 0f8a99d commit e386365
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
25 changes: 2 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,8 @@ jobs:
components: rustfmt, clippy
- name: Test And Generate Coverage
run: |
dart pub global activate full_coverage
mkdir -p coverage
cd app
flutter pub get
dart pub global run full_coverage --ignore bridge_generated.dart,bridge_generated.io.dart,ffi.dart
flutter test --coverage
sed "s/^SF:.*lib/SF:app\/lib/g" coverage/lcov.info >> ../coverage/lcov.info
cd ..
cd packages
for d in */ ; do
cd $d
flutter pub get
dart pub global run full_coverage
flutter test --coverage
escapedPath="$(echo packages/$d | sed 's/\//\\\//g')"
sed "s/^SF:.*lib/SF:$escapedPath\/lib/g" coverage/lcov.info >> ../../coverage/lcov.info
rm -rf coverage
cd ..
done
cargo install just
just test
- name: Upload Coverage
uses: codecov/codecov-action@v3
with:
Expand Down
22 changes: 22 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,26 @@ clean:
cd app flutter clean
cd native && cargo clean

test:
dart pub global activate full_coverage
rm -rf coverage
mkdir -p coverage

cd app && flutter pub get
cd app && dart pub global run full_coverage --ignore bridge_generated.dart,bridge_generated.io.dart,ffi.dart
cd app && flutter test --coverage
cd app && sed "s/^SF:.*lib/SF:app\/lib/g" coverage/lcov.info >> ../coverage/lcov.info

cd packages && for d in */ ; do \
echo "Processing $d"; \
cd $d; \
flutter pub get; \
dart pub global run full_coverage; \
flutter test --coverage; \
escapedPath="$(echo packages/$d | sed 's/\//\\\//g')"; \
sed "s/^SF:.*lib/SF:${escapedPath}lib/g" coverage/lcov.info >> ../../coverage/lcov.info; \
rm -rf coverage; \
cd ..; \
done

# vim:expandtab:sw=4:ts=4

0 comments on commit e386365

Please sign in to comment.