From 8c805fa4231dcc8c44d1eef237456a6501a1c5d0 Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Sat, 9 Oct 2021 17:03:34 -0500 Subject: [PATCH 1/2] ci: verify pub score for mocktail_image_network and use very_good_coverage v1.2.0 --- .github/workflows/mocktail.yaml | 2 +- .github/workflows/mocktail_image_network.yaml | 25 ++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mocktail.yaml b/.github/workflows/mocktail.yaml index 1cb7eb4..6e46b46 100644 --- a/.github/workflows/mocktail.yaml +++ b/.github/workflows/mocktail.yaml @@ -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 diff --git a/.github/workflows/mocktail_image_network.yaml b/.github/workflows/mocktail_image_network.yaml index c5e641a..79364e1 100644 --- a/.github/workflows/mocktail_image_network.yaml +++ b/.github/workflows/mocktail_image_network.yaml @@ -41,6 +41,29 @@ 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: | + 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 From 33e6b30949349478eba4a201d675a22b02a5ea77 Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Sat, 9 Oct 2021 17:11:16 -0500 Subject: [PATCH 2/2] fixes --- .github/workflows/mocktail.yaml | 7 ++----- .github/workflows/mocktail_image_network.yaml | 7 ++----- tool/verify_pub_score.sh | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 10 deletions(-) create mode 100755 tool/verify_pub_score.sh diff --git a/.github/workflows/mocktail.yaml b/.github/workflows/mocktail.yaml index 6e46b46..76db5b8 100644 --- a/.github/workflows/mocktail.yaml +++ b/.github/workflows/mocktail.yaml @@ -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 \ No newline at end of file diff --git a/.github/workflows/mocktail_image_network.yaml b/.github/workflows/mocktail_image_network.yaml index 79364e1..ca7cb23 100644 --- a/.github/workflows/mocktail_image_network.yaml +++ b/.github/workflows/mocktail_image_network.yaml @@ -61,9 +61,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 110 diff --git a/tool/verify_pub_score.sh b/tool/verify_pub_score.sh new file mode 100755 index 0000000..00fab26 --- /dev/null +++ b/tool/verify_pub_score.sh @@ -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 \ No newline at end of file