-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from h-0-0/h-0-0-dev
Refining badge
- Loading branch information
Showing
4 changed files
with
34 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,20 +41,37 @@ jobs: | |
- name: Test with pytest and create coverage report | ||
run: | | ||
pytest --cov-report term-missing --cov=src tests/ > coverage_report.txt | ||
cd $GITHUB_WORKSPACE | ||
pwd | ||
coverage run --module pytest --verbose && coverage report --show-missing > coverage_report.txt | ||
- name: Extract coverage percentage | ||
id: extract-coverage | ||
run: | | ||
pwd | ||
ls | ||
less coverage_report.txt | ||
COVERAGE_PERCENTAGE=$(grep -oP 'TOTAL.*?\K\d+(?=%)' coverage_report.txt) | ||
echo "::set-output name=coverage::$COVERAGE_PERCENTAGE" | ||
- name: Determine badge color | ||
id: determine-color | ||
run: | | ||
echo "COVERAGE=${{ steps.extract-coverage.outputs.coverage }}" | ||
if [ $(echo "${{ steps.extract-coverage.outputs.coverage }} < 70" | bc -l) -eq 1 ]; then | ||
echo "::set-output name=color::red" | ||
elif [ $(echo "${{ steps.extract-coverage.outputs.coverage }} < 90" | bc -l) -eq 1 ]; then | ||
echo "::set-output name=color::yellow" | ||
else | ||
echo "::set-output name=color::green" | ||
fi | ||
- name: Create Coverage Badge | ||
uses: schneegans/[email protected] | ||
with: | ||
auth: ${{ secrets.GIST_TOKEN }} | ||
gistID: 4aa01e058fee448070c587f6967037e4 | ||
filename: CodeCovSlune.json # Use test.svg if you want to use the SVG mode. | ||
label: CodeCov | ||
message: "Coverage: ${{ steps.extract-coverage.outputs.coverage }}%" | ||
color: orange | ||
label: Coverage | ||
message: "${{ steps.extract-coverage.outputs.coverage }}%" | ||
color: ${{ steps.determine-color.outputs.color }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters