introduce PHPStan static code analysis #195
Workflow file for this run
This file contains hidden or 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: [ push, pull_request ] | |
| jobs: | |
| unit-test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| php: [ '7.4', '8.0', '8.2', '8.4' ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: xdebug | |
| tools: composer | |
| - name: Install | |
| run: composer install --no-interaction | |
| - name: Unit tests | |
| run: | | |
| composer test | |
| sed -i "s#<file name=\"${GITHUB_WORKSPACE}#<file name=\"/github/workspace#g" tests-clover.xml | |
| - name: Analyze with SonarCloud | |
| if: matrix.php == '8.2' && env.SONAR_TOKEN != '' | |
| uses: sonarsource/sonarqube-scan-action@v5 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| with: | |
| args: > | |
| -Dsonar.organization=stklcode-github | |
| -Dsonar.projectKey=stklcode:statify-blacklist | |
| -Dsonar.sources=inc,statify-blacklist.php | |
| -Dsonar.tests=test | |
| -Dsonar.php.tests.reportPath=tests-junit.xml | |
| -Dsonar.php.coverage.reportPaths=tests-clover.xml | |
| -Dsonar.coverage.exclusions=test/**/*.php | |
| quality: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.2' | |
| tools: composer | |
| - name: Install | |
| run: composer install --no-interaction | |
| - name: Code style checks for PHP | |
| run: composer test-cs | |
| phpstan: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.4 | |
| tools: composer | |
| - name: Install PHP dependencies | |
| run: composer install --no-interaction --prefer-dist --no-scripts | |
| - name: PHPStan | |
| run: composer phpstan |