Makefile 1.5 KB

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