Allow to run tests for different versions of symfony and database #249
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Run Tests" | |
on: | |
push: | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- 'templates/**' | |
- 'config/**' | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
APP_ENV: test | |
jobs: | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- php: '8.1' | |
driver: 'SQLITE' | |
redis: 6 | |
symfony: '6.4.*' | |
- php: '8.3' | |
driver: 'PGSQL' | |
redis: 7 | |
symfony: '7.0.*' | |
name: PHP ${{ matrix.php }} ${{ matrix.driver }} SF ${{ matrix.symfony }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v3" | |
- name: "Install PHP" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "none" | |
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 dependencies" | |
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: "Run tests" | |
run: "composer tests" |