Upgrade to PHPStan 2.0 (#64) #17
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: ci | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/php.yml" | |
- "**.php" | |
- "composer.json" | |
- "composer.lock" | |
- "phpcs.xml.dist" | |
- "phpstan.neon.dist" | |
- "phpunit.xml.dist" | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/php.yml" | |
- "**.php" | |
- "composer.json" | |
- "composer.lock" | |
- "phpcs.xml.dist" | |
- "phpstan.neon.dist" | |
- "phpunit.xml.dist" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
version: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Setup Composer cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: composer-${{ matrix.version }}-${{ hashFiles('**/composer.json') }} | |
restore-keys: php-${{ matrix.version }}-composer- | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.version }} | |
tools: composer:v2 | |
- name: Install dependencies | |
run: composer update --prefer-dist --no-ansi --no-interaction --no-progress | |
- name: Run linter | |
if: ${{ matrix.version == '7.4' }} | |
run: composer phpcs | |
- name: Run static analysis | |
run: composer phpstan | |
- name: Run test | |
run: vendor/bin/phpunit --coverage-clover coverage.xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |