-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added codecov
- Loading branch information
Showing
3 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: lint | ||
on: [push, pull_request] | ||
on: push | ||
|
||
jobs: | ||
lint: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: test | ||
on: [push, pull_request] | ||
on: push | ||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
|
@@ -15,5 +15,7 @@ jobs: | |
- run: go test -cover ./... | ||
env: | ||
CGO_ENABLED: 0 | ||
- name: Codecov | ||
uses: codecov/[email protected] | ||
- name: coverage | ||
run: | | ||
make coverage | ||
bash <(curl -s https://codecov.io/bash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
WORKROOT := $(shell pwd) | ||
OUTDIR := $(WORKROOT)/output | ||
|
||
export PATH := $(shell go env GOPATH)/bin:$(PATH) | ||
export GO111MODULE := on | ||
|
||
GOFLAGS := -race | ||
STATICCHECK := staticcheck | ||
|
||
ARCH := $(shell getconf LONG_BIT) | ||
ifeq ($(ARCH),64) | ||
GOTEST += -race | ||
endif | ||
|
||
GEBUG_VERSION ?= $(shell cat VERSION) | ||
GIT_COMMIT ?= $(shell git rev-parse HEAD) | ||
|
||
PKGS := $(shell go list ./...) | ||
|
||
all: compile package | ||
|
||
compile: test build | ||
build: | ||
go build -ldflags "-X main.version=$(GEBUG_VERSION) -X main.commit=$(GIT_COMMIT)" | ||
|
||
test: test-case vet-case | ||
test-case: | ||
go test -cover ./... | ||
vet-case: | ||
go vet ./... | ||
|
||
coverage: | ||
echo -n > coverage.txt | ||
for pkg in $(PKGS) ; do go test -coverprofile=profile.out -covermode=atomic $${pkg} && cat profile.out >> coverage.txt; done | ||
|
||
package: | ||
mkdir -p $(OUTDIR)/bin | ||
mv bfe $(OUTDIR)/bin | ||
cp -r conf $(OUTDIR) | ||
|
||
check: | ||
go get honnef.co/go/tools/cmd/staticcheck | ||
staticcheck ./... | ||
|
||
clean: | ||
rm -rf $(OUTDIR) | ||
rm -rf $(WORKROOT)/gebug | ||
rm -rf $(WORKROOT)/.gebug | ||
rm -rf $(GOPATH)/pkg/linux_amd64 | ||
|
||
.PHONY: all compile test package clean build |