File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change 2424 run : go mod download
2525
2626 - name : Run tests
27- run : go test -v ./... -coverprofile=coverage.out
27+ run : go test -v ./...
28+
29+ - name : Check test coverage
30+ run : |
31+ # Run tests with coverage, excluding main package
32+ go test -coverprofile=coverage.out ./pkg/...
33+ COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%')
34+ echo "Total coverage (excluding main package): $COVERAGE%"
35+ if (( $(echo "$COVERAGE < 70" | bc -l) )); then
36+ echo "Code coverage is below 70%. Please add more tests."
37+ exit 1
38+ fi
2839
2940 - name : Generate coverage report
3041 run : go tool cover -html=coverage.out -o coverage.html
3445 with :
3546 name : coverage-report
3647 path : coverage.html
37-
38- - name : Check test coverage
39- run : |
40- COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%')
41- echo "Total coverage: $COVERAGE%"
42- if (( $(echo "$COVERAGE < 70" | bc -l) )); then
43- echo "Code coverage is below 70%. Please add more tests."
44- exit 1
45- fi
You can’t perform that action at this time.
0 commit comments