Skip to content
149 changes: 70 additions & 79 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Continuous Integration

on:
pull_request: null
Expand All @@ -9,87 +9,91 @@ on:
- 3.5.x

jobs:
Tests:
tests:
name: Tests
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental == true }}
env:
SYMFONY_REQUIRE: ${{matrix.symfony_constraint}}
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
strategy:
fail-fast: false
matrix:
php:
- '8.1'
- '8.0'
- '7.4'
- '7.3'
- '7.2'
sentry_constraint: [false]
dbal_constraint: [false]
symfony_constraint: ['']
experimental: [false]
- '7.3'
- '7.4'
- '8.0'
- '8.1'
symfony-version:
- 3.4.*
- 4.4.*
- 5.*
dependencies:
- highest
exclude:
- php: '8.0'
symfony-version: 3.4.*
- php: '8.1'
symfony-version: 3.4.*
include:
# - description: 'sentry/sentry dev-develop'
# php: '7.4'
# sentry_constraint: 'dev-develop'
# experimental: true
- description: 'DBAL 2'
php: '7.4'
dbal_constraint: '^2.13'
- description: 'Symfony 4.4'
php: '7.3'
symfony_constraint: 4.4.*
- description: 'Symfony 3.4'
php: '7.2'
symfony_constraint: 3.4.*
env:
SYMFONY_DEPRECATIONS_HELPER: disabled
- description: 'prefer lowest'
php: '7.2'
composer_option: '--prefer-lowest'
symfony_constraint: ^3.4.44
env:
SYMFONY_DEPRECATIONS_HELPER: disabled

name: PHP ${{ matrix.php }} tests (${{ matrix.description }})
- php: '7.2'
symfony-version: 3.4.*
dependencies: lowest
- php: '7.2'
symfony-version: 4.4.*
dependencies: lowest
- php: '7.2'
symfony-version: 5.*
dependencies: lowest

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
- uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: ${{ matrix.php }}-${{ matrix.symfony_constraint }}-${{ matrix.composer_option }}
- uses: shivammathur/setup-php@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
- name: Install Symfony Flex
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex
- run: composer remove --dev symfony/messenger --no-update
if: matrix.symfony_constraint == '3.4.*' || matrix.composer_option == '--prefer-lowest'
- run: composer require --dev doctrine/dbal ${{ matrix.dbal_constraint }} --no-update
if: matrix.dbal_constraint
- run: composer update --no-progress --ansi ${{ matrix.composer_option }}
- run: composer require sentry/sentry dev-develop
if: matrix.sentry_constraint == 'dev-develop'
- run: vendor/bin/phpunit --coverage-clover=coverage.xml
- uses: codecov/codecov-action@v1
coverage: pcov
tools: flex

- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Remove Symfony Messenger
run: composer remove --dev symfony/messenger --no-update
if: matrix.symfony-version == '3.4.*'

- name: Install dependencies
uses: ramsey/composer-install@v1
with:
file: './coverage.xml'
fail_ci_if_error: true
dependency-versions: ${{ matrix.dependencies }}
composer-options: --prefer-dist

- name: Run tests
run: vendor/bin/phpunit --coverage-clover=build/coverage-report.xml

- name: Upload code coverage
uses: codecov/codecov-action@v1
with:
file: build/coverage-report.xml

missing-optional-packages-tests:
name: Tests without optional packages
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '7.2'
- '8.0'
dependencies:
- lowest
- highest
include:
- php: '7.2'
dependencies: lowest
- php: '7.4'
dependencies: highest
- php: '8.0'
dependencies: lowest
- php: '8.1'
dependencies: highest

steps:
- name: Checkout
Expand All @@ -104,27 +108,14 @@ jobs:
- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Determine Composer cache directory
id: composer-cache
run: echo "::set-output name=directory::$(composer config cache-dir)"

- name: Cache Composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.directory }}
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-${{ matrix.dependencies }}-

- name: Remove optional packages
run: composer remove doctrine/dbal doctrine/doctrine-bundle symfony/messenger symfony/twig-bundle symfony/cache --dev --no-update

- name: Install highest dependencies
run: composer update --no-progress --no-interaction --prefer-dist
if: ${{ matrix.dependencies == 'highest' }}

- name: Install lowest dependencies
run: composer update --no-progress --no-interaction --prefer-dist --prefer-lowest
if: ${{ matrix.dependencies == 'lowest' }}
- name: Install dependencies
uses: ramsey/composer-install@v1
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: --prefer-dist

- name: Run tests
run: vendor/bin/phpunit --coverage-clover=build/coverage-report.xml
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^8.5||^9.0",
"phpunit/phpunit": "^8.5.14||^9.0",
"symfony/browser-kit": "^3.4.44||^4.4.20||^5.0.11",
"symfony/cache": "^3.4.44||^4.4.20||^5.0.11",
"symfony/dom-crawler": "^3.4.44||^4.4.20||^5.0.11",
Expand Down