Skip to content

Commit

Permalink
ci: add pana workflow (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel authored May 24, 2022
1 parent c6c2e7b commit 66e3704
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/dart_frog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,21 @@ jobs:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1
with:
working_directory: packages/dart_frog

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

runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
- uses: dart-lang/setup-dart@v1

- name: Install Dependencies
run: |
dart pub get
dart pub global activate pana
- name: Verify Pub Score
run: ../../tool/verify_pub_score.sh
18 changes: 18 additions & 0 deletions .github/workflows/dart_frog_cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,21 @@ jobs:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1
with:
working_directory: packages/dart_frog_cli

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

runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
- uses: dart-lang/setup-dart@v1

- name: Install Dependencies
run: |
dart pub get
dart pub global activate pana
- name: Verify Pub Score
run: ../../tool/verify_pub_score.sh
18 changes: 18 additions & 0 deletions .github/workflows/dart_frog_gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,21 @@ jobs:
uses: VeryGoodOpenSource/very_good_coverage@v1
with:
path: packages/dart_frog_gen/coverage/lcov.info

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

runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
- uses: dart-lang/setup-dart@v1

- name: Install Dependencies
run: |
dart pub get
dart pub global activate pana
- name: Verify Pub Score
run: ../../tool/verify_pub_score.sh
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

0 comments on commit 66e3704

Please sign in to comment.