Feat: add workflows
This commit is contained in:
25
Makefile
25
Makefile
@@ -1,4 +1,5 @@
|
||||
.PHONY: all swagger docker install test
|
||||
.PHONY: all swagger install postgres test test-ci \
|
||||
docker docker-quiet docker-clean
|
||||
|
||||
SWAG ?= go run github.com/swaggo/swag/cmd/swag@v1.16.4
|
||||
DOCKER ?= docker
|
||||
@@ -9,22 +10,32 @@ TARGET := backend
|
||||
|
||||
all: swagger docker
|
||||
|
||||
swagger:
|
||||
$(SWAG) fmt
|
||||
$(SWAG) init -o docs -g cmds/serve.go -pdl 1
|
||||
|
||||
docker: $(TARGET)
|
||||
$(DOCKER) compose up -d --force-recreate --build backend
|
||||
|
||||
$(TARGET): $(SOURCE)
|
||||
$(GO_ENV) go build -o $@
|
||||
|
||||
install:
|
||||
$(GO_ENV) go install
|
||||
|
||||
test:
|
||||
go test -v ./tests -count=1
|
||||
go test -v ./tests -count=1 -failfast
|
||||
|
||||
postgres:
|
||||
$(DOCKER) compose exec postgres psql \
|
||||
postgres://go2025:go2025@postgres:5432/go2025?sslmode=disable
|
||||
|
||||
swagger:
|
||||
$(SWAG) fmt
|
||||
$(SWAG) init -o docs -g cmds/serve.go -pdl 1
|
||||
test-ci: docker-quiet test docker-clean
|
||||
|
||||
$(TARGET): $(SOURCE)
|
||||
$(GO_ENV) go build -o $@
|
||||
docker-quiet: $(TARGET)
|
||||
$(DOCKER) compose up -d --force-recreate --build backend \
|
||||
--quiet-build --quiet-pull
|
||||
sleep 5
|
||||
|
||||
docker-clean:
|
||||
$(DOCKER) compose down -v --remove-orphans
|
||||
|
||||
Reference in New Issue
Block a user