dcbot/.woodpecker/test.yml

63 lines
1.2 KiB
YAML

when:
- event: [pull_request]
- event: push
branch:
- ${CI_REPO_DEFAULT_BRANCH}
variables:
- &go_image 'golang:1.22'
services:
database:
image: postgres:14
pull: true
environment:
POSTGRES_DB: dcbot
POSTGRES_PASSWORD: dcbot
redis:
image: redis:7.2.2
steps:
generate:
image: *go_image
pull: true
commands:
- make generate
- go mod vendor
test:
image: *go_image
depends_on:
- generate
pull: true
environment:
TESTS_DB_DSN: postgres://postgres:dcbot@database:5432/dcbot?sslmode=disable
TESTS_REDIS_CONNECTION_STRING: redis://:@redis:6379/0
commands:
- go test -parallel 2 -race -coverprofile=coverage.txt -covermode=atomic ./...
lint:
image: golangci/golangci-lint:v1.57
pull: true
depends_on:
- generate
commands:
- golangci-lint run
check-go-mod:
image: *go_image
depends_on:
- generate
pull: true
commands:
- go mod tidy
- git diff --exit-code go.mod
validate-migrations:
image: *go_image
depends_on:
- generate
pull: true
commands:
- make validate-migrations