treerack/Makefile

62 lines
1.2 KiB
Makefile
Raw Normal View History

2017-06-25 17:51:08 +02:00
SOURCES = $(shell find . -name '*.go')
2017-10-29 20:01:33 +01:00
PARSERS = $(shell find . -name '*.treerack')
2017-06-25 17:51:08 +02:00
default: build
2017-11-05 03:48:38 +01:00
deps:
go get golang.org/x/tools/cmd/goimports
2017-11-05 04:08:08 +01:00
go get -t ./...
2017-11-05 03:48:38 +01:00
2017-11-05 03:28:36 +01:00
imports: $(SOURCES)
2017-06-25 17:51:08 +02:00
@goimports -w $(SOURCES)
build: $(SOURCES)
go build ./...
2017-11-05 03:28:36 +01:00
check: imports build $(PARSERS)
go test -test.short -run ^Test
2017-06-25 17:51:08 +02:00
2017-11-05 04:55:37 +01:00
check-full: imports build $(PARSERS)
2017-11-05 03:28:36 +01:00
go test
2017-10-29 16:47:03 +01:00
2017-11-05 03:28:36 +01:00
.coverprofile: $(SOURCES) imports
go test -coverprofile .coverprofile
cover: .coverprofile
go tool cover -func .coverprofile
show-cover: .coverprofile
go tool cover -html .coverprofile
2017-06-25 17:51:08 +02:00
2017-11-05 03:38:24 +01:00
publish-coverage: .coverprofile
curl -s https://codecov.io/bash -o codecov
bash codecov -Zf .coverprofile
2017-11-05 03:38:24 +01:00
2017-07-30 05:10:46 +02:00
cpu.out: $(SOURCES) $(PARSERS)
2017-07-30 02:35:51 +02:00
go test -v -run TestMMLFile -cpuprofile cpu.out
cpu: cpu.out
go tool pprof -top cpu.out
2017-11-05 03:28:36 +01:00
fmt: $(SOURCES)
@gofmt -w -s $(SOURCES)
2017-11-05 05:07:20 +01:00
check-fmt: $(SOURCES)
@if [ "$$(gofmt -s -d $(SOURCES))" != "" ]; then false; else true; fi
vet:
@go vet
2017-12-30 16:43:55 +01:00
precommit: fmt vet build check-full
2017-07-30 02:35:51 +02:00
clean:
@rm -f *.test
@rm -f cpu.out
2017-11-06 11:14:28 +01:00
@rm -f .coverprofile
2017-07-30 02:35:51 +02:00
@go clean -i ./...
2017-11-05 03:45:15 +01:00
2017-11-06 11:14:28 +01:00
ci-trigger: deps check-fmt build check-full
2017-11-05 04:01:27 +01:00
ifeq ($(TRAVIS_BRANCH)_$(TRAVIS_PULL_REQUEST), master_false)
make publish-coverage
endif