configuration of ci

This commit is contained in:
Simon Vieille 2024-03-20 14:09:43 +01:00
parent 0c2015ad7a
commit 1c6f792711
Signed by: deblan
GPG key ID: 579388D585F70417
2 changed files with 31 additions and 2 deletions

View file

@ -10,7 +10,7 @@ depends_on:
- test
variables:
- &golang_image 'docker.io/golang:1.22.0'
- &golang_image 'golang:1.22.0'
steps:
"Add vendor":

View file

@ -7,7 +7,9 @@ when:
- renovate/*
variables:
- &golang_image 'docker.io/golang:1.22.0'
- &golang_image 'golang:1.22.0'
- &mysql_image 'mysql:8.2.0'
- &postgres_image 'postgres:16'
steps:
"Add vendor":
@ -15,7 +17,34 @@ steps:
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 db 3306 2>&1 | grep succeeded && exit 0; sleep 0.5; done'
- /bin/timeout -t 30 -v -c 'while true; do nc -z -v db 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
ports: ['5432']
environment:
- POSTGRES_USER=postgres
- POSTGRES_HOST_AUTH_METHOD=trust
when: *when
service-mysql:
image: *mysql_image
ports: ['3306']
environment:
- MYSQL_DATABASE=test
- MYSQL_ALLOW_EMPTY_PASSWORD=yes