Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to run tests for different versions of symfony and database #203

Merged
merged 14 commits into from
Dec 3, 2023
69 changes: 62 additions & 7 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,23 @@ jobs:
matrix:
include:
- php: '8.1'
redis: '6'
driver: 'SQLITE'
redis: 6
symfony: '6.4.*'
- php: '8.2'
driver: 'PGSQL'
redis: 6
symfony: '6.4.*'
- php: '8.3'
redis: '7'
name: PHP ${{ matrix.php }}
runs-on: ubuntu-20.04
driver: 'MYSQL'
redis: 6
symfony: '6.4.*'
- php: '8.3'
driver: 'SQLITE'
redis: 7
symfony: '7.0.*'
name: PHP ${{ matrix.php }} ${{ matrix.driver }} SF ${{ matrix.symfony }}
runs-on: ubuntu-22.04

steps:
- name: "Checkout"
Expand All @@ -39,17 +51,60 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "curl, mbstring, pdo, pdo_sqlite, sqlite, zip, redis"
extensions: "curl, pdo, pdo_sqlite, pdo_mysql, pdo_pgsql, sqlite, zip, redis"
php-version: ${{ matrix.php }}
tools: composer

- name: "Install Postgres"
if: ${{ matrix.driver=='PGSQL' }}
uses: harmon758/postgresql-action@v1
with:
postgresql version: '14'
postgresql password: '123456'
postgresql db: 'packeton'

- name: "Install MySql"
if: ${{ matrix.driver=='MYSQL' }}
uses: mirromutth/[email protected]
with:
mysql version: '8.0'
mysql database: 'packeton'
mysql root password: '123456'

- name: "Install dependencies"
run: composer update --ansi --no-interaction

run: |
set -x
echo $DATABASE_URL
if [[ "${{ matrix.symfony }}" != "6.4.*" ]]; then
export SYMFONY_REQUIRE="${{ matrix.symfony }}"
composer update --ansi --no-interaction
else
composer install --ansi --no-interaction
fi
- name: Start Redis
uses: "supercharge/[email protected]"
with:
redis-version: ${{ matrix.redis }}

- name: "Prepare Postgres"
if: ${{ matrix.driver=='PGSQL' }}
run: |
set -x
echo 'DATABASE_URL="postgresql://postgres:[email protected]/packeton?serverVersion=14.0&charset=utf8"' >> .env.test;
bin/console doctrine:schema:update --force --complete

gunzip -c tests/dump/test.db.gz > tests/dump/test.db
php tests/import_db.php sqlite:////${PWD}/tests/dump/test.db postgresql://postgres:[email protected]/packeton

- name: "Prepare MySql"
if: ${{ matrix.driver=='MYSQL' }}
run: |
set -x
echo 'DATABASE_URL="mysql://root:[email protected]/packeton?serverVersion=8.0&charset=utf8mb4"' >> .env.test;
bin/console doctrine:schema:update --force --complete

gunzip -c tests/dump/test.db.gz > tests/dump/test.db
php tests/import_db.php sqlite:////${PWD}/tests/dump/test.db mysql://root:[email protected]:3306/packeton

- name: "Run tests"
run: "composer tests"
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"require": {
"php": ">=8.1",
"ext-redis": "*",
"babdev/pagerfanta-bundle": "^4.0",
"babdev/pagerfanta-bundle": "^4.0 || dev-symfony-7 as 4.9.99",
"cebe/markdown": "^1.1",
"composer/composer": "^2.5",
"doctrine/annotations": "^1.0",
Expand Down
109 changes: 59 additions & 50 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ doctrine:
replace: Oro\ORM\Query\AST\Functions\String\Replace
date_format: Oro\ORM\Query\AST\Functions\String\DateFormat

when@test:
doctrine:
dbal:
# "TEST_TOKEN" is typically set by ParaTest
dbname_suffix: '_test%env(default::TEST_TOKEN)%'

when@prod:
doctrine:
orm:
Expand Down
Loading