Skip to content

Commit

Permalink
Support report unit tests to codecov (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxSuRen authored Sep 1, 2021
1 parent 561c8eb commit 25b55c3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ jobs:
- name: Test
run: |
make test-without-lint
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.out
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
Benchmark:
name: Benchmark
runs-on: ubuntu-20.04
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
bin/

build/ks
coverage.out
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ BUILDFLAGS = -ldflags "-X github.com/linuxsuren/cobra-extension/version.version=
-X github.com/linuxsuren/cobra-extension/version.commit=$(COMMIT) \
-X github.com/linuxsuren/cobra-extension/version.date=$(shell date +'%Y-%m-%d') -w -s"

all: test build
.PHONY : all

simple-build:
CGO_ENABLE=0 go build $(BUILDFLAGS) -o bin/ks

Expand All @@ -29,17 +32,16 @@ tools: export GOPROXY=https://goproxy.io
tools:
go get -u golang.org/x/lint/golint

test: test-without-lint
go test ./...
test: test-without-lint lint

test-without-lint: fmt mod-tidy
go test ./...
go test ./... -coverprofile coverage.out

benchmark:
go test -bench=. -run=none ./...

mod-tidy:
go mod tidy
go mod tidy -e

fmt:
go fmt ./...
Expand Down

0 comments on commit 25b55c3

Please sign in to comment.