I maintain a PHP library that accesses a database. I have automated unit tests set up using Gitlab CI, and they use a test matrix to test a wide range of combinations of database engine and PHP version. My .gitlab-ci
config file currently looks a bit like this one:
test-php:
stage: test
parallel:
matrix:
- PHPVERSION: ["7.3", "7.4", "8.0", "8.2", "8.3"]
DBSERVICE: ["mysyql:8.0", "mysql:8.4", "mariadb:latest"]
image: php:$PHPVERSION
services:
- $DBSERVICE
before_script:
- ./tests/setup/mysql.sh
script:
- ./tests/run.sh
I would like to exclude one combination of tests – specifically the PHP 7.3 test with MySQL 8.4 due to the issues with native password authentication. (I know these issues can be worked around, but for various reasons I don’t want to do that in this test suite at the moment: I just want to exclude that one test.)
I know I can do it by testing $PHPVERSION
and $DBSERVICE
in the run.sh
script (or equivalently in the config file), but that still causes the containers to be installed, which can take several minutes. As the tests are quick compared to the cost of starting up and configuring the Docker container, and I’d rather not start up containers for the excluded combinations at all.