Makefile 1.2 KB

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