database-anonymizer/.woodpecker/test.yml
Simon Vieille 5c8c8a0037
Some checks failed
ci/woodpecker/push/test Pipeline failed
ci/woodpecker/push/build unknown status
[wip] add run tests
2024-03-20 14:47:53 +01:00

48 lines
1.1 KiB
YAML

when:
- event: [pull_request, tag]
- event: push
branch:
- ${CI_REPO_DEFAULT_BRANCH}
- release/*
- renovate/*
variables:
- &golang_image 'golang:1.22.0'
- &mysql_image 'mariadb:10.3'
- &postgres_image 'postgres:16'
steps:
"Add vendor":
image: *golang_image
commands:
- go mod vendor
"Wait databases":
image: gitnet.fr/deblan/timeout:latest
commands:
- /bin/timeout -t 30 -v -c 'while true; do nc -z -v service-mysql 3306 2>&1 | grep succeeded && exit 0; sleep 0.5; done'
# - /bin/timeout -t 30 -v -c 'while true; do nc -z -v service-postgres 5432 2>&1 | grep succeeded && exit 0; sleep 0.5; done'
"Fill MySQL":
image: *mysql_image
commands:
- mysql test < tests/mysql_data.sql
"Run tests":
image: *golang_image
commands:
- go test -v ./...
services:
service-postgres:
image: *postgres_image
environment:
- POSTGRES_USER=postgres
- POSTGRES_DB=test
- POSTGRES_HOST_AUTH_METHOD=trust
service-mysql:
image: *mysql_image
environment:
- MYSQL_DATABASE=test
- MYSQL_ALLOW_EMPTY_PASSWORD=yes