Skip to content

Commit

Permalink
add mariadb tests to github action
Browse files Browse the repository at this point in the history
  • Loading branch information
abbasudo committed Sep 20, 2024
1 parent 905fac4 commit 48e8480
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
db: [ sqlite, mysql ,pgsql ]
db: [ sqlite, mysql, pgsql, mariadb ]
php: [ 8.2, 8.3 ]
prefer: [ lowest, stable ]

Expand Down Expand Up @@ -57,12 +57,18 @@ jobs:
sudo -u postgres psql -c "CREATE USER test_user WITH PASSWORD 'passw0rd!';"
sudo -u postgres psql -c "ALTER DATABASE test_db OWNER TO test_user;"
- name: Configure MariaDB
if: matrix.db == 'mariadb'
run: |
sudo systemctl start mariadb.service
sudo mysql --password=root --user=root -e "CREATE DATABASE IF NOT EXISTS test_db;"
- name: Run PHPUnit tests
env:
DB_CONNECTION: ${{ matrix.db }}
DB_HOST: ${{ matrix.db == 'sqlite' && '' || (matrix.db == 'mysql' && '127.0.0.1') || (matrix.db == 'pgsql' && '127.0.0.1') }}
DB_PORT: ${{ matrix.db == 'sqlite' && '' || (matrix.db == 'mysql' && '3306') || (matrix.db == 'pgsql' && '5432') }}
DB_DATABASE: ${{ matrix.db == 'sqlite' && ':memory:' || (matrix.db == 'mysql' && 'test_db') || (matrix.db == 'pgsql' && 'test_db') }}
DB_USERNAME: ${{ matrix.db == 'sqlite' && '' || (matrix.db == 'mysql' && 'root') || (matrix.db == 'pgsql' && 'test_user') }}
DB_PASSWORD: ${{ matrix.db == 'sqlite' && '' || (matrix.db == 'mysql' && 'root') || (matrix.db == 'pgsql' && 'passw0rd!') }}
run: vendor/bin/phpunit
DB_HOST: ${{ matrix.db == 'sqlite' && '' || (matrix.db == 'mysql' && '127.0.0.1') || (matrix.db == 'pgsql' && '127.0.0.1') || (matrix.db == 'mariadb' && '127.0.0.1') }}
DB_PORT: ${{ matrix.db == 'sqlite' && '' || (matrix.db == 'mysql' && '3306') || (matrix.db == 'pgsql' && '5432') || (matrix.db == 'mariadb' && '3306') }}
DB_DATABASE: ${{ matrix.db == 'sqlite' && ':memory:' || (matrix.db == 'mysql' && 'test_db') || (matrix.db == 'pgsql' && 'test_db') || (matrix.db == 'mariadb' && 'test_db') }}
DB_USERNAME: ${{ matrix.db == 'sqlite' && '' || (matrix.db == 'mysql' && 'root') || (matrix.db == 'pgsql' && 'test_user') || (matrix.db == 'mariadb' && 'root') }}
DB_PASSWORD: ${{ matrix.db == 'sqlite' && '' || (matrix.db == 'mysql' && 'root') || (matrix.db == 'pgsql' && 'passw0rd!') || (matrix.db == 'mariadb' && 'root') }}
run: vendor/bin/phpunit

0 comments on commit 48e8480

Please sign in to comment.