2023-12-15 07:16:51 +00:00
|
|
|
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
|
2024-01-10 06:39:09 +00:00
|
|
|
rmq:
|
|
|
|
image: rabbitmq:3.12.10-alpine
|
|
|
|
environment:
|
|
|
|
RABBITMQ_DEFAULT_USER: twhelp
|
|
|
|
RABBITMQ_DEFAULT_PASS: twhelp
|
2023-12-15 07:16:51 +00:00
|
|
|
|
|
|
|
variables:
|
2024-02-09 08:49:23 +00:00
|
|
|
- &go_image 'golang:1.22'
|
2023-12-15 07:16:51 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
generate:
|
|
|
|
image: *go_image
|
|
|
|
pull: true
|
|
|
|
commands:
|
2024-03-16 06:00:29 +00:00
|
|
|
- go mod vendor
|
2023-12-15 07:16:51 +00:00
|
|
|
- make generate
|
|
|
|
|
|
|
|
test:
|
|
|
|
image: *go_image
|
2024-01-03 08:15:45 +00:00
|
|
|
depends_on:
|
|
|
|
- generate
|
2023-12-15 07:16:51 +00:00
|
|
|
pull: true
|
|
|
|
environment:
|
|
|
|
TESTS_POSTGRES_CONNECTION_STRING:
|
|
|
|
postgres://postgres:twhelp@database:5432/twhelp?sslmode=disable
|
2024-01-10 06:39:09 +00:00
|
|
|
TESTS_RABBITMQ_CONNECTION_STRING:
|
|
|
|
amqp://twhelp:twhelp@rmq:5672/
|
2023-12-15 07:16:51 +00:00
|
|
|
commands:
|
|
|
|
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|
|
|
|
|
|
|
|
lint:
|
2024-03-21 05:56:01 +00:00
|
|
|
image: golangci/golangci-lint:v1.57
|
2023-12-15 07:16:51 +00:00
|
|
|
pull: true
|
2024-01-03 08:15:45 +00:00
|
|
|
depends_on:
|
|
|
|
- generate
|
2023-12-15 07:16:51 +00:00
|
|
|
commands:
|
|
|
|
- golangci-lint run
|
|
|
|
|
|
|
|
check-go-mod:
|
|
|
|
image: *go_image
|
2024-01-03 08:15:45 +00:00
|
|
|
depends_on:
|
|
|
|
- generate
|
2023-12-15 07:16:51 +00:00
|
|
|
pull: true
|
|
|
|
commands:
|
|
|
|
- go mod tidy
|
|
|
|
- git diff --exit-code go.mod
|
|
|
|
|
|
|
|
hadolint:
|
|
|
|
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:
|
|
|
|
image: cytopia/yamllint:1
|
|
|
|
pull: true
|
|
|
|
commands:
|
|
|
|
- yamllint --strict .
|
|
|
|
when:
|
|
|
|
- path:
|
|
|
|
include:
|
|
|
|
- "**/*.yaml"
|
|
|
|
- "**/*.yml"
|