I have a project with multiple microservices, relying on a central database. Each microservice lives in a separate Github repository with its own pipeline. The pipeline definition for each of them looks more or less like this:
# validate.yaml
...
tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql/mysql:8
env:
MYSQL_DATABASE: some_db
MYSQL_ROOT_PASSWORD: some_pw
ports:
- 3306:3306
steps:
# init database
- run: a number
- run: of steps to
- run: initialise the db
- run: with test data that
- is the same for each microservice
# run tests for microservice
- run: poetry run pytest
Is it possible to define the mysql
service, as well as its setup steps in a generic way, so that I can re-use it in all of my different repositories?