tartrazine/Makefile

50 lines
1.5 KiB
Makefile
Raw Normal View History

2017-06-27 08:42:46 +00:00
COVERAGE_REPORT := coverage.txt
COVERAGE_PROFILE := profile.out
COVERAGE_MODE := atomic
2017-04-05 16:38:42 +00:00
LINGUIST_PATH = .linguist
2016-07-13 20:21:18 +00:00
2017-07-07 09:20:54 +00:00
# build CLI
VERSION := $(shell git describe --tags --abbrev=0)
COMMIT := $(shell git rev-parse --short HEAD)
LDFLAGS = -s -X main.Version=$(VERSION) -X main.GitHash=$(COMMIT)
2017-04-05 16:38:42 +00:00
$(LINGUIST_PATH):
2017-04-05 17:27:19 +00:00
git clone https://github.com/github/linguist.git $@
2017-04-05 16:38:42 +00:00
test: $(LINGUIST_PATH)
go test -v ./...
2017-06-27 08:42:46 +00:00
test-coverage: $(LINGUIST_PATH)
@echo "mode: $(COVERAGE_MODE)" > $(COVERAGE_REPORT); \
for dir in `find . -name "*.go" | grep -o '.*/' | sort -u | grep -v './fixtures/' | grep -v './.linguist/'`; do \
go test $$dir -coverprofile=$(COVERAGE_PROFILE) -covermode=$(COVERAGE_MODE); \
if [ $$? != 0 ]; then \
exit 2; \
fi; \
if [ -f $(COVERAGE_PROFILE) ]; then \
tail -n +2 $(COVERAGE_PROFILE) >> $(COVERAGE_REPORT); \
rm $(COVERAGE_PROFILE); \
fi; \
done;
2017-04-05 16:38:42 +00:00
code-generate: $(LINGUIST_PATH)
mkdir -p data
2017-04-05 16:38:42 +00:00
go run internal/code-generator/main.go
benchmarks: $(LINGUIST_PATH)
go test -run=NONE -bench=. && benchmark/linguist-total.sh
benchmarks-samples: $(LINGUIST_PATH)
go test -run=NONE -bench=. -benchtime=5us && benchmark/linguist-samples.rb
benchmarks-slow: $(LINGUST_PATH)
2017-07-04 14:30:23 +00:00
mkdir -p benchmark/output && go test -run=NONE -bench=. -slow -benchtime=100ms -timeout=100h >benchmark/output/enry_samples.bench && \
benchmark/linguist-samples.rb 5 >benchmark/output/linguist_samples.bench
2017-04-05 16:38:42 +00:00
clean:
rm -rf $(LINGUIST_PATH)
2017-07-07 09:20:54 +00:00
build-cli:
go build -o enry -ldflags "$(LDFLAGS)" cli/enry/main.go