close #44 #169
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: Test | |
on: [push] | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
php: ["8.1", "8.2", "8.3"] | |
env: | |
tools: composer, phpstan | |
ini-values: default_charset='UTF-8' | |
name: PHP ${{ matrix.php }} test on ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
ini-values: ${{ env.ini-values }} | |
coverage: pcov | |
tools: ${{ env.tools }} | |
env: | |
fail-fast: true | |
- name: Setup problem matchers for PHPUnit | |
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: Validate composer | |
run: composer validate | |
- 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.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: composer install --no-progress | |
- name: Run PHPStan | |
run: phpstan analyse src -l 9 | |
- name: Tests (PHPUnit) | |
run: vendor/bin/phpunit --coverage-xml=build/logs/xml-coverage --log-junit=build/logs/junit.xml | |
- name: Mutation testing (Infection) | |
env: | |
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} | |
run: | | |
curl -sLOJ https://github.com/infection/infection/releases/download/0.26.16/infection.phar | |
curl -sLOJ https://github.com/infection/infection/releases/download/0.26.16/infection.phar.asc | |
gpg --recv-keys C6D76C329EBADE2FB9C458CFC5095986493B4AA0 | |
gpg --with-fingerprint --verify infection.phar.asc infection.phar | |
chmod +x infection.phar | |
./infection.phar --coverage=build/logs --min-covered-msi=90 --threads=$(nproc) --logger-github --only-covered |