CI #331
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: CI | |
on: | |
schedule: | |
# Every sunday at 02:00 | |
- cron: 0 2 * * 0 | |
pull_request: | |
push: | |
jobs: | |
ci: | |
name: CI PHP ${{ matrix.php }} (Symfony ${{ matrix.symfony }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: | |
- '8.1' | |
- '8.2' | |
- '8.3' | |
symfony: | |
- '5.4.*' | |
- '6.4.*' | |
- '7.0.*' | |
coverage: | |
- none | |
exclude: | |
- php: '8.1' | |
symfony: '7.0.*' | |
include: | |
- php: '8.1' | |
symfony: '5.4.*' | |
bootable: true | |
coverage: pcov | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check commit messages | |
uses: wagoid/commitlint-github-action@v5 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
ini-values: pcov.directory=. | |
coverage: ${{ matrix.coverage }} | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Configure Symfony | |
run: | | |
composer global config allow-plugins.symfony/flex true | |
composer global require symfony/flex | |
composer config extra.symfony.require "${{ matrix.symfony }}" | |
- name: Update project dependencies | |
run: composer update --no-progress --ansi --prefer-stable | |
- name: Bundle is bootable | |
if: matrix.bootable | |
env: | |
SKELETON_VERSION: ${{ matrix.symfony }} | |
run: | | |
mkdir flex | |
cd flex | |
composer create-project "symfony/skeleton:${SKELETON_VERSION}" . | |
composer config extra.symfony.allow-contrib true | |
composer req tilleuls/url-signer-bundle | |
cd .. | |
rm -rf flex | |
- name: Check code style | |
run: vendor/bin/php-cs-fixer fix --ansi --diff --dry-run | |
- name: Analyze code (Psalm) | |
run: vendor/bin/psalm --php-version=${{ matrix.php }} --long-progress --output-format=github --shepherd --stats | |
- name: Analyze code (PHPStan) | |
run: vendor/bin/phpstan analyze . --ansi --no-progress --error-format=github | |
- name: Run functional tests | |
if: ${{ !startsWith(matrix.symfony, '4') }} | |
run: vendor/bin/behat --colors | |
- name: Run unit tests | |
if: matrix.coverage == 'none' | |
run: vendor/bin/phpunit --colors=always --testdox | |
- name: Run unit tests with coverage | |
if: matrix.coverage != 'none' | |
run: vendor/bin/phpunit --coverage-clover=clover.xml --coverage-xml=coverage-xml --log-junit=junit.xml --colors=always --testdox | |
- name: Upload coverage results | |
if: matrix.coverage != 'none' | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
composer global require --no-progress --no-suggest --ansi php-coveralls/php-coveralls | |
export PATH="$PATH:$HOME/.composer/vendor/bin" | |
php-coveralls --coverage_clover=./clover.xml --json_path=/tmp/coverage.json -v --ansi | |
- name: Run mutation testing | |
if: matrix.coverage != 'none' | |
env: | |
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} | |
run: vendor/bin/infection --ansi --skip-initial-tests --coverage=. --logger-github |