Skip to content

Commit a66cbbc

Browse files
committed
test: move coverage report from coveralls to codecov
1 parent 7e95e01 commit a66cbbc

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ a11y-results
3333

3434
# tests
3535
profile.cov
36+
coverage.txt
3637

3738
#devbox
3839
.devbox

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ clean: ## Clean the build directory and Go cache
5959
.PHONY: test
6060
test: ## Run all tests and generate coverage report.
6161
@echo "$(color_bold_cyan)* Run all tests and generate coverage report.$(color_reset)"
62-
@$(GO) test -count=1 -timeout 30s $(shell go list ./... | grep -Ev 'internal/testhelpers|internal/testutils|internal/templates') -covermode=atomic -coverprofile=profile.cov
62+
@$(GO) test -count=1 -timeout 30s $(shell go list ./... | grep -Ev 'internal/testhelpers|internal/testutils|internal/templates') -covermode=atomic -coverprofile=coverage.txt
6363
@echo "$(color_bold_cyan)* Total Coverage$(color_reset)"
64-
@$(GO) tool cover -func=profile.cov | grep total | awk '{print $$3}'
64+
@$(GO) tool cover -func=coverage.txt | grep total | awk '{print $$3}'
6565

6666
.PHONY: test/coverage
6767
test/coverage: ## Run go tests and use go tool cover.
6868
@echo "$(color_bold_cyan)* Run go tests and use go tool cover$(color_reset)"
6969
@$(MAKE) test/force
70-
@$(GO) tool cover -html=profile.cov
70+
@$(GO) tool cover -html=coverage.txt
7171

7272
.PHONY: test/force
7373
test/force: ## Clean go tests cache.
@@ -88,6 +88,9 @@ lint: ## Run golangci-lint
8888
.PHONY: build
8989
build: ## Build the binary with development metadata
9090
@echo "$(color_bold_cyan)* Building the binary...$(color_reset)"
91+
@$(MAKE) modernize
92+
@$(MAKE) lint
93+
@$(MAKE) test/force
9194
@mkdir -p $(BUILD_DIR)
9295
$(GOBUILD) -o $(BUILD_DIR)/$(APP_NAME) $(CMD_DIR)/main.go
9396

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<a href="https://github.com/indaco/tempo/actions/workflows/ci.yml" target="_blank">
99
<img src="https://github.com/indaco/tempo/actions/workflows/ci.yml/badge.svg" alt="CI" />
1010
</a>
11-
<a href="https://coveralls.io/github/indaco/tempo?branch=main" target="_blank">
12-
<img src="https://coveralls.io/repos/github/indaco/tempo/badge.svg?branch=main" alt="Coverage Status" />
11+
<a href="https://codecov.io/gh/indaco/tempo">
12+
<img src="https://codecov.io/gh/indaco/tempo/branch/main/graph/badge.svg" alt="Code coverage" />
1313
</a>
1414
<a href="https://goreportcard.com/report/github.com/indaco/tempo" target="_blank">
1515
<img src="https://goreportcard.com/badge/github.com/indaco/tempo" alt="go report card" />

Taskfile.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "3"
1+
version: '3'
22

33
vars:
44
APP_NAME: tempo
@@ -8,13 +8,13 @@ vars:
88

99
tasks:
1010
default:
11-
desc: "Run clean and build tasks"
11+
desc: 'Run clean and build tasks'
1212
cmds:
1313
- task: clean
1414
- task: build
1515

1616
clean:
17-
desc: "Clean the build directory and Go cache"
17+
desc: 'Clean the build directory and Go cache'
1818
cmds:
1919
- rm -rf {{.BUILD_DIR}}
2020
- go clean -cache
@@ -23,23 +23,23 @@ tasks:
2323
desc: Run all tests and generate coverage report.
2424
silent: false
2525
cmds:
26-
- go test -count=1 -timeout 30s $(go list ./... | grep -Ev 'internal/testhelpers|internal/testutils|internal/templates') -covermode=atomic -coverprofile=profile.cov
26+
- go test -count=1 -timeout 30s $(go list ./... | grep -Ev 'internal/testhelpers|internal/testutils|internal/templates') -covermode=atomic -coverprofile=coverage.txt
2727
- task: test/view-total-coverage
2828

2929
test/view-total-coverage:
30-
desc: Display total test coverage from profile.cov
30+
desc: Display total test coverage from coverage.txt
3131
silent: true
3232
internal: true
3333
cmds:
3434
- echo ""
3535
- echo "Total Coverage:"
36-
- go tool cover -func=profile.cov | grep total | awk -F '[[:space:]]+' '{print $NF}'
36+
- go tool cover -func=coverage.txt | grep total | awk -F '[[:space:]]+' '{print $NF}'
3737

3838
test/view-coverage:
3939
desc: View the HTML coverage report.
4040
internal: true
4141
cmds:
42-
- go tool cover -html=profile.cov
42+
- go tool cover -html=coverage.txt
4343
- echo "Coverage report displayed in your default browser."
4444

4545
test/coverage:
@@ -70,14 +70,18 @@ tasks:
7070
- golangci-lint run ./...
7171

7272
build:
73-
desc: "Building the binary..."
73+
desc: 'Building the binary...'
74+
deps:
75+
- modernize
76+
- lint
77+
- test/force
7478
cmds:
7579
- |
7680
mkdir -p {{.BUILD_DIR}}
7781
go build -o {{.BUILD_DIR}}/{{.APP_NAME}} {{.CMD_DIR}}/main.go
7882
7983
install:
80-
desc: "Install the binary using Go install"
84+
desc: 'Install the binary using Go install'
8185
silent: false
8286
deps:
8387
- modernize

0 commit comments

Comments
 (0)