Makefile 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 swag"
  8. @echo "make lint"
  9. @echo "make migration-status"
  10. @echo "make migration-up"
  11. @echo "make migration-down"
  12. @echo "make docker-build"
  13. @echo "make docker-up"
  14. @echo "make docker-down"
  15. @echo "make install-deps"
  16. @echo "make build"
  17. run:
  18. cd cmd/app && go run main.go
  19. run-frontend:
  20. npm run dev
  21. test:
  22. go test ./...
  23. test-cover:
  24. go test ./... -coverprofile=./coverage.out
  25. go tool cover -html=./coverage.out
  26. lint:
  27. golangci-lint run --timeout=3m
  28. swag:
  29. swag init -o "docs" -d "cmd/app,internal/api/v1,internal/dto"
  30. migration-status:
  31. goose -dir migrations postgres ${GOOSE_DB_STRING} status
  32. migration-up:
  33. goose -dir migrations postgres ${GOOSE_DB_STRING} up
  34. migration-down:
  35. goose -dir migrations postgres ${GOOSE_DB_STRING} down
  36. docker-build:
  37. docker compose up --build --detach
  38. docker-up:
  39. docker compose up --detach
  40. docker-down:
  41. docker compose down
  42. install-deps: install-lint install-goose install-minimock install-swagger
  43. install-lint:
  44. go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
  45. install-goose:
  46. go install github.com/pressly/goose/v3/cmd/goose@latest
  47. install-minimock:
  48. go install github.com/gojuno/minimock/v3/cmd/minimock@latest
  49. install-swagger:
  50. go install github.com/swaggo/swag/cmd/swag@latest
  51. install-frontend:
  52. npm install
  53. .PHONY: build
  54. build:
  55. env GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o build/app/app cmd/app/main.go
  56. build-frontend:
  57. npm run build --emptyOutDir