Skip to content

CI

CI #2721

Workflow file for this run

name: CI
on:
pull_request:
push:
schedule:
- cron: '0 0 * * *'
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
analyse:
runs-on: ubuntu-latest
env:
PHP_CS_FIXER_IGNORE_ENV: 1
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: none, curl, dom, json, mbstring, opcache, openssl, simplexml, tokenizer, xml, xmlwriter
coverage: none
- if: ${{ github.event_name != 'pull_request' }}
run: rm ./.dev-tools/composer.lock
- run: composer update --no-progress
- run: composer analyse
test:
name: PHP ${{ matrix.php-version }} ${{ matrix.description }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
description: 'with lowest dependencies'
composer-flags: '--prefer-lowest'
php-version: '7.4'
- os: ubuntu-latest
description: 'with lowest dependencies and shim package'
composer-flags: '--prefer-lowest'
use-shim-package: true
php-version: '7.4'
- os: ubuntu-latest
php-version: '8.0'
- os: ubuntu-latest
php-version: '8.1'
- os: ubuntu-latest
php-version: '8.2'
- os: ubuntu-latest
description: 'with calculating code coverage and Infection'
calculate-coverage: true
phpunit-flags: '--coverage-clover=./build/logs/clover.xml'
php-version: '8.3'
FAST_LINT_TEST_CASES: 1
- os: ubuntu-latest
description: 'with PHP CS Fixer from master'
with-php-cs-fixer-from-master: true
php-version: '8.3'
- os: ubuntu-latest
description: 'with shim package'
use-shim-package: true
php-version: '8.3'
- os: ubuntu-latest
description: 'with bootstrap'
with-bootstrap: true
php-version: '8.3'
- os: macos-latest
description: 'on macOS'
php-version: '8.3'
- os: windows-latest
description: 'on Windows'
php-version: '8.3'
FAST_LINT_TEST_CASES: 1
- os: ubuntu-latest
php-version: '8.4'
runs-on: ${{ matrix.os }}
timeout-minutes: 10
env:
PHP_CS_FIXER_FUTURE_MODE: 1
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: none, ctype, curl, dom, json, mbstring, opcache, openssl, simplexml, tokenizer, xml, xmlwriter
ini-values: pcov.directory=$GITHUB_WORKSPACE/src, zend.assertions=1
coverage: ${{ (matrix.calculate-coverage && 'pcov') || 'none' }}
- id: composer-cache
shell: bash
run: echo "dir=$(composer config cache-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
- if: ${{ matrix.with-bootstrap }}
uses: sergeysova/jq-action@v2
with:
cmd: |
jq -r --indent 4 'del(.autoload."psr-4")' composer.json > composer.tmp
jq -r --indent 4 '.autoload += {"files": ["bootstrap.php"]}' composer.tmp > composer.json
- if: ${{ matrix.use-shim-package }}
run: sed -i 's#friendsofphp/php-cs-fixer#php-cs-fixer/shim#g' composer.json
- if: ${{ matrix.with-php-cs-fixer-from-master }}
run: composer require friendsofphp/php-cs-fixer:dev-master --no-update
- if: ${{ matrix.calculate-coverage }}
run: composer require --dev php-coveralls/php-coveralls --no-update
- run: composer update --no-progress --classmap-authoritative ${{ matrix.composer-flags }}
- run: composer show | grep php-cs-fixer
- run: ./vendor/bin/phpunit ${{ matrix.phpunit-flags }}
env:
FAST_LINT_TEST_CASES: ${{ matrix.FAST_LINT_TEST_CASES }}
- if: ${{ matrix.calculate-coverage }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
run: ./vendor/bin/php-coveralls --verbose
- if: ${{ matrix.calculate-coverage }}
env:
FAST_LINT_TEST_CASES: 1
run: composer infection