Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: verify pub score for mocktail_image_network and use very_good_coverage v1.2.0 #84

Merged
merged 2 commits into from
Oct 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/mocktail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
test_coverage

- name: Check Code Coverage
uses: VeryGoodOpenSource/very_good_coverage@v1.1.1
uses: VeryGoodOpenSource/very_good_coverage@v1.2.0
with:
path: packages/mocktail/coverage/lcov.info

Expand All @@ -60,9 +60,6 @@ jobs:
run: |
flutter packages get
flutter pub global activate pana

- name: Verify Pub Score
run: |
PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p")
echo "score: $PANA_SCORE"
IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0]; TOTAL=SCORE_ARR[1]
if (( $SCORE < $TOTAL )); then echo "minimum score not met!"; exit 1; fi
run: ../../tool/verify_pub_score.sh
22 changes: 21 additions & 1 deletion .github/workflows/mocktail_image_network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ jobs:
run: flutter test --test-randomize-ordering-seed random

- name: Check Code Coverage
uses: VeryGoodOpenSource/very_good_coverage@v1.1.1
uses: VeryGoodOpenSource/very_good_coverage@v1.2.0
with:
path: packages/mocktail_image_network/coverage/lcov.info

pana:
defaults:
run:
working-directory: packages/mocktail_image_network

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2.3.4

- uses: subosito/flutter-action@v1.5.3

- name: Install Dependencies
run: |
flutter packages get
flutter pub global activate pana

- name: Verify Pub Score
run: ../../tool/verify_pub_score.sh 110
16 changes: 16 additions & 0 deletions tool/verify_pub_score.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# Runs `pana . --no-warning` and verifies that the package score
# is greater or equal to the desired score. By default the desired score is
# a perfect score but it can be overridden by passing the desired score as an argument.
#
# Ensure the package has a score of at least a 100
# `./verify_pub_score.sh 100`
#
# Ensure the package has a perfect score
# `./verify_pub_score.sh`

PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p")
echo "score: $PANA_SCORE"
IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0]; TOTAL=SCORE_ARR[1]
if [ -z "$1" ]; then MINIMUM_SCORE=TOTAL; else MINIMUM_SCORE=$1; fi
if (( $SCORE < $MINIMUM_SCORE )); then echo "minimum score $MINIMUM_SCORE was not met!"; exit 1; fi