File tree 1 file changed +1
-19
lines changed
1 file changed +1
-19
lines changed Original file line number Diff line number Diff line change 23
23
run : |
24
24
go test -v ./... -covermode=count -coverprofile=coverage.out
25
25
go tool cover -func=coverage.out -o=coverage.out
26
- # sudo go test ./... -coverprofile coverage.out -covermode count
27
- # sudo go tool cover -func coverage.out
28
26
29
27
- name : Go Coverage Badge # Pass the `coverage.out` output to this action
30
28
uses : tj-actions/coverage-badge-go@v2
50
48
uses : ad-m/github-push-action@master
51
49
with :
52
50
github_token : ${{ github.token }}
53
- branch : ${{ github.head_ref }}
54
-
55
- - name : Quality Gate - Test coverage shall be above threshold
56
- env :
57
- TESTCOVERAGE_THRESHOLD : 10
58
- run : |
59
- echo "Quality Gate: checking test coverage is above threshold ..."
60
- echo "Threshold : $TESTCOVERAGE_THRESHOLD %"
61
- totalCoverage=`go tool cover -func=coverage.out | grep '(statements)' | grep -Eo '[0-9]+\.[0-9]+'`
62
- echo "Current test coverage : $totalCoverage %"
63
- if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then
64
- echo "OK"
65
- else
66
- echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value."
67
- echo "Failed"
68
- exit 1
69
- fi
51
+ branch : ${{ github.head_ref }}
You can’t perform that action at this time.
0 commit comments