database-anonymizer/.woodpecker/test.yml
Simon Vieille 0a1e8ffda5
Some checks failed
ci/woodpecker/push/test Pipeline failed
ci/woodpecker/push/build unknown status
tests: update mysql password in ci
2024-03-31 22:22:38 +02: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 -hservice-mysql -uroot -proot 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
- MARIADB_ROOT_PASSWORD=root