-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed tests and added coverage calculator
- Loading branch information
1 parent
96678e0
commit 120b02c
Showing
5 changed files
with
63 additions
and
14 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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#! /bin/sh | ||
|
||
go test ./... -race -covermode=atomic -coverprofile=coverage.out | ||
|
||
# make sure to set CODECOV_TOKEN env variable before doing this | ||
# codecov -f coverage.out | ||
# or | ||
# bash <(curl -s https://codecov.io/bash) | ||
|
||
|
||
# Example setup https://github.com/lluuiissoo/go-testcoverage/blob/main/.github/workflows/ci.yml | ||
|
||
# enable threshold | ||
COVERAGE_THRESHOLD=20 | ||
|
||
totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]'` | ||
|
||
echo "Total Coverage is $totalCoverage %" | ||
|
||
diff=$(echo "$totalCoverage < $COVERAGE_THRESHOLD" | bc) | ||
|
||
if [ $diff -eq 1 ]; then | ||
echo "Coverage is below threshold of $COVERAGE_THRESHOLD %" | ||
exit 1 | ||
else | ||
echo "Coverage is above threshold of $COVERAGE_THRESHOLD %" | ||
exit 0 | ||
fi | ||
|
||
|
||
|
||
|
||
|
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