mirror of
https://github.com/luscis/openlan.git
synced 2025-10-27 02:41:37 +08:00
fea: make: output coverage html
This commit is contained in:
2
.github/workflows/codecov.yml
vendored
2
.github/workflows/codecov.yml
vendored
@@ -24,6 +24,6 @@ jobs:
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
files: ./coverage.cov
|
||||
files: ./coverage.out
|
||||
name: codecov
|
||||
verbose: true
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -11,7 +11,8 @@
|
||||
# Test binary, build with `go test -c`
|
||||
*.test
|
||||
*.idea
|
||||
*.cov
|
||||
coverage.out
|
||||
coverage.html
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
14
Makefile
14
Makefile
@@ -64,7 +64,6 @@ vendor: update
|
||||
|
||||
env:
|
||||
@mkdir -p $(BD)
|
||||
@mkdir -p $(CD)
|
||||
@go version
|
||||
@gofmt -w -s ./pkg ./cmd ./misc
|
||||
|
||||
@@ -197,9 +196,12 @@ test: ## execute unit test
|
||||
|
||||
## coverage
|
||||
cover: env ## execute unit test and output coverage
|
||||
go test -mod=vendor github.com/luscis/openlan/pkg/access -coverprofile=$(CD)/access.txt -race -covermode=atomic
|
||||
go test -mod=vendor github.com/luscis/openlan/pkg/libol -coverprofile=$(CD)/libol.txt -race -covermode=atomic
|
||||
go test -mod=vendor github.com/luscis/openlan/pkg/models -coverprofile=$(CD)/models.txt -race -covermode=atomic
|
||||
@rm -rvf $(CD)
|
||||
@mkdir -p $(CD)
|
||||
go test -mod=vendor github.com/luscis/openlan/pkg/access -coverprofile=$(CD)/access.out -race -covermode=atomic
|
||||
go test -mod=vendor github.com/luscis/openlan/pkg/libol -coverprofile=$(CD)/libol.out -race -covermode=atomic
|
||||
go test -mod=vendor github.com/luscis/openlan/pkg/models -coverprofile=$(CD)/models.out -race -covermode=atomic
|
||||
|
||||
echo 'mode: atomic' > $(SD)/coverage.cov
|
||||
tail -q -n +2 $(CD)/*.txt >> $(SD)/coverage.cov
|
||||
echo 'mode: atomic' > $(SD)/coverage.out
|
||||
tail -q -n +2 $(CD)/*.out >> $(SD)/coverage.out
|
||||
go tool cover -html=coverage.out -o coverage.html
|
||||
|
||||
Reference in New Issue
Block a user