38 lines
846 B
Makefile
38 lines
846 B
Makefile
include .env
|
|
.PHONY: test
|
|
test:
|
|
go test ./app
|
|
.PHONY: coverage
|
|
coverage:
|
|
mkdir -p coverage
|
|
go test -coverprofile=coverage.out ./internal/... ;
|
|
go tool cover -func=coverage.out -o coverage/coverage.txt
|
|
.PHONY: build
|
|
build:
|
|
go build -ldflags="-s" -o ./bin/web ./
|
|
.PHONY: run
|
|
run:
|
|
@echo "Running Go application"; \
|
|
go run ./cmd/main.go
|
|
.PHONY: air
|
|
air:
|
|
@echo "Running air"; \
|
|
air -c .air.toml
|
|
.PHONY: migrations/up
|
|
migrations/new:
|
|
@echo 'Creating migration files for DB_URL'
|
|
migrate create -seq -ext=.sql -dir=./db/migrations $(name)
|
|
.PHONY: migrations/up
|
|
migrations/up:
|
|
@echo 'Running up migrations...'
|
|
migrate -path ./db/migrations -database $(DB_URL) up
|
|
|
|
.PHONY: swagger
|
|
swagger:
|
|
swag init -g cmd/main.go
|
|
.PHONY: db-up
|
|
db-up:
|
|
docker compose -f compose.db.yaml up
|
|
.PHONY: db-down
|
|
db-down:
|
|
docker compose -f compose.db.yaml down
|