elvish/Makefile

62 lines
1.9 KiB
Makefile
Raw Normal View History

2017-06-12 06:16:34 +08:00
PKG_BASE := github.com/elves/elvish
PKGS := $(shell go list ./... | sed 's|^$(PKG_BASE)|.|' | grep -v '^./\(vendor\|website\)')
PKG_COVERS := $(shell go list ./... | sed 's|^$(PKG_BASE)|.|' | grep -v '^\./\(vendor\|website\)' | grep -v '^\.$$' | sed 's/^\./_cover/' | sed 's/$$/.cover/')
COVER_MODE := set
VERSION := $(shell git describe --tags --always --dirty=-dirty)
2013-09-18 16:58:51 +08:00
GOVERALLS := github.com/mattn/goveralls
2016-02-22 02:34:40 +08:00
default: test get
2015-02-27 09:29:40 +08:00
get:
go get -ldflags "-X github.com/elves/elvish/buildinfo.Version=$(VERSION) \
-X github.com/elves/elvish/buildinfo.GoRoot=$(shell go env GOROOT) \
-X github.com/elves/elvish/buildinfo.GoPath=$(shell go env GOPATH)" .
2013-09-18 16:58:51 +08:00
2018-06-15 06:29:10 +08:00
buildall:
./_tools/buildall.sh
2018-06-15 06:29:10 +08:00
generate:
go generate ./...
2016-10-26 17:36:26 +08:00
test:
go test $(PKGS)
testmain:
go test .
_cover/%.cover: %
2017-02-12 11:15:37 +08:00
mkdir -p $(dir $@)
go test -coverprofile=$@ -covermode=$(COVER_MODE) ./$<
_cover/all: $(PKG_COVERS)
echo mode: $(COVER_MODE) > $@
for f in $(PKG_COVERS); do test -f $$f && sed 1d $$f >> $@ || true; done
upload-codecov-travis: _cover/all
2018-09-13 08:17:05 +08:00
curl -s https://codecov.io/bash -o codecov.bash \
&& bash codecov.bash -f $<
2017-12-16 12:30:33 +08:00
upload-coveralls-travis: _cover/all
2018-09-13 08:17:05 +08:00
go get -d $(GOVERALLS) \
&& go build -o goveralls $(GOVERALLS) \
&& ./goveralls -coverprofile $< -service=travis-ci
2018-09-13 08:17:05 +08:00
# Disable coverage reports for pull requests. The general testability of the
# code is pretty bad and it is premature to require contributors to maintain
# code coverage.
upload-codecov-appveyor: _cover/all
codecov -f $<
upload-coveralls-appveyor: _cover/all
goveralls -coverprofile $< -service=appveyor-ci
2017-12-22 03:58:25 +08:00
binaries-travis:
./_tools/binaries-travis.sh
coverage-travis: upload-codecov-travis upload-coveralls-travis
coverage-appveyor: upload-codecov-appveyor upload-coveralls-appveyor
2016-02-10 06:10:26 +08:00
.PHONY: default get buildall generate test testmain upload-codecov-travis upload-coveralls-travis upload-codecov-appveyor upload-coveralls-appveyor coverage-travis coverage-appveyor binaries-travis