Makefile 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. artifacts_path := /tmp/artifacts
  2. help:
  3. @echo 'Targets:'
  4. @echo ' all - runs lint, server, coverage'
  5. @echo ' lint - runs code style checks'
  6. @echo ' shorttest - runs unit and integration tests'
  7. @echo ' test - runs all tests, including e2e tests - requires running influxdb 2 server'
  8. @echo ' coverage - runs all tests, including e2e tests, with coverage report - requires running influxdb 2 server'
  9. @echo ' server - prepares InfluxDB in docker environment'
  10. lint:
  11. go vet ./...
  12. go install honnef.co/go/tools/cmd/staticcheck@latest && staticcheck --checks='all' --tags e2e ./...
  13. go install golang.org/x/lint/golint@latest && golint ./...
  14. shorttest:
  15. go test -race -v -count=1 ./...
  16. test:
  17. go test -race -v -count=1 --tags e2e ./...
  18. coverage:
  19. go install gotest.tools/gotestsum@latest && gotestsum --junitfile /tmp/test-results/unit-tests.xml -- -race -coverprofile=coverage.txt -covermode=atomic -coverpkg '.,./api/...,./internal/.../,./log/...' -tags e2e ./...
  20. if test ! -e $(artifacts_path); then mkdir $(artifacts_path); fi
  21. go tool cover -html=coverage.txt -o $(artifacts_path)/coverage.html
  22. server:
  23. ./scripts/influxdb-restart.sh
  24. all: lint server coverage