Let a run be asked for without pushing #8
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: Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| # So a run can be asked for without pushing something to ask for it. | |
| workflow_dispatch: | |
| jobs: | |
| tests: | |
| name: PHP ${{ matrix.php }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['8.1', '8.2', '8.3', '8.4'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: none | |
| - uses: ramsey/composer-install@v3 | |
| - name: Unit tests | |
| run: vendor/bin/unit-tests | |
| coverage: | |
| name: Coverage | |
| runs-on: ubuntu-latest | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| coverage: none | |
| - uses: ramsey/composer-install@v3 | |
| - name: Unit tests with coverage | |
| run: phpdbg -qrr vendor/bin/unit-tests | |
| # Only where the token is there, so a fork or a repository without it still passes. | |
| - name: SonarCloud | |
| if: env.SONAR_TOKEN != '' | |
| # Reporting, not a gate: a token which has expired should not turn a green suite red. | |
| continue-on-error: true | |
| uses: SonarSource/sonarqube-scan-action@v5 | |
| env: | |
| SONAR_HOST_URL: https://sonarcloud.io | |
| static-analysis: | |
| name: Static analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| coverage: none | |
| - uses: ramsey/composer-install@v3 | |
| - name: PHPStan | |
| run: vendor/bin/phpstan analyse --no-progress |