Makefile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 test ./... -coverprofile=./coverage.out
  22. go tool cover -html=./coverage.out
  23. lint:
  24. golangci-lint run --timeout=3m
  25. migration-status:
  26. goose -dir migrations postgres ${GOOSE_DB_STRING} status
  27. migration-up:
  28. goose -dir migrations postgres ${GOOSE_DB_STRING} up
  29. migration-down:
  30. goose -dir migrations postgres ${GOOSE_DB_STRING} down
  31. docker-build:
  32. docker compose up --build --detach
  33. docker-up:
  34. docker compose up --detach
  35. docker-down:
  36. docker compose down
  37. install-deps: install-lint install-goose
  38. install-lint:
  39. go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
  40. install-goose:
  41. go install github.com/pressly/goose/v3/cmd/goose@latest
  42. app-build:
  43. env GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o build/app/app cmd/app/main.go