Skip to content

Commit b95f560

Browse files
committed
make: add config for local coverage check
1 parent fe4a1e1 commit b95f560

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

.github/.testcoverage-local.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Config file for go-test-coverage running locally.
2+
3+
profile: cover.profile
4+
local-prefix: github.com/vladopajic/go-test-coverage/v2
5+
threshold:
6+
file: 100
7+
total: 98
8+
override:
9+
- path: badgestorer/github.go$ ## is integration test
10+
threshold: 64
11+
- path: path/path.go$ ## requires windows to be tested
12+
threshold: 66
13+
exclude:
14+
paths:
15+
- main\.go$

.github/.testcoverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Config file for go-test-coverage github action.
22

3-
profile: cover.short.profile,cover.long.profile
4-
local-prefix: "github.com/vladopajic/go-test-coverage/v2"
3+
profile: '' # set via github action
4+
local-prefix: github.com/vladopajic/go-test-coverage/v2
55
threshold:
66
file: 100
77
total: 100

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
cover.short.profile
2-
cover.long.profile
3-
cover.all.profile
1+
cover.profile
42
cover.html

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@ lint: get-golangcilint
2121
# Runs tests on entire repo
2222
.PHONY: test
2323
test:
24-
go test -timeout=3s -race -count=10 -failfast -shuffle=on -short ./... -coverprofile=./cover.short.profile -covermode=atomic -coverpkg=./...
25-
go test -timeout=10s -race -count=1 -failfast -shuffle=on ./... -coverprofile=./cover.long.profile -covermode=atomic -coverpkg=./...
24+
go test -timeout=3s -race -count=10 -failfast -shuffle=on -short ./...
25+
go test -timeout=10s -race -count=1 -failfast -shuffle=on ./... -coverprofile=./cover.profile -covermode=atomic -coverpkg=./...
2626

2727
# Runs test coverage check
2828
.PHONY: check-coverage
2929
check-coverage: test
30-
go run ./main.go --config=./.github/.testcoverage.yml
30+
go run ./main.go --config=./.github/.testcoverage-local.yml
3131

3232
# View coverage profile
3333
.PHONY: view-coverage
3434
view-coverage:
35-
go test ./... -coverprofile=./cover.all.profile -covermode=atomic -coverpkg=./...
36-
go tool cover -html=cover.all.profile -o=cover.html
35+
go tool cover -html=cover.profile -o=cover.html
3736
xdg-open cover.html

0 commit comments

Comments
 (0)