Makefile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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-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-swagger:
  48. go install github.com/swaggo/swag/cmd/swag@latest
  49. install-frontend:
  50. npm install
  51. .PHONY: build
  52. build:
  53. env GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o build/app/app cmd/app/main.go
  54. build-frontend:
  55. npm run build