sessions/.woodpecker/test.yml

47 lines
865 B
YAML

when:
- event: [pull_request]
- event: push
branch:
- ${CI_REPO_DEFAULT_BRANCH}
variables:
- &go_image 'golang:1.21'
services:
database:
image: postgres:14.8
environment:
POSTGRES_DB: sessions
POSTGRES_PASSWORD: sessions
steps:
generate:
image: *go_image
pull: true
commands:
- make generate
test:
image: *go_image
group: test
pull: true
environment:
TESTS_DB_DSN: postgres://postgres:sessions@database:5432/sessions?sslmode=disable
commands:
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
lint:
image: golangci/golangci-lint:v1.54
pull: true
group: test
commands:
- golangci-lint run
check-go-mod:
image: *go_image
group: test
pull: true
commands:
- go mod tidy
- git diff --exit-code go.mod