Fix PR build workflow failing for fork contributors #1695
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: | |
| # Run on all pull requests. | |
| pull_request: | |
| push: | |
| branches: | |
| - trunk | |
| # Cancels all previous workflow runs for pull requests that have not completed. | |
| concurrency: | |
| # The concurrency group contains the workflow name and the branch name for pull requests | |
| # or the commit hash for any other events. | |
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: End-to-End Testing against WordPress | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Use desired version of NodeJS | |
| uses: actions/[email protected] | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Npm install | |
| run: | | |
| npm ci | |
| - name: Install Playwright dependencies | |
| run: | | |
| npx playwright install chromium --with-deps | |
| - name: Start up WordPress environment | |
| env: | |
| WP_ENV_CORE: WordPress/WordPress#6.7 | |
| WP_ENV_PHP_VERSION: 8.1 | |
| run: | | |
| npm run dev:build | |
| - name: Output WordPress and PHP version | |
| run: | | |
| npm run wp-cli cli info | |
| npm run wp-cli core version | |
| - name: Run E2E tests | |
| env: | |
| PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
| run: | | |
| npm run test:e2e | |
| - name: Stop WordPress environment | |
| run: | | |
| npm run dev:stop | |
| - name: Archive E2E results | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: test-results | |
| path: artifacts |