Skip to content

Commit

Permalink
Test MariaDB and Valkey backends in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Dec 5, 2024
1 parent 4e18a0d commit 7cb08aa
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ jobs:
mysql:
image: mysql
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 -e MYSQL_ROOT_PASSWORD=test_pass_root -e MYSQL_USER=test_user -e MYSQL_PASSWORD=test_pass -e MYSQL_DATABASE=test_db
mariadb:
image: mariadb
options: --health-cmd="mariadb-admin ping" --health-interval=10s --health-timeout=5s --health-retries=5 -e MYSQL_ROOT_PASSWORD=test_pass_root -e MYSQL_USER=test_user -e MYSQL_PASSWORD=test_pass -e MYSQL_DATABASE=test_db
postgres:
image: postgres:12-alpine
env:
Expand All @@ -85,6 +88,12 @@ jobs:
image: redis:alpine
redis3:
image: redis:alpine
valkey1:
image: valkey/valkey:alpine
valkey2:
image: valkey/valkey:alpine
valkey3:
image: valkey/valkey:alpine
memcached:
image: memcached:alpine
steps:
Expand All @@ -109,10 +118,11 @@ jobs:
- name: Init
run: |
php -r '(new PDO("mysql:host=mysql", "root", "test_pass_root"))->exec("ALTER USER '"'"'test_user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 15");'
php -r '(new PDO("mysql:host=mariadb", "root", "test_pass_root"))->exec("ALTER USER '"'"'test_user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 15");'
php -r '(new PDO("pgsql:host=postgres;dbname=test_db", "test_user", "test_pass"))->exec("ALTER ROLE test_user CONNECTION LIMIT 1");'
if [ -n "$LOG_COVERAGE" ]; then mkdir coverage; fi
- name: "Run tests"
- name: "Run tests 1/2"
env:
MYSQL_DSN: "mysql:host=mysql;dbname=test_db"
MYSQL_USER: test_user
Expand All @@ -125,6 +135,19 @@ jobs:
run: |
php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) --fail-on-warning --fail-on-risky $(if vendor/bin/phpunit --version | grep -q '^PHPUnit 9\.'; then echo -v; else echo --fail-on-notice --fail-on-deprecation --display-notices --display-deprecations --display-warnings --display-errors --display-incomplete --display-skipped; fi)
- name: "Run tests 2/2"
env:
MYSQL_DSN: "mysql:host=mariadb;dbname=test_db"
MYSQL_USER: test_user
MYSQL_PASSWORD: test_pass
PGSQL_DSN: "pgsql:host=postgres;dbname=test_db"
PGSQL_USER: test_user
PGSQL_PASSWORD: test_pass
REDIS_URIS: "redis://valkey1,redis://valkey2,redis://valkey3"
MEMCACHE_HOST: memcached
run: |
php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) --fail-on-warning --fail-on-risky $(if vendor/bin/phpunit --version | grep -q '^PHPUnit 9\.'; then echo -v; else echo --fail-on-notice --fail-on-deprecation --display-notices --display-deprecations --display-warnings --display-errors --display-incomplete --display-skipped; fi)
- name: Upload coverage (only for coverage)
if: env.LOG_COVERAGE && false # TODO
uses: codecov/codecov-action@v5
Expand Down

0 comments on commit 7cb08aa

Please sign in to comment.