|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + tags: |
| 12 | + - '**' |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.event.pull_request.number || github.sha }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +permissions: {} |
| 19 | + |
| 20 | +jobs: |
| 21 | + php-matrix: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + outputs: |
| 24 | + versions: ${{ steps.php-matrix.outputs.versions }} |
| 25 | + highest: ${{ steps.php-matrix.outputs.highest }} |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v5 |
| 28 | + with: |
| 29 | + sparse-checkout: composer.json |
| 30 | + sparse-checkout-cone-mode: false |
| 31 | + |
| 32 | + - uses: typisttech/php-matrix-action@v2 |
| 33 | + id: php-matrix |
| 34 | + |
| 35 | + pest: |
| 36 | + needs: php-matrix |
| 37 | + strategy: |
| 38 | + matrix: |
| 39 | + php-version: ${{ fromJSON(needs.php-matrix.outputs.versions) }} |
| 40 | + coverage: none |
| 41 | + include: |
| 42 | + - php-version: ${{ needs.php-matrix.outputs.highest }} |
| 43 | + coverage: xdebug |
| 44 | + runs-on: ubuntu-latest |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v5 |
| 47 | + |
| 48 | + - uses: shivammathur/setup-php@v2 |
| 49 | + with: |
| 50 | + php-version: ${{ matrix.php-version }} |
| 51 | + coverage: ${{ matrix.coverage }} |
| 52 | + |
| 53 | + - uses: ramsey/composer-install@v3 |
| 54 | + |
| 55 | + - run: composer pest:unit -- ${COVERAGE} --ci |
| 56 | + env: |
| 57 | + COVERAGE: ${{ matrix.coverage == 'xdebug' && '--coverage-clover coverage-unit.xml' || '' }} |
| 58 | + - run: composer pest:feature -- ${COVERAGE} --ci |
| 59 | + env: |
| 60 | + COVERAGE: ${{ matrix.coverage == 'xdebug' && '--coverage-clover coverage-feature.xml' || '' }} |
| 61 | + |
| 62 | + - uses: actions/upload-artifact@v4 |
| 63 | + if: matrix.coverage == 'xdebug' |
| 64 | + with: |
| 65 | + name: coverage |
| 66 | + path: coverage-*.xml |
| 67 | + |
| 68 | + codecov: |
| 69 | + needs: pest |
| 70 | + runs-on: ubuntu-latest |
| 71 | + permissions: |
| 72 | + id-token: write |
| 73 | + steps: |
| 74 | + - uses: actions/checkout@v5 |
| 75 | + |
| 76 | + - uses: actions/download-artifact@v5 |
| 77 | + with: |
| 78 | + name: coverage |
| 79 | + |
| 80 | + - uses: codecov/codecov-action@v5 |
| 81 | + with: |
| 82 | + use_oidc: true |
| 83 | + fail_ci_if_error: true |
| 84 | + disable_search: true |
| 85 | + files: coverage-unit.xml |
| 86 | + flags: unit |
| 87 | + |
| 88 | + - uses: codecov/codecov-action@v5 |
| 89 | + with: |
| 90 | + use_oidc: true |
| 91 | + fail_ci_if_error: true |
| 92 | + disable_search: true |
| 93 | + files: coverage-feature.xml |
| 94 | + flags: feature |
0 commit comments