Check PSR-4 mapping in CI (#33) #272
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, pull_request] | |
jobs: | |
php: | |
name: PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }} Composer ${{ matrix.composer }} (${{ matrix.dependencies }}) | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ubuntu-latest] | |
composer: [v2] | |
dependencies: [highest] | |
php-versions: | |
- '5.3' | |
- '5.4' | |
- '5.5' | |
- '5.6' | |
- '7.0' | |
- '7.1' | |
- '7.2' | |
- '7.3' | |
- '7.4' | |
- '8.0' | |
- '8.1' | |
- '8.2' | |
- '8.3' | |
- '8.4' | |
include: | |
- php-versions: '5.3' | |
dependencies: 'lowest' | |
composer: v1 # Global composer should be in same version as locally installed one | |
operating-system: ubuntu-latest | |
- php-versions: '7.0' | |
dependencies: 'lowest' | |
composer: v1 | |
operating-system: ubuntu-latest | |
- php-versions: '8.2' | |
composer: v2 | |
operating-system: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: json | |
coverage: xdebug | |
tools: composer:${{ matrix.composer }} | |
- name: Install Composer dependencies (${{ matrix.dependencies }}) | |
uses: ramsey/composer-install@v3 | |
with: | |
dependency-versions: ${{ matrix.dependencies }} | |
- name: Check PSR-4 mapping | |
if: ${{ matrix.php-versions == 8.3 && matrix.composer == 'v2' }} | |
run: composer dump-autoload --dev --optimize --strict-psr | |
- name: Set default branch for tests | |
run: git config --global init.defaultBranch main | |
- name: Run Tests | |
run: vendor/bin/simple-phpunit --coverage-clover coverage.xml --coverage-text | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Run mutation tests | |
if: ${{ matrix.php-versions == 8.3 && matrix.operating-system == 'ubuntu-latest' }} | |
env: | |
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} | |
run: | | |
composer config --no-plugins allow-plugins.infection/extension-installer true | |
composer require infection/infection --update-with-all-dependencies | |
vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=100 --min-msi=100 -s -j4 --only-covered | |
- name: Run phpstan | |
if: ${{ matrix.php-versions == 8.3 && matrix.operating-system == 'ubuntu-latest' }} | |
run: | | |
composer require phpstan/phpstan --dev | |
vendor/bin/phpstan |