Skip to content

Commit

Permalink
chore: move brick to its own repo & go back to old pana action
Browse files Browse the repository at this point in the history
  • Loading branch information
GroovinChip committed May 23, 2022
1 parent a7b34dd commit 1b233b8
Show file tree
Hide file tree
Showing 46 changed files with 25 additions and 2,492 deletions.
44 changes: 25 additions & 19 deletions .github/workflows/pana_analysis.yml
Expand Up @@ -2,8 +2,8 @@ name: Pana Analysis
on: [pull_request, workflow_dispatch]

jobs:
pana-analysis:
runs-on: macos-latest
package-analysis:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
Expand All @@ -12,23 +12,29 @@ jobs:
with:
channel: stable

- name: Analyze package with Pana
run: |
flutter pub global activate pana 0.21.5
REQUIRED_RATIO=1.0
TEMP_FILE=/tmp/pana_results.txt
# Run pana, piping the output to both stderr and into a grep to find the result in the last line.
pana --no-warning | tee /dev/stderr | tail -1 | grep -o -E '[0-9]+' > $TEMP_FILE
# Extract score and calculate ratio.
SCORE=$(cat $TEMP_FILE | head -1)
TOTAL=$(cat $TEMP_FILE | tail -1)
RATIO=$(echo "scale=2; $SCORE / $TOTAL" | bc -l)
MEETS_REQUIRED_RATIO=$(echo "$RATIO >= $REQUIRED_RATIO" | bc -l)
- uses: axel-op/dart-package-analyzer@v3
# set an id for the current step
id: analysis
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}

if [[ "$MEETS_REQUIRED_RATIO" != "1" ]]; then
echo "Score of $SCORE out of $TOTAL is a ratio of $RATIO, which is not sufficient to meet the required ratio of $REQUIRED_RATIO"
# You can then use this id to retrieve the outputs in the next steps.
# The following step shows how to exit the workflow with an error if the total score in percentage is below 50:
- name: Check scores
env:
# NB: "analysis" is the id set above. Replace it with the one you used if different.
TOTAL: ${{ steps.analysis.outputs.total }}
TOTAL_MAX: ${{ steps.analysis.outputs.total_max }}
run: |
PERCENTAGE=$(( $TOTAL * 100 / $TOTAL_MAX ))
if (( $PERCENTAGE < 80 ))
then
echo Score too low!
exit 1
fi
# This step is useful for PR's coming from forks. It takes the raw JSON and formats a report from it.
- name: Format scores json
env:
JSON_OUTPUT: ${{ steps.analysis.outputs.json_output }}
run: |
TOTAL_SCORE=$(jq -r '.scores.grantedPoints' <<< "$JSON_OUTPUT")
23 changes: 0 additions & 23 deletions starter_app/bricks/macosui_starter/CHANGELOG.md

This file was deleted.

21 changes: 0 additions & 21 deletions starter_app/bricks/macosui_starter/LICENSE

This file was deleted.

50 changes: 0 additions & 50 deletions starter_app/bricks/macosui_starter/README.md

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 1b233b8

Please sign in to comment.