Skip to content

Commit

Permalink
Generating middleware coverage badge data
Browse files Browse the repository at this point in the history
  • Loading branch information
amendelzon committed Dec 12, 2023
1 parent 30b76f9 commit 1b5476a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ jobs:
aws-region: ${{ secrets.CODECOVERAGE_AWS_REGION }}

- name: Run middleware coverage script
run: middleware/test-all-coverage
run: |
middleware/test-all-coverage
COVPCT=$(cat middleware/coverage/total)
COVCOL=$(utils/coverage-color.sh $COVPCT)
echo "{ \"schemaVersion\": 1, \"label\": \"Middleware coverage\", \"message\": \"$COVPCT%\", \"color\": \"$COVCOL\" }" > middleware/coverage/badge.json
- name: "Upload middleware coverage report"
run: |
Expand Down
12 changes: 12 additions & 0 deletions utils/coverage-color.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

N=$(echo $1 | sed -e "s/\..\+\$//g")

if [[ $N -gt 80 ]]; then
echo "green"
elif [[ $N -gt 60 ]]; then
echo "orange"
else
echo "red"
fi

0 comments on commit 1b5476a

Please sign in to comment.