Fix E2E tests stability #202
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: E2E Tests | |
| on: | |
| workflow_call: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| prepare-matrix: | |
| name: Prepare test matrix | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| matrix: ${{ steps.build-matrix.outputs.matrix }} | |
| steps: | |
| - name: Checkout plugin | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Build dynamic WordPress + PHP matrix | |
| id: build-matrix | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| matrix="$(python3 scripts/get-wordpress-matrix.py)" | |
| echo "Using matrix: ${matrix}" | |
| echo "matrix=${matrix}" >> "$GITHUB_OUTPUT" | |
| e2e: | |
| needs: prepare-matrix | |
| name: WP ${{ matrix.wp }} / PHP ${{ matrix.php }} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: ${{ github.event_name == 'pull_request' }} | |
| matrix: ${{ fromJSON(needs.prepare-matrix.outputs.matrix) }} | |
| steps: | |
| - name: Checkout plugin | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| version: 10 | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: lts/* | |
| cache: "pnpm" | |
| - name: Install pnpm dependencies | |
| run: pnpm install | |
| - name: Set WordPress and PHP version override | |
| run: | | |
| echo '{ | |
| "core": "https://wordpress.org/wordpress-${{ matrix.wp }}.zip", | |
| "phpVersion": "${{ matrix.php }}" | |
| }' > .wp-env.override.json | |
| - name: Start wp-env | |
| run: pnpm exec wp-env start | |
| - name: Install Playwright browsers | |
| run: pnpm run tests:install | |
| - name: Run Playwright tests | |
| run: pnpm exec playwright test | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-results-php${{ matrix.php }}-wp${{ matrix.wp }} | |
| path: test-results | |
| retention-days: 30 |