Make it PHP 8.2 compatible #1
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: Ci suite | |
on: [push, pull_request] | |
jobs: | |
symfony: | |
name: PHPUnit tests (PHP ${{ matrix.php-versions }}) | |
runs-on: ubuntu-latest | |
# Docs: https://docs.github.com/en/actions/using-containerized-services | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
ports: | |
- 5432/tcp | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: ['8.0', '8.1', '8.2'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Docs: https://github.com/shivammathur/setup-php | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
tools: phpunit-bridge | |
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, pgsql | |
coverage: xdebug | |
# Local PostgreSQL service in GitHub hosted environments is disabled by default. | |
# If you are using it instead of service containers, make sure you start it. | |
# - name: Start postgresql service | |
# run: sudo systemctl start postgresql.service | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
# Without this step `git add .` command will result in exit code 128. | |
# This ensures the comitter info is set, for now prefil with some exiting | |
# variables in GitHub actions. | |
- name: Set committer info | |
id: committer-info | |
run: | | |
git config --global user.email ${GITHUB_ACTOR_ID}[email protected] | |
git config --global user.name $GITHUB_ACTOR | |
- name: Cache composer dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
# Use composer.json for key, if composer.lock is not committed. | |
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install Composer dependencies | |
run: composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Run Migration | |
run: | | |
composer require --dev symfony/orm-pack | |
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed" | |
php bin/console messenger:setup-transports || echo "No transports configured or setup failed" | |
env: | |
DATABASE_URL: postgres://postgres:[email protected]:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8 | |
- name: Run tests | |
run: php vendor/bin/phpunit --coverage-text | |
env: | |
DATABASE_URL: postgres://postgres:[email protected]:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8 |