diff --git a/.gitignore b/.gitignore index 9eeddca..9785d3c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ *.swp *.swo -cover.* +cover* cache-dir/* -vendor diff --git a/.travis.yml b/.travis.yml index 5480937..a7c60d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,11 @@ language: go go: + - "1.12.x" - "1.13.x" - - master + +env: + - GO111MODULE=on services: - memcached @@ -11,10 +14,10 @@ services: before_install: - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.1 - - go get github.com/axw/gocov/gocov - - go get github.com/mattn/goveralls - - if ! go get github.com/golang/tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi script: - $GOPATH/bin/golangci-lint run ./... - - $HOME/gopath/bin/goveralls -service=travis-ci + - make test + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/Makefile b/Makefile index 283a5a5..5bd0d43 100644 --- a/Makefile +++ b/Makefile @@ -2,30 +2,31 @@ # Clean up clean: - rm -fR ./cover.* + @rm -fR ./coverage* .PHONY: clean # Run tests and generates html coverage file cover: test - go tool cover -html=./cover.out -o ./cover.html + @go tool cover -html=./coverage.text -o ./coverage.html + @test -f ./coverage.text && rm ./coverage.text; .PHONY: cover # Up the docker container for testing docker: - docker-compose up -d + @docker-compose up -d .PHONY: docker # Format all go files fmt: - gofmt -s -w -l $(shell go list -f {{.Dir}} ./... | grep -v /vendor/) + @gofmt -s -w -l $(shell go list -f {{.Dir}} ./...) .PHONY: fmt # Run linters lint: - golangci-linter run ./... + @golangci-linter run ./... .PHONY: lint # Run tests test: - go test -v -race -coverprofile=./cover.out $(shell go list ./... | grep -v /vendor/) + @go test -v -race -coverprofile=./coverage.text -covermode=atomic $(shell go list ./...) .PHONY: test diff --git a/README.md b/README.md index 0ae43dc..3d12c27 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Cachego [![Build Status](https://img.shields.io/travis/faabiosr/cachego/master.svg?style=flat-square)](https://travis-ci.org/faabiosr/cachego) -[![Coverage Status](https://img.shields.io/coveralls/faabiosr/cachego/master.svg?style=flat-square)](https://coveralls.io/github/faabiosr/cachego?branch=master) +[![Codecov branch](https://img.shields.io/codecov/c/github/faabiosr/cachego/master.svg?style=flat-square)](https://codecov.io/gh/faabiosr/cachego) [![GoDoc](https://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](https://godoc.org/github.com/faabiosr/cachego) [![Go Report Card](https://goreportcard.com/badge/github.com/faabiosr/cachego?style=flat-square)](https://goreportcard.com/report/github.com/faabiosr/cachego) [![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://github.com/faabiosr/cachego/blob/master/LICENSE)