Skip to content

doc: add alternative ways to perform tests #208

doc: add alternative ways to perform tests

doc: add alternative ways to perform tests #208

Workflow file for this run

name: Tests
on: [push, pull_request]
jobs:
tests:
name: Symfony ${{ matrix.symfony-version }} on PHP ${{ matrix.php-version }} flags ${{ matrix.composer-flags }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Symfony 6.3 requires PHP >= 8.0, it will be installed on PHP >= 8.0
# Symfony 7.0 requires PHP >= 8.2, it will be installed on PHP >= 8.2
php-version: ['8.1', '8.2']
composer-flags: ['']
symfony-version: ['^6.4']
include:
- php-version: 7.4
symfony-version: "^5.4"
composer-flags: "--prefer-lowest"
- php-version: 8.1
symfony-version: "^5.4"
- php-version: 8.1
symfony-version: "^6.4"
- php-version: 8.2
symfony-version: "^6.4"
- php-version: 8.2
symfony-version: "^7.0"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-version }}
- name: Get composer cache directory
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Require Symfony
# non-dev then dev dependencies
run: >
composer require --no-update
symfony/framework-bundle=${{ matrix.symfony-version }}
symfony/browser-kit=${{ matrix.symfony-version }}
&&
composer require --dev --no-update
symfony/css-selector=${{ matrix.symfony-version }}
symfony/form=${{ matrix.symfony-version }}
symfony/http-kernel=${{ matrix.symfony-version }}
symfony/security-bundle=${{ matrix.symfony-version }}
symfony/twig-bundle=${{ matrix.symfony-version }}
symfony/validator=${{ matrix.symfony-version }}
symfony/yaml=${{ matrix.symfony-version }}
# This is needed to fix builds where the `annotation_reader` service may not be set up if
# the Annotations package is not in the production dependencies
- name: Require Annotations v1 to require for PHP 7
if: startsWith(matrix.php-version, '7.')
run: composer require --no-update "doctrine/annotations:^1.8.0"
- name: Require Annotations v1/v2 to require for PHP 8+
if: startsWith(matrix.php-version, '7.') != true
run: composer require --no-update "doctrine/annotations:^1.8.0|^2.0"
- name: Install Composer dependencies
if: matrix.composer-flags == ''
run: composer install
- name: Install Composer dependencies with options
if: matrix.composer-flags != ''
# Use "update" instead of "install" since it allows using the "--prefer-lowest" option
run: composer update ${{ matrix.composer-flags }}
- name: Show Composer dependencies
run: composer show
- name: Run tests
run: php ./vendor/bin/phpunit --testdox