You've already forked dcmerge
fix(ci): add coverage check
All checks were successful
Lint Golang files / Run golang CI linter (stable, ubuntu-latest-amd64) (push) Successful in 11s
Run Golang tests / Run unit tests (stable, ubuntu-latest-amd64) (push) Successful in 7s
Lint Markdown files / Run markdown linter (push) Successful in 4s
Lint Golang files / Run golang CI linter (stable, ubuntu-latest-arm64) (push) Successful in 31s
Run Golang tests / Run unit tests (stable, ubuntu-latest-arm64) (push) Successful in 23s
All checks were successful
Lint Golang files / Run golang CI linter (stable, ubuntu-latest-amd64) (push) Successful in 11s
Run Golang tests / Run unit tests (stable, ubuntu-latest-amd64) (push) Successful in 7s
Lint Markdown files / Run markdown linter (push) Successful in 4s
Lint Golang files / Run golang CI linter (stable, ubuntu-latest-arm64) (push) Successful in 31s
Run Golang tests / Run unit tests (stable, ubuntu-latest-arm64) (push) Successful in 23s
This commit is contained in:
@@ -40,3 +40,14 @@ jobs:
|
|||||||
- env:
|
- env:
|
||||||
GOPROXY: ${{ vars.GOPROXY }}
|
GOPROXY: ${{ vars.GOPROXY }}
|
||||||
run: make test/unit
|
run: make test/unit
|
||||||
|
- id: coverage
|
||||||
|
name: Check coverage
|
||||||
|
run: |
|
||||||
|
coverage="$(make test/coverage | grep total | awk '{ print substr($3, 1, length($3)-1); }')"
|
||||||
|
echo "total_coverage=$coverage" >> $GITHUB_OUTPUT
|
||||||
|
echo "Total coverage: ${coverage}%"
|
||||||
|
- name: Fail if coverage is to low
|
||||||
|
run: |
|
||||||
|
if (( $(echo "${total_coverage} < 50" | bc -l) )); then
|
||||||
|
echo "ERROR: Coverage (${total_coverage}%) is below the threshold (50%)."
|
||||||
|
fi
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -52,7 +52,7 @@ PHONY+=test/coverage
|
|||||||
test/coverage: test/unit
|
test/coverage: test/unit
|
||||||
CGO_ENABLED=0 \
|
CGO_ENABLED=0 \
|
||||||
GOPROXY=$(shell go env GOPROXY) \
|
GOPROXY=$(shell go env GOPROXY) \
|
||||||
go tool cover -html=coverage.txt
|
go tool cover -func=coverage.txt
|
||||||
|
|
||||||
# GOLANGCI-LINT
|
# GOLANGCI-LINT
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user