Skip to content

Commit

Permalink
ci: Add reviewdog
Browse files Browse the repository at this point in the history
  • Loading branch information
beevee committed Mar 16, 2020
1 parent 4ac3678 commit a19b756
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
runner:
golangci: &runner-config
cmd: golangci-lint run --out-format=line-number ./...
errorformat:
- "%E%f:%l:%c: %m"
- "%E%f:%l: %m"
- "%C%.%#"
golangci-branch: *runner-config
golangci-pr: *runner-config
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ before_install:
install:
- go get -v golang.org/x/tools/cmd/cover
- go get -v github.com/mattn/goveralls
- make install-lint
- make install-reviewdog
before_script:
- make lint
- make reviewdog REVIEWDOG_RUNNERS=golangci-$([[ "$TRAVIS_PULL_REQUEST" = "false" ]] && echo "branch" || echo "pr")
- make test
- goveralls -coverprofile=coverage.txt -service=travis-ci || true
script:
Expand Down
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ GO_VERSION := $(shell go version | cut -d' ' -f3)
GO_PATH := $(shell go env GOPATH)
GO111MODULE := on
GOLANGCI_LINT_VERSION := "v1.23.8"
REVIEWDOG_VERSION := "v0.9.17"
REVIEWDOG_RUNNERS ?= golangci

VENDOR := "SKB Kontur"
URL := "https://github.com/moira-alert/moira"
Expand All @@ -35,6 +37,14 @@ install-lint:
lint:
GOGC=50 golangci-lint run

.PHONY: install-reviewdog
install-reviewdog: install-lint
wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b ${GO_PATH}/bin ${REVIEWDOG_VERSION}

.PHONY: reviewdog
reviewdog:
GOGC=50 reviewdog -reporter="github-check" -runners="${REVIEWDOG_RUNNERS}"

.PHONY: test
test:
echo 'mode: atomic' > coverage.txt && go list ./... | xargs -n1 -I{} sh -c 'go test -v -bench=. -covermode=atomic -coverprofile=coverage.tmp {} && tail -n +2 coverage.tmp >> coverage.txt' && rm coverage.tmp
Expand Down

0 comments on commit a19b756

Please sign in to comment.