Feat: add workflows
Some checks failed
Go test / run-go-vet (push) Successful in 5s
Go test / run-go-test (push) Failing after 7s

This commit is contained in:
2025-12-08 23:18:19 +08:00
parent f191aef810
commit cef6f8ed7c
2 changed files with 28 additions and 8 deletions

20
.gitea/workflows/test.yml Normal file
View File

@@ -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

View File

@@ -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 $@