Skip to content

Commit

Permalink
Switch Github tests from MariaDB to MySQL
Browse files Browse the repository at this point in the history
  • Loading branch information
mringler committed Dec 7, 2022
1 parent a7d57f1 commit 8d95036
Showing 1 changed file with 32 additions and 36 deletions.
68 changes: 32 additions & 36 deletions .github/workflows/ci.yml
Expand Up @@ -24,33 +24,40 @@ jobs:
php-version: '7.4'
- symfony-version: '6-max'
php-version: '7.4'
env:
DB_NAME: 'propel_tests'
DB_USER: 'propel'
DB_PW: 'propel'
steps:
- name: Install PostgreSQL latest
if: matrix.db-type == 'pgsql' && matrix.php-version != '7.3'
if: matrix.db-type == 'pgsql' && matrix.php-version != '7.4'
uses: CasperWA/postgresql-action@v1.2
with:
postgresql db: 'propel-tests'
postgresql user: 'postgres'
postgresql password: 'postgres'
postgresql db: "$DB_NAME"
postgresql user: "$DB_USER"
postgresql password: "$DB_PW"

- name: Install PostgreSQL min
if: matrix.db-type == 'pgsql' && matrix.php-version == '7.3'
if: matrix.db-type == 'pgsql' && matrix.php-version == '7.4'
uses: CasperWA/postgresql-action@v1.2
with:
postgresql version: 9
postgresql db: 'propel-tests'
postgresql user: 'postgres'
postgresql password: 'postgres'
postgresql db: "$DB_NAME"
postgresql user: "$DB_USER"
postgresql password: "$DB_PW"

- name: Install MariaDb latest
if: matrix.db-type == 'mysql' && matrix.php-version != '7.3'
uses: getong/mariadb-action@v1.1
- name: Install MySQL latest
if: matrix.db-type == 'mysql' && matrix.php-version != '7.4'
uses: mirromutth/mysql-action@v1.1
with:
mysql root password: "$DB_PW"

- name: Install MariaDb min
if: matrix.db-type == 'mysql' && matrix.php-version == '7.3'
if: matrix.db-type == 'mysql' && matrix.php-version == '7.4'
uses: getong/mariadb-action@v1.1
with:
mariadb version: '10.2'
mysql root password: "$DB_PW"

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -79,34 +86,23 @@ jobs:
- name: Composer install (Symfony version ${{ matrix.symfony-version }})
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Setup Postgresql database for test suite
if: matrix.db-type == 'pgsql'
run: tests/bin/setup.pgsql.sh
- name: Create MySQL Propel user
if: matrix.db-type == 'mysql'
run: >
mysql -h 127.0.0.1 -u root -e "
CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password BY '$DB_PW';
GRANT ALL PRIVILEGES ON *.* TO '$DB_USER'@'localhost';
FLUSH PRIVILEGES;
"
env:
DB_NAME: 'propel-tests'
DB_USER: 'postgres'
DB_PW: 'postgres'
MYSQL_PWD: "$DB_PW"

- name: Setup the database for test suite
if: matrix.db-type != 'agnostic' && matrix.db-type != 'pgsql'
- name: Setup database for test suite
if: matrix.db-type != 'agnostic'
run: tests/bin/setup.${{ matrix.db-type }}.sh

- name: Run PostgreSQL tests
if: matrix.db-type == 'pgsql'
shell: 'script -q -e -c "bash {0}"'
run: |
if [[ ${{ matrix.php-version }} == '7.4' && ${{ matrix.symfony-version == '5-max' }} ]]; then
export CODECOVERAGE=1 && vendor/bin/phpunit -c tests/pgsql.phpunit.xml --verbose --coverage-clover=tests/coverage.xml
else
vendor/bin/phpunit -c tests/pgsql.phpunit.xml
fi
env:
DB_NAME: 'propel-tests'
DB_USER: 'postgres'
DB_PW: 'postgres'

- name: Run ${{ matrix.db-type }} tests
if: matrix.db-type != 'pgsql'
- name: Run database tests
if: matrix.db-type != 'agnostic'
shell: 'script -q -e -c "bash {0}"'
run: |
if [[ ${{ matrix.php-version }} == '7.4' && ${{ matrix.symfony-version == '5-max' }} ]]; then
Expand Down

0 comments on commit 8d95036

Please sign in to comment.