Makefile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. .PHONY: all clean clean-coverage install install-dependencies install-tools lint test test-verbose test-with-coverage
  2. export ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
  3. export PKG := github.com/sergi/go-diff
  4. export ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
  5. $(eval $(ARGS):;@:) # turn arguments into do-nothing targets
  6. export ARGS
  7. ifdef ARGS
  8. PKG_TEST := $(ARGS)
  9. else
  10. PKG_TEST := $(PKG)/...
  11. endif
  12. all: install-tools install-dependencies install lint test
  13. clean:
  14. go clean -i $(PKG)/...
  15. go clean -i -race $(PKG)/...
  16. clean-coverage:
  17. find $(ROOT_DIR) | grep .coverprofile | xargs rm
  18. install:
  19. go install -v $(PKG)/...
  20. install-dependencies:
  21. go get -t -v $(PKG)/...
  22. go build -v $(PKG)/...
  23. install-tools:
  24. # Install linting tools
  25. go get -u -v github.com/golang/lint/...
  26. go get -u -v github.com/kisielk/errcheck/...
  27. # Install code coverage tools
  28. go get -u -v github.com/onsi/ginkgo/ginkgo/...
  29. go get -u -v github.com/modocache/gover/...
  30. go get -u -v github.com/mattn/goveralls/...
  31. lint:
  32. $(ROOT_DIR)/scripts/lint.sh
  33. test:
  34. go test -race -test.timeout 120s $(PKG_TEST)
  35. test-verbose:
  36. go test -race -test.timeout 120s -v $(PKG_TEST)
  37. test-with-coverage:
  38. ginkgo -r -cover -race -skipPackage="testdata"