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

This commit is contained in:
2025-12-08 23:18:19 +08:00
parent f191aef810
commit 3beb10511d
3 changed files with 35 additions and 6 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-quiet

View File

@@ -9,22 +9,30 @@ TARGET := backend
all: swagger docker all: swagger docker
swagger:
$(SWAG) fmt
$(SWAG) init -o docs -g cmds/serve.go -pdl 1
docker: $(TARGET) docker: $(TARGET)
$(DOCKER) compose up -d --force-recreate --build backend $(DOCKER) compose up -d --force-recreate --build backend
$(TARGET): $(SOURCE)
$(GO_ENV) go build -o $@
install: install:
$(GO_ENV) go install $(GO_ENV) go install
test: test: docker
go test -v ./tests -count=1 go test -v ./tests -count=1
postgres: postgres:
$(DOCKER) compose exec postgres psql \ $(DOCKER) compose exec postgres psql \
postgres://go2025:go2025@postgres:5432/go2025?sslmode=disable postgres://go2025:go2025@postgres:5432/go2025?sslmode=disable
swagger: test-quiet: docker-quiet
$(SWAG) fmt go test -v ./tests -count=1
$(SWAG) init -o docs -g cmds/serve.go -pdl 1
$(TARGET): $(SOURCE) docker-quiet: $(TARGET)
$(GO_ENV) go build -o $@ $(DOCKER) compose up -d --force-recreate --build backend \
--quiet-build --quiet-pull
sleep 5

View File

@@ -64,6 +64,7 @@ services:
context: . context: .
env_file: env_file:
- path: ./.env - path: ./.env
required: false
ports: ports:
- 8080:8080 - 8080:8080
volumes: volumes: