Makefile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. include .env
  2. GOOSE_DB_STRING = "user=${DB_USER} password=${DB_PASSWORD} dbname=${DB_NAME} port=${DB_PORT} host=${DB_HOST} sslmode=disable"
  3. usage:
  4. @echo "make run"
  5. @echo "make test"
  6. @echo "make test-cover"
  7. @echo "make lint"
  8. @echo "make migration-status"
  9. @echo "make migration-up"
  10. @echo "make migration-down"
  11. @echo "make docker-build"
  12. @echo "make docker-up"
  13. @echo "make docker-down"
  14. @echo "make install-deps"
  15. @echo "make app-build"
  16. run:
  17. cd cmd/app && go run main.go
  18. test:
  19. go test ./...
  20. test-cover:
  21. go clean -testcache
  22. go test ./... -coverprofile=coverage.tmp.out -covermode count -coverpkg=git.dmitriygnatenko.ru/dima/dmitriygnatenko-v2/internal/services/handler/...
  23. grep -v 'mocks\|config' coverage.tmp.out > coverage.out
  24. rm coverage.tmp.out
  25. go tool cover -html=coverage.out;
  26. lint:
  27. golangci-lint run --timeout=3m
  28. migration-status:
  29. goose -dir migrations postgres ${GOOSE_DB_STRING} status
  30. migration-up:
  31. goose -dir migrations postgres ${GOOSE_DB_STRING} up
  32. migration-down:
  33. goose -dir migrations postgres ${GOOSE_DB_STRING} down
  34. docker-build:
  35. docker compose up --build --detach
  36. docker-up:
  37. docker compose up --detach
  38. docker-down:
  39. docker compose down
  40. install-deps: install-lint install-goose
  41. install-lint:
  42. go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
  43. install-goose:
  44. go install github.com/pressly/goose/v3/cmd/goose@latest
  45. app-build:
  46. env GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o build/app/app cmd/app/main.go