4
0

Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. define delete-files
  2. python -c "import shutil;shutil.rmtree('$(1)', ignore_errors=True)"
  3. endef
  4. compile-currentenv:
  5. go build
  6. prep:
  7. go mod download
  8. go generate ./...
  9. compile-armhf:
  10. go env -w GOARCH=arm GOARM=6
  11. go build -o OliveTin.armhf
  12. go env -u GOARCH GOARM
  13. compile-x64-lin:
  14. go env -w GOOS=linux
  15. go build -o OliveTin
  16. go env -u GOOS
  17. compile-x64-win: windows-resources
  18. GOOS=windows GOARCH=amd64 go build -o OliveTin.exe
  19. windows-resources:
  20. $(MAKE) -wC .. windows-resources
  21. compile: compile-armhf compile-x64-lin compile-x64-win
  22. codestyle: go-tools
  23. go fmt ./...
  24. go vet ./...
  25. gocyclo -over 4 internal
  26. gocritic check ./...
  27. test: unittests
  28. tests: unittests
  29. unittests:
  30. $(call delete-files,reports)
  31. mkdir reports
  32. go test ./... -coverprofile reports/unittests.out
  33. go tool cover -html=reports/unittests.out -o reports/unittests.html
  34. unittests-fast:
  35. go test ./... -count=1
  36. find-flakey-tests:
  37. echo "Running unittests-fast infinitely"
  38. sh -c "while $(MAKE) unittests-fast; do :; done"
  39. find-flakey-tests-inf:
  40. go run ./scripts/find-flakey-tests-inf
  41. go-tools:
  42. go install "github.com/fzipp/gocyclo/cmd/gocyclo"
  43. go install "github.com/go-critic/go-critic/cmd/gocritic"
  44. .PHONY: unittests unittests-fast find-flakey-tests find-flakey-tests-inf
  45. go-tools-all:
  46. go install "github.com/bufbuild/buf/cmd/buf"
  47. go install "github.com/fzipp/gocyclo/cmd/gocyclo"
  48. go install "github.com/go-critic/go-critic/cmd/gocritic"
  49. go install "google.golang.org/protobuf/cmd/protoc-gen-go"