[pull] trunk from WordPress:trunk #15155
This file contains 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: End-to-End Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- trunk | |
- 'release/**' | |
- 'wp/**' | |
# 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: | |
e2e-playwright: | |
name: Playwright - ${{ matrix.part }} | |
runs-on: ubuntu-latest | |
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
part: [1, 2, 3, 4, 5, 6, 7, 8] | |
totalParts: [8] | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} | |
- name: Setup Node.js and install dependencies | |
uses: ./.github/setup-node | |
- name: Npm build | |
run: npm run build | |
- name: Install Playwright dependencies | |
run: | | |
npx playwright install chromium firefox webkit --with-deps | |
- name: Install WordPress and start the server | |
run: | | |
npm run wp-env start | |
- name: Run the tests | |
env: | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
run: | | |
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e -- --shard=${{ matrix.part }}/${{ matrix.totalParts }} | |
- name: Archive debug artifacts (screenshots, traces) | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
if: ${{ !cancelled() }} | |
with: | |
name: failures-artifacts--${{ matrix.part }} | |
path: artifacts/test-results | |
if-no-files-found: ignore | |
- name: Archive flaky tests report | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
if: ${{ !cancelled() }} | |
with: | |
name: flaky-tests-report--${{ matrix.part }} | |
path: flaky-tests | |
if-no-files-found: ignore | |
merge-artifacts: | |
name: Merge Artifacts | |
if: ${{ !cancelled() }} | |
needs: [e2e-playwright] | |
runs-on: ubuntu-latest | |
outputs: | |
has-flaky-test-report: ${{ !!steps.merge-flaky-tests-reports.outputs.artifact-id }} | |
steps: | |
- name: Merge failures artifacts | |
uses: actions/upload-artifact/merge@v4 | |
# Don't fail the job if there aren't any artifacts to merge. | |
continue-on-error: true | |
with: | |
name: failures-artifacts | |
# Retain the merged artifacts in case of a rerun. | |
pattern: failures-artifacts* | |
delete-merged: true | |
- name: Merge flaky tests reports | |
id: merge-flaky-tests-reports | |
uses: actions/upload-artifact/merge@v4 | |
continue-on-error: true | |
with: | |
name: flaky-tests-report | |
pattern: flaky-tests-report* | |
delete-merged: true | |
report-to-issues: | |
name: Report to GitHub | |
needs: [merge-artifacts] | |
if: ${{ needs.merge-artifacts.outputs.has-flaky-test-report == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout defaults to using the branch which triggered the event, which | |
# isn't necessarily `trunk` (e.g. in the case of a merge). | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: trunk | |
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} | |
- uses: actions/download-artifact@v4.1.8 | |
# Don't fail the job if there isn't any flaky tests report. | |
continue-on-error: true | |
with: | |
name: flaky-tests-report | |
path: flaky-tests | |
- name: Setup Node.js and install dependencies | |
uses: ./.github/setup-node | |
- name: Npm build | |
# TODO: We don't have to build the entire project, just the action itself. | |
run: npm run build:packages | |
- name: Report flaky tests | |
uses: ./packages/report-flaky-tests | |
with: | |
repo-token: '${{ secrets.GITHUB_TOKEN }}' | |
label: '[Type] Flaky Test' | |
artifact-path: flaky-tests |