Update tests and GH workflow #118
Workflow file for this run
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: | |
pull_request: | |
push: | |
branches: | |
- "master" | |
jobs: | |
PHPStan: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.3' | |
extensions: mbstring, intl | |
coverage: none | |
env: | |
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
update: true | |
- name: Cache vendor | |
uses: actions/cache@v4 | |
id: cache-vendor | |
with: | |
path: ./vendor | |
key: ${{ runner.os }}-8.3-vendor-${{ hashFiles('./composer.json') }} | |
- name: Install dependencies | |
if: steps.cache-vendor.outputs.cache-hit != 'true' | |
run: composer i --prefer-dist --no-interaction --no-progress --optimize-autoloader | |
- name: PHPStan tests | |
run: vendor/bin/phpstan analyze -l 9 -a vendor/yiisoft/yii2/Yii.php --no-progress src | |
Infection: | |
name: PHP ${{ matrix.php }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['8.1', '8.2', '8.3'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: mbstring, intl, mysql | |
coverage: 'pcov' | |
env: | |
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
update: true | |
- name: Cache vendor | |
uses: actions/cache@v4 | |
id: cache-vendor | |
with: | |
path: ./vendor | |
key: ${{ runner.os }}-${{ matrix.php }}-vendor-${{ hashFiles('./composer.json') }} | |
- name: Install dependencies | |
if: steps.cache-vendor.outputs.cache-hit != 'true' | |
run: composer update --no-interaction --no-progress --optimize-autoloader | |
- name: Run PHPUnit | |
if: matrix.php != '8.3' | |
run: vendor/bin/phpunit | |
- name: Run Infection with PHPUnit | |
if: matrix.php == '8.3' | |
run: | | |
mkdir -p build/logs | |
vendor/bin/phpunit --coverage-xml=build/logs/coverage-xml --log-junit=build/logs/junit.xml | |
vendor/bin/infection --threads=2 --coverage=build/logs --show-mutations --no-progress | |
env: | |
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} |