CI #757
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 | |
on: | |
push: | |
branches: | |
- main | |
- '[0-9].[0-9]' | |
tags: | |
- '*' | |
pull_request: ~ | |
schedule: | |
# Every Sunday at 02:00 | |
- cron: 0 2 * * 0 | |
workflow_dispatch: ~ | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
tests: | |
name: Tests PHP ${{ matrix.php }} (Symfony ${{ matrix.symfony }}) (API Platform ${{ matrix.api-platform }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: | |
# Only PHP supported versions: https://www.php.net/supported-versions.php | |
- '8.0' | |
- '8.1' | |
- '8.2' | |
symfony: | |
# Only Symfony supported versions: https://symfony.com/releases | |
- '4.4.*' | |
- '5.4.*' | |
- '6.2.*' | |
api-platform: | |
# Only API Platform supported versions | |
- '^2.6' | |
- '^2.7' | |
- '^3.1' | |
include: | |
# Ensure the bundle is bootable | |
- php: '8.2' | |
symfony: '6.2.*' | |
bootable: true | |
quality: true | |
api-platform: '^3.1' | |
# Fix laminas/laminas-code support | |
- php: '8.0' | |
symfony: '4.4.*' | |
laminas: true | |
exclude: | |
# Symfony 6 requires PHP >= 8.1 | |
- symfony: '6.2.*' | |
php: '8.0' | |
# Symfony 6.2.* requires PHP >= 8.1 | |
- symfony: '6.2.*' | |
php: '8.0' | |
# API Platform 3.1 requires PHP >= 8.1 and Symfony >= 6.1.* | |
- api-platform: '^3.1' | |
php: '8.0' | |
- api-platform: '^3.1' | |
symfony: '4.4.*' | |
- api-platform: '^3.1' | |
symfony: '5.4.*' | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer:v2, flex, php-cs-fixer | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Configure Symfony | |
run: composer config extra.symfony.require "${{ matrix.symfony }}" | |
- name: Configure Laminas | |
if: matrix.laminas | |
run: composer require laminas/laminas-zendframework-bridge --no-install --no-update --no-progress --no-scripts | |
- name: Configure API Platform | |
run: composer require api-platform/core:${{ matrix.api-platform }} --dev --no-install --no-update --no-progress --no-scripts | |
- name: Update project dependencies | |
run: composer update --no-progress --ansi --prefer-stable --prefer-dist --no-scripts | |
- name: Bundle is bootable | |
if: ${{ matrix.bootable && github.event_name == 'push' && github.ref_name == 'main' }} | |
run: | | |
composer create-project "symfony/skeleton:${{ matrix.symfony }}" flex | |
cd flex | |
composer config extra.symfony.allow-contrib true | |
composer req --ignore-platform-reqs tilleuls/forgot-password-bundle:dev-${{ github.ref_name }} | |
- name: Run php-cs-fixer tests | |
if: matrix.quality | |
env: | |
# PHP CS Fixer does not support PHP 8.2 yet | |
PHP_CS_FIXER_IGNORE_ENV: 1 | |
run: php-cs-fixer fix --diff --dry-run | |
- name: Run PHPUnit tests | |
run: vendor/bin/simple-phpunit --colors=always --testdox | |
- name: Run Behat tests | |
run: | | |
mkdir -p features/app/cache/test/doctrine/orm/Proxies features/app/logs | |
vendor/bin/behat | |
- name: Run Behat tests with jms/serializer-bundle | |
run: | | |
mkdir -p features/app/cache/jmsserializer/doctrine/orm/Proxies features/app/logs | |
vendor/bin/behat -p jmsserializer |