Tests #163
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: Tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: null | |
schedule: | |
# Do not make it the first of the month and/or midnight since it is a very busy time | |
- cron: "* 10 5 * *" | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
name: Test ${{ matrix.php }}; Symfony ${{ matrix.symfony-version }} (${{ matrix.dependency }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
php: | |
- '8.1' | |
- '8.2' | |
dependency: [ highest, lowest ] | |
symfony-version: | |
- '5.4.*' | |
- '6.*.*' | |
exclude: | |
- php: '8.0' | |
symfony-version: '6.*.*' | |
- php: '8.2' | |
symfony-version: '5.4.*' | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "${{ matrix.php }}" | |
tools: composer | |
coverage: none | |
- name: Configures the deprecations listener | |
if: matrix.symfony-version == '5.4.*' | |
run: echo "SYMFONY_DEPRECATIONS_HELPER=disabled=1" >> $GITHUB_ENV | |
- name: Enforce the Symfony version used | |
if: ${{ matrix.symfony-version }} | |
run: composer config extra.symfony.require ${{ matrix.symfony-version }} | |
# See https://symfony.com/doc/current/bundles/best_practices.html#require-a-specific-symfony-version | |
# This is done despite having flex locally because locally the dependencies are already | |
# installed once. Here the local flex will not kick in yet because not installed yet. | |
- name: Install Flex | |
if: ${{ matrix.symfony-version }} | |
run: | | |
composer global config --no-plugins allow-plugins.symfony/flex true | |
composer global require --no-progress --no-scripts --no-plugins symfony/flex | |
- name: Install Composer dependencies | |
uses: ramsey/composer-install@v2 | |
with: | |
dependency-versions: ${{ matrix.dependency }} | |
- run: make phpunit | |
infection: | |
runs-on: ubuntu-latest | |
name: Infection | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Setup PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
tools: composer | |
coverage: pcov | |
- name: Install Composer dependencies | |
uses: ramsey/composer-install@v2 | |
- run: make infection | |
# This is a "trick", a meta task which does not change, and we can use in | |
# the protected branch rules as opposed to the individual tests which | |
# may change regularly. | |
validate-tests: | |
name: Check status | |
runs-on: ubuntu-latest | |
needs: | |
- tests | |
- infection | |
if: always() | |
steps: | |
- name: Successful run | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Failing run | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 |