From cef6f8ed7c1effb5500df59aca579d1755754936 Mon Sep 17 00:00:00 2001 From: Yi-Ting Shih Date: Mon, 8 Dec 2025 23:18:19 +0800 Subject: [PATCH] Feat: add workflows --- .gitea/workflows/test.yml | 20 ++++++++++++++++++++ Makefile | 16 ++++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 .gitea/workflows/test.yml diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..44a2b44 --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,20 @@ +--- +name: Go test +on: [push] + +jobs: + run-go-vet: + runs-on: imgbuilder + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Run go vet + run: go vet + run-go-test: + needs: run-go-vet + runs-on: imgbuilder + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Run go test + run: make test diff --git a/Makefile b/Makefile index d12e35c..fd9d076 100644 --- a/Makefile +++ b/Makefile @@ -9,22 +9,22 @@ 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: +test: docker go test -v ./tests -count=1 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 - -$(TARGET): $(SOURCE) - $(GO_ENV) go build -o $@