Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Mar 9, 2019
1 parent 71839f5 commit a571e80
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
coverage.out
coverage.txt
bin
15 changes: 4 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
language: go
go:
- '1.10.x'
- '1.11.x'
- '1.12.x'
before_install:
- go get ./...
- go get github.com/axw/gocov/gocov
- go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover
script:
- go test -v -cover -race -coverprofile=coverage.out
after_script:
- go get github.com/mattn/goveralls
- goveralls -coverprofile=coverage.out -service=travis-ci -repotoken='eCcizKmTdSaJCz8Ih33WDppdqb9kioYwi'
install: make setup
script: make ci
after_success:
- bash <(curl -s https://codecov.io/bash)
notifications:
email: false
35 changes: 31 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
SOURCE_FILES?=./...
TEST_PATTERN?=.
TEST_OPTIONS?=

export GO111MODULE := on

setup:
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
go mod download
.PHONY: setup

build:
go build
.PHONY: build

test:
go test $(TEST_OPTIONS) -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m
.PHONY: test

cover: test
go tool cover -html=coverage.txt
.PHONY: cover

fmt:
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
.PHONY: fmt

lint:
./bin/golangci-lint run --tests=false --enable-all --disable=lll ./...
.PHONY: lint

verify:
go test -v -cover ./...
./bin/golangci-lint run --enable-all --disable=lll ./...
ci: build test lint
.PHONY: ci

.DEFAULT_GOAL := verify
.DEFAULT_GOAL := ci

0 comments on commit a571e80

Please sign in to comment.