feat: add scrutinizer #12
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: | ||
| branches: | ||
| - master | ||
| - main | ||
| pull_request: | ||
| jobs: | ||
| tests: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php-version: | ||
| - '8.1' | ||
| - '8.2' | ||
| - '8.3' | ||
| - '8.4' | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php-version }} | ||
| tools: composer:v2 | ||
| coverage: none | ||
| - name: Validate composer.json | ||
| run: composer validate --strict --no-check-lock | ||
| - name: Install dependencies | ||
| run: composer update --prefer-dist --no-progress | ||
| - name: Run PHPStan | ||
| run: composer phpstan | ||
| - name: Run PHPUnit | ||
| run: vendor/bin/phpunit --no-coverage | ||
| coverage: | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'push' | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '8.4' | ||
| tools: composer:v2 | ||
| coverage: xdebug | ||
| - name: Install dependencies | ||
| run: composer update --prefer-dist --no-progress | ||
| - name: Run PHPUnit with Clover coverage | ||
| run: vendor/bin/phpunit --exclude-group performance --coverage-clover coverage.xml | ||
| - name: Upload coverage to Scrutinizer | ||
| if: ${{ secrets.SCRUTINIZER_TOKEN != '' }} | ||
| run: | | ||
| curl -LsS https://scrutinizer-ci.com/ocular.phar -o ocular.phar | ||
| php ocular.phar code-coverage:upload --format=php-clover coverage.xml --access-token="${{ secrets.SCRUTINIZER_TOKEN }}" | ||