Continuous integration #384
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: Continuous integration | |
on: | |
pull_request: ~ | |
workflow_dispatch: ~ | |
release: | |
types: [created] | |
schedule: | |
- cron: 0 2 * * 1,4 # At 2am on Monday & Thursday | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
strategy: | |
fail-fast: false | |
matrix: | |
symfony: [5.4.*, 6.0.*, none] | |
php: [8.0, 8.1, 8.2] | |
lowest: ['', '--prefer-lowest'] | |
name: 🚧 Build 🚧 | PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }} lowest ${{ matrix.lowest }} | |
steps: | |
# --- ⚙️ Setup ⚙️ ---------- | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: pcov | |
env: | |
COMPOSER_TOKEN: ${{ secrets.PAT }} | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- | |
${{ runner.os }}-php | |
- name: Restrict Symfony version | |
if: matrix.symfony != 'none' | |
run: composer config extra.symfony.require "${{ matrix.symfony }}" | |
- name: Install dependencies | |
run: composer update ${{ matrix.lowest }} --no-interaction --no-progress --prefer-dist --ansi --verbose --no-scripts | |
# --- 🛠 Test 🛠 ---------- | |
- name: Validate composer.json and composer.lock | |
run: composer validate --strict --no-interaction --ansi --verbose | |
- name: Check for dump in code | |
run: vendor/bin/var-dump-check --symfony --exclude vendor --exclude tests . | |
- name: PHPStan analyse | |
run: vendor/bin/phpstan analyse --configuration=phpstan-ci.neon --error-format=github --no-progress --no-interaction --ansi | |
- name: ECS check | |
run: vendor/bin/ecs check --no-progress-bar --no-interaction --ansi | |
- name: PHPUnit tests | |
run: vendor/bin/phpunit --verbose --coverage-clover ./coverage.xml --coverage-text --color=always --fail-on-incomplete --fail-on-risky --no-interaction --do-not-cache-result | |
- name: Coverage check | |
id: coverage-check | |
uses: johanvanhelden/gha-clover-test-coverage-check@v1 | |
with: | |
percentage: 98 | |
filename: coverage.xml |