core/.woodpecker/test.yml

72 lines
1.4 KiB
YAML

when:
- event: [pull_request]
- event: push
branch:
- ${CI_REPO_DEFAULT_BRANCH}
services:
database:
image: postgres:14
pull: true
environment:
POSTGRES_DB: twhelp
POSTGRES_PASSWORD: twhelp
variables:
- &go_image 'golang:1.21'
steps:
generate:
image: *go_image
pull: true
commands:
- go mod download
- make generate
test:
image: *go_image
group: test
pull: true
environment:
TESTS_POSTGRES_CONNECTION_STRING:
postgres://postgres:twhelp@database:5432/twhelp?sslmode=disable
commands:
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
lint:
image: golangci/golangci-lint:v1.55
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
hadolint:
group: test
image: hadolint/hadolint:2.12.0-debian
commands:
- hadolint build/docker/twhelp/prod/Dockerfile build/docker/twhelp/dev/Dockerfile
when:
- path:
- build/docker/twhelp/prod/Dockerfile
- build/docker/twhelp/dev/Dockerfile
yamllint:
group: test
image: cytopia/yamllint:1
pull: true
commands:
- yamllint --strict .
when:
- path:
include:
- "**/*.yaml"
- "**/*.yml"