Refactor/improve readability #17
Workflow file for this run
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: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - '*.x' | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| # TODO: remove once shivammathur/setup-php fixes Windows PHP setup | |
| # (broken since windows runner images shipped PHP 8.5, actions/runner-images#13603) | |
| continue-on-error: ${{ contains(matrix.os, 'windows') }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos-latest, ubuntu-latest, windows-latest] | |
| php: ['7.4', '8.2', '8.4'] | |
| node: ['20'] | |
| name: ${{ matrix.os }} node-${{ matrix.node }} php-${{ matrix.php }} | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| extensions: curl, dom, libxml, mbstring, pcntl, pdo, pdo_sqlite, sqlite, xdebug, zip | |
| key: cache-v1 | |
| GITHUB_ACTIONS: true | |
| PHPUNIT_PROJECT: src/PHPUnit/__tests__/fixtures/phpunit-stub | |
| PEST_PROJECT: src/PHPUnit/__tests__/fixtures/pest-stub | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup cache environment | |
| id: extcache | |
| uses: shivammathur/cache-extensions@v1 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: ${{ env.extensions }} | |
| key: ${{ env.key }} | |
| - name: Cache extensions | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.extcache.outputs.dir }} | |
| key: ${{ steps.extcache.outputs.key }} | |
| restore-keys: ${{ steps.extcache.outputs.key }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: ${{ env.extensions }} | |
| tools: composer:v2 | |
| coverage: xdebug | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: npm | |
| - name: Install Composer dependencies (PHPUnit stubs) | |
| run: | | |
| for dir in ${{ env.PHPUNIT_PROJECT }}/v*/; do | |
| echo "::group::Installing $(basename "$dir")" | |
| (cd "$dir" && composer update --prefer-dist --no-interaction --no-progress) || true | |
| echo "::endgroup::" | |
| done | |
| - name: Install Composer dependencies (Pest stubs) | |
| run: | | |
| for dir in ${{ env.PEST_PROJECT }}/v*/; do | |
| echo "::group::Installing $(basename "$dir")" | |
| (cd "$dir" && composer update --prefer-dist --no-interaction --no-progress) || true | |
| echo "::endgroup::" | |
| done | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Run the tests | |
| run: npm run vitest | |
| - name: Send to codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: unittests |