Skip to content

Tests

Tests #199

Workflow file for this run

name: Tests
on:
push:
pull_request:
schedule:
- cron: '30 7 * * 1'
jobs:
tests:
if: (github.event_name == 'schedule' && github.repository == 'e-commit/doctrine-utils') || (github.event_name != 'schedule')
strategy:
fail-fast: false
matrix:
include:
#Mini (for each Symfony version)
- php-version: '8.0'
symfony-version: '5.4.*'
composer-flags: '--prefer-stable --prefer-lowest'
description: 'with SF 5.4.* lowest'
- php-version: '8.1'
symfony-version: '6.4.*'
composer-flags: '--prefer-stable --prefer-lowest'
description: 'with SF 6.4.* lowest'
- php-version: '8.2'
symfony-version: '7.0.*'
composer-flags: '--prefer-stable --prefer-lowest'
description: 'with SF 7.0.* lowest'
- php-version: '8.2'
symfony-version: '7.1.*'
composer-flags: '--prefer-stable --prefer-lowest'
description: 'with SF 7.1.* lowest'
#Symfony versions
- php-version: '8.3'
symfony-version: '5.4.*'
description: 'with SF 5.4.*'
- php-version: '8.3'
symfony-version: '5.4.*@dev'
description: 'with SF 5.4.* dev'
- php-version: '8.3'
symfony-version: '6.4.*'
description: 'with SF 6.4.*'
- php-version: '8.3'
symfony-version: '6.4.*@dev'
description: 'with SF 6.4.* dev'
- php-version: '8.3'
symfony-version: '7.0.*'
description: 'with SF 7.0.*'
- php-version: '8.3'
symfony-version: '7.0.*@dev'
description: 'with SF 7.0.* dev'
- php-version: '8.3'
symfony-version: '7.1.*'
description: 'with SF 7.1.*'
- php-version: '8.3'
symfony-version: '7.1.*@dev'
description: 'with SF 7.1.* dev'
- php-version: '8.3'
symfony-version: '7.2.*@dev'
description: 'with SF 7.2.* dev'
#PHP versions
- php-version: '8.0'
- php-version: '8.1'
- php-version: '8.2'
- php-version: '8.3'
#CS
- php-version: '8.2'
description: 'with Coding Standards'
coding-standards: true
#Static Analysis (min PHP version)
- php-version: '8.0'
description: 'with Static Analysis'
static-analysis: true
name: PHP ${{ matrix.php-version }} ${{ matrix.description }}
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
tools: flex
env:
update: true
- name: Display versions
run: |
php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;'
php -i
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}-${{ matrix.composer-flags }}
restore-keys: composer-${{ runner.os }}-${{ matrix.php-version }}-
- name: Configure minimum stability
if: matrix.symfony-version && contains(matrix.symfony-version, '@dev')
run: composer config minimum-stability dev
- name: Remove friendsofphp/php-cs-fixer
if: matrix.coding-standards != true
run: composer remove friendsofphp/php-cs-fixer --dev --no-update
- name: Remove phpstan/phpstan
if: matrix.static-analysis != true
run: composer remove phpstan/phpstan --dev --no-update
- name: Configure Symfony Flex
if: matrix.symfony-version
run: composer config extra.symfony.require ${{ matrix.symfony-version }}
- name: Install dependencies
run: composer update --no-interaction --no-progress ${{ matrix.composer-flags }}
- name: Run PHPUnit
if: matrix.coding-standards != true && matrix.static-analysis != true
run: php vendor/phpunit/phpunit/phpunit
- name: Run PHP CS Fixer
if: matrix.coding-standards
run: php vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --diff --dry-run -v
- name: Check license year
if: matrix.coding-standards
run: cat LICENSE |grep -E "\(c\) ([0-9]+\-)*`date +%G`"
- name: Run PHPStan
if: matrix.static-analysis
run: php vendor/bin/phpstan --no-progress --error-format=github