Merge pull request #1577 from liip/2-to-3 #615
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: PHPUnit | |
on: | |
pull_request: | |
push: | |
branches: | |
- 1.x | |
- 2.x | |
- 3.x | |
jobs: | |
phpunit: | |
name: "PHP ${{ matrix.php }} + ${{ matrix.dependencies }} dependencies + Symfony ${{ matrix.symfony }}" | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['8.1', '8.2', '8.3'] | |
dependencies: [highest] | |
symfony: ['*'] | |
stability: ['stable'] | |
include: | |
# Minimum supported dependencies with the oldest supported PHP version | |
- php: '8.1' | |
dependencies: lowest | |
symfony: '*' | |
stability: 'stable' | |
# Minimum supported dependencies with the latest supported PHP version | |
- php: '8.3' | |
dependencies: lowest | |
symfony: '*' | |
stability: 'stable' | |
# Test each supported Symfony version with the lowest supported PHP version | |
- php: '8.1' | |
dependencies: highest | |
symfony: '6.4.*' | |
stability: 'stable' | |
- php: '8.2' | |
dependencies: highest | |
symfony: '7.0.*' | |
stability: 'stable' | |
- php: '8.3' | |
dependencies: highest | |
symfony: '7.0.*' | |
stability: 'stable' | |
# Test Symfony 7.1 dev | |
- php: '8.2' | |
dependencies: highest | |
symfony: '7.1.*' | |
stability: 'dev' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure coverage driver | |
id: coverage | |
run: echo ::set-output name=driver::xdebug | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: ${{ steps.coverage.outputs.driver }} | |
extensions: gd, imagick | |
- name: Require Symfony version | |
if: matrix.symfony != '*' | |
run: | | |
composer global config --no-plugins allow-plugins.symfony/flex true | |
composer global require --no-interaction --no-progress symfony/flex | |
composer config extra.symfony.require ${{ matrix.symfony }} | |
- name: Set minimum-stability | |
run: composer config minimum-stability ${{ matrix.stability }} | |
- name: Update project dependencies | |
uses: ramsey/composer-install@v2 | |
with: | |
dependency-versions: ${{ matrix.dependencies }} | |
- name: Cache PHPUnit | |
uses: actions/cache@v3 | |
with: | |
path: vendor/bin/.phpunit | |
key: ${{ runner.os }}-phpunit-${{ matrix.php }} | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit install | |
- name: Run PHPUnit tests | |
env: | |
SYMFONY_DEPRECATIONS_HELPER: max[self]=0 | |
run: vendor/bin/simple-phpunit -v | |
- name: Install php-coveralls | |
run: composer global require --no-interaction --no-progress php-coveralls/php-coveralls | |
- name: Upload coverage results to Coveralls | |
uses: nick-invision/retry@v2 | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_PARALLEL: true | |
COVERALLS_FLAG_NAME: "PHP ${{ matrix.php }} + ${{ matrix.dependencies }} dependencies + Symfony ${{ matrix.symfony }}" | |
with: | |
timeout_seconds: 60 | |
max_attempts: 3 | |
command: php-coveralls -x var/build/clover.xml -o var/build/upload.json -v | |
coveralls-finish: | |
needs: [phpunit] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Notify Coveralls when build is finished | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel-finished: true |