|
| 1 | +name: PHP Composer |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +permissions: |
| 6 | + contents: read |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: "php: ${{ matrix.php }} TYPO3: ${{ matrix.typo3 }}" |
| 11 | + runs-on: ubuntu-latest |
| 12 | + strategy: |
| 13 | + fail-fast: true |
| 14 | + max-parallel: 4 |
| 15 | + matrix: |
| 16 | + php: [ '82', '83', '84', '85' ] |
| 17 | + typo3: [ '14' ] |
| 18 | + outputs: |
| 19 | + result: ${{ steps.set-result.outputs.result }} |
| 20 | + php: ${{ matrix.php }} |
| 21 | + typo3: ${{ matrix.typo3 }} |
| 22 | + container: |
| 23 | + image: ghcr.io/typo3/core-testing-php${{ matrix.php }}:latest |
| 24 | + steps: |
| 25 | + - name: Install dependencies (Alpine) |
| 26 | + run: apk add --no-cache nodejs npm gnupg |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + - name: Get composer project name |
| 29 | + id: composer-name |
| 30 | + run: echo "name=$(php -r "echo str_replace('/', '-', json_decode(file_get_contents('composer.json'))->name);")" >> $GITHUB_OUTPUT |
| 31 | + - uses: actions/cache@v4 |
| 32 | + with: |
| 33 | + path: | |
| 34 | + ~/.composer/cache/files |
| 35 | + vendor |
| 36 | + node_modules |
| 37 | + key: ${{ matrix.typo3 }}-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} |
| 38 | + restore-keys: | |
| 39 | + ${{ matrix.typo3 }}-${{ matrix.php }}-composer- |
| 40 | + - run: git config --global --add safe.directory $GITHUB_WORKSPACE |
| 41 | + - run: composer switchto${{ matrix.typo3 }} --ignore-platform-req=php+ |
| 42 | + - run: ./vendor/bin/grumphp run --ansi --no-interaction |
| 43 | + - run: composer test |
| 44 | + - name: Generate coverage report |
| 45 | + if: matrix.php == '83' && matrix.typo3 == '14' |
| 46 | + run: ./vendor/bin/phpunit --coverage-clover coverage.xml |
| 47 | + env: |
| 48 | + XDEBUG_MODE: coverage |
| 49 | + - name: Upload coverage to Codecov |
| 50 | + if: matrix.php == '83' && matrix.typo3 == '14' |
| 51 | + uses: codecov/codecov-action@v5.5.3 |
| 52 | + continue-on-error: true |
| 53 | + with: |
| 54 | + files: coverage.xml |
| 55 | + fail_ci_if_error: false |
| 56 | + verbose: true |
| 57 | + env: |
| 58 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 59 | + - name: Save result |
| 60 | + if: always() |
| 61 | + run: | |
| 62 | + mkdir -p summary |
| 63 | + echo "PHP=${{ matrix.php }} TYPO3=${{ matrix.typo3 }} RESULT=${{ job.status }}" \ |
| 64 | + >> summary/results.txt |
| 65 | + - uses: actions/upload-artifact@v4 |
| 66 | + if: always() |
| 67 | + with: |
| 68 | + name: ${{ steps.composer-name.outputs.name }}-${{ matrix.typo3 }}-${{ matrix.php }} |
| 69 | + path: summary/results.txt |
| 70 | + summary: |
| 71 | + runs-on: ubuntu-latest |
| 72 | + needs: build |
| 73 | + if: always() |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v4 |
| 76 | + - name: Get composer project name |
| 77 | + id: composer-name |
| 78 | + run: echo "name=$(python3 -c "import json; d=json.load(open('composer.json')); print(d['name'].replace('/', '-'))")" >> $GITHUB_OUTPUT |
| 79 | + - uses: actions/download-artifact@v4 |
| 80 | + with: |
| 81 | + path: summary |
| 82 | + pattern: ${{ steps.composer-name.outputs.name }}-* |
| 83 | + merge-multiple: false |
| 84 | + - name: Show results |
| 85 | + run: | |
| 86 | + echo "### Matrix results" |
| 87 | + find summary -name results.txt | sort | xargs cat |
0 commit comments