Skip to content

Commit

Permalink
Update go test command (pipe-cd#4514)
Browse files Browse the repository at this point in the history
* Update go test command

Signed-off-by: khanhtc1202 <khanhtc1202@gmail.com>

* Update makefile and github action command

Signed-off-by: khanhtc1202 <khanhtc1202@gmail.com>

* Revert gitignore

Signed-off-by: khanhtc1202 <khanhtc1202@gmail.com>

---------

Signed-off-by: khanhtc1202 <khanhtc1202@gmail.com>
Signed-off-by: hungran <26101787+hungran@users.noreply.github.com>
  • Loading branch information
khanhtc1202 authored and hungran committed Jul 21, 2023
1 parent f5ede76 commit f07c409
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Run unit tests
run: make test/go
run: make test/go COVERAGE=true
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,17 @@ push/chart:
test: test/go test/web

.PHONY: test/go
test/go: COVERAGE ?= false
test/go: COVERAGE_OPTS ?= -covermode=atomic
test/go: COVERAGE_OUTPUT ?= coverage.out
test/go:
go test ./pkg/... ./cmd/...
ifeq ($(COVERAGE), true)
go test -failfast -race $(COVERAGE_OPTS) -coverprofile=$(COVERAGE_OUTPUT).tmp ./pkg/... ./cmd/...
cat $(COVERAGE_OUTPUT).tmp | grep -v ".pb.go\|.pb.validate.go" > $(COVERAGE_OUTPUT)
rm -rf $(COVERAGE_OUTPUT).tmp
else
go test -failfast -race ./pkg/... ./cmd/...
endif

.PHONY: test/web
test/web:
Expand Down

0 comments on commit f07c409

Please sign in to comment.