|
| 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 | + exclude: |
| 42 | + - php-version: ${{ needs.php-matrix.outputs.highest }} |
| 43 | + coverage: 'none' |
| 44 | + include: |
| 45 | + - php-version: ${{ needs.php-matrix.outputs.highest }} |
| 46 | + coverage: xdebug |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v5 |
| 50 | + |
| 51 | + - uses: shivammathur/setup-php@v2 |
| 52 | + with: |
| 53 | + php-version: ${{ matrix.php-version }} |
| 54 | + coverage: ${{ matrix.coverage }} |
| 55 | + |
| 56 | + - uses: ramsey/composer-install@v3 |
| 57 | + |
| 58 | + - run: composer pest:unit -- ${COVERAGE} --ci |
| 59 | + env: |
| 60 | + COVERAGE: ${{ matrix.coverage == 'xdebug' && '--coverage-clover coverage-unit.xml' || '' }} |
| 61 | + - run: composer pest:feature -- ${COVERAGE} --ci |
| 62 | + env: |
| 63 | + COVERAGE: ${{ matrix.coverage == 'xdebug' && '--coverage-clover coverage-feature.xml' || '' }} |
| 64 | + |
| 65 | + - uses: actions/upload-artifact@v4 |
| 66 | + if: matrix.coverage == 'xdebug' |
| 67 | + with: |
| 68 | + name: coverage |
| 69 | + path: coverage-*.xml |
| 70 | + |
| 71 | + codecov: |
| 72 | + needs: pest |
| 73 | + runs-on: ubuntu-latest |
| 74 | + permissions: |
| 75 | + id-token: write |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v5 |
| 78 | + |
| 79 | + - uses: actions/download-artifact@v5 |
| 80 | + with: |
| 81 | + name: coverage |
| 82 | + |
| 83 | + - uses: codecov/codecov-action@v5 |
| 84 | + with: |
| 85 | + use_oidc: true |
| 86 | + fail_ci_if_error: true |
| 87 | + disable_search: true |
| 88 | + files: coverage-unit.xml |
| 89 | + flags: unit |
| 90 | + |
| 91 | + - uses: codecov/codecov-action@v5 |
| 92 | + with: |
| 93 | + use_oidc: true |
| 94 | + fail_ci_if_error: true |
| 95 | + disable_search: true |
| 96 | + files: coverage-feature.xml |
| 97 | + flags: feature |
| 98 | + |
| 99 | + e2e: |
| 100 | + name: e2e (PHP ${{ matrix.php-version }}, Composer ${{ matrix.composer-version }}) |
| 101 | + needs: php-matrix |
| 102 | + strategy: |
| 103 | + matrix: |
| 104 | + php-version: ${{ fromJSON(needs.php-matrix.outputs.versions) }} |
| 105 | + composer-version: ['2.6', '2.7', '2.8'] |
| 106 | + runs-on: ubuntu-latest |
| 107 | + env: |
| 108 | + GOFLAGS: '-mod=mod' |
| 109 | + steps: |
| 110 | + - run: sudo apt-get update |
| 111 | + - run: sudo apt-get install --no-install-recommends --yes subversion |
| 112 | + |
| 113 | + - uses: actions/checkout@v5 |
| 114 | + |
| 115 | + - uses: shivammathur/setup-php@v2 |
| 116 | + with: |
| 117 | + php-version: ${{ matrix.php-version }} |
| 118 | + tools: composer:${{ matrix.composer-version }} |
| 119 | + coverage: 'none' |
| 120 | + |
| 121 | + - uses: actions/setup-go@v6 |
| 122 | + with: |
| 123 | + go-version-file: 'go.mod' |
| 124 | + |
| 125 | + - run: go test -count=1 ./... |
| 126 | + |
| 127 | + wait-for-all-tests: |
| 128 | + needs: |
| 129 | + - pest |
| 130 | + - e2e |
| 131 | + runs-on: ubuntu-latest |
| 132 | + steps: |
| 133 | + - run: exit 0 |
0 commit comments