Skip to content

CI

CI #887

Workflow file for this run

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.1'
- '8.2'
- '8.3'
symfony:
# Only Symfony supported versions: https://symfony.com/releases
- '6.4.*'
- '7.1.*'
api-platform:
- '^3.4'
- '^4.0'
include:
- php: '8.3'
symfony: '7.1.*'
api-platform: '^4.0'
bootable: true
quality: true
exclude:
# Symfony 7 requires PHP 8.2
- php: '8.1'
symfony: '7.1.*'
- php: '8.2'
symfony: '7.1.*'
# API Platform 4 requires PHP 8.2
- php: '8.1'
api-platform: '^4.0'
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- 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@v4
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 API Platform
run: composer require --dev "api-platform/core:${{ matrix.api-platform }}"
- name: Update project dependencies
run: composer update --no-progress --ansi --prefer-stable --prefer-dist --no-scripts
- 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
- name: Run php-cs-fixer tests
if: matrix.quality
env:
# PHP CS Fixer does not support PHP 8.3 yet
PHP_CS_FIXER_IGNORE_ENV: 1
run: php-cs-fixer fix --diff --dry-run
- 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 }}