Skip to content

Commit 66e3704

Browse files
authored
ci: add pana workflow (#22)
1 parent c6c2e7b commit 66e3704

File tree

4 files changed

+70
-0
lines changed

4 files changed

+70
-0
lines changed

.github/workflows/dart_frog.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,21 @@ jobs:
2121
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1
2222
with:
2323
working_directory: packages/dart_frog
24+
25+
pana:
26+
defaults:
27+
run:
28+
working-directory: packages/dart_frog
29+
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- uses: actions/[email protected]
34+
- uses: dart-lang/setup-dart@v1
35+
36+
- name: Install Dependencies
37+
run: |
38+
dart pub get
39+
dart pub global activate pana
40+
- name: Verify Pub Score
41+
run: ../../tool/verify_pub_score.sh

.github/workflows/dart_frog_cli.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,21 @@ jobs:
2121
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1
2222
with:
2323
working_directory: packages/dart_frog_cli
24+
25+
pana:
26+
defaults:
27+
run:
28+
working-directory: packages/dart_frog_cli
29+
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- uses: actions/[email protected]
34+
- uses: dart-lang/setup-dart@v1
35+
36+
- name: Install Dependencies
37+
run: |
38+
dart pub get
39+
dart pub global activate pana
40+
- name: Verify Pub Score
41+
run: ../../tool/verify_pub_score.sh

.github/workflows/dart_frog_gen.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,21 @@ jobs:
4646
uses: VeryGoodOpenSource/very_good_coverage@v1
4747
with:
4848
path: packages/dart_frog_gen/coverage/lcov.info
49+
50+
pana:
51+
defaults:
52+
run:
53+
working-directory: packages/dart_frog_gen
54+
55+
runs-on: ubuntu-latest
56+
57+
steps:
58+
- uses: actions/[email protected]
59+
- uses: dart-lang/setup-dart@v1
60+
61+
- name: Install Dependencies
62+
run: |
63+
dart pub get
64+
dart pub global activate pana
65+
- name: Verify Pub Score
66+
run: ../../tool/verify_pub_score.sh

tool/verify_pub_score.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# Runs `pana . --no-warning` and verifies that the package score
3+
# is greater or equal to the desired score. By default the desired score is
4+
# a perfect score but it can be overridden by passing the desired score as an argument.
5+
#
6+
# Ensure the package has a score of at least a 100
7+
# `./verify_pub_score.sh 100`
8+
#
9+
# Ensure the package has a perfect score
10+
# `./verify_pub_score.sh`
11+
12+
PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p")
13+
echo "score: $PANA_SCORE"
14+
IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0]; TOTAL=SCORE_ARR[1]
15+
if [ -z "$1" ]; then MINIMUM_SCORE=TOTAL; else MINIMUM_SCORE=$1; fi
16+
if (( $SCORE < $MINIMUM_SCORE )); then echo "minimum score $MINIMUM_SCORE was not met!"; exit 1; fi

0 commit comments

Comments
 (0)