2017-06-27 10:42:46 +02:00
|
|
|
COVERAGE_REPORT := coverage.txt
|
|
|
|
COVERAGE_PROFILE := profile.out
|
|
|
|
COVERAGE_MODE := atomic
|
|
|
|
|
2017-04-05 18:38:42 +02:00
|
|
|
LINGUIST_PATH = .linguist
|
2016-07-13 22:21:18 +02:00
|
|
|
|
2017-04-05 18:38:42 +02:00
|
|
|
$(LINGUIST_PATH):
|
2017-04-05 19:27:19 +02:00
|
|
|
git clone https://github.com/github/linguist.git $@
|
2017-04-05 18:38:42 +02:00
|
|
|
|
|
|
|
test: $(LINGUIST_PATH)
|
|
|
|
go test -v ./...
|
|
|
|
|
2017-06-27 10:42:46 +02: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 18:38:42 +02:00
|
|
|
code-generate: $(LINGUIST_PATH)
|
2017-06-08 12:28:36 +02:00
|
|
|
mkdir -p data
|
2017-04-05 18:38:42 +02:00
|
|
|
go run internal/code-generator/main.go
|
|
|
|
|
|
|
|
clean:
|
2017-06-08 12:28:36 +02:00
|
|
|
rm -rf $(LINGUIST_PATH)
|