Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 78 additions & 8 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,76 @@ concurrency:
permissions: {}

jobs:
build:
name: Build
runs-on: ${{ vars.RUNNERS_NAME || 'ubuntu-24.04' }}
permissions:
contents: read
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
timeout-minutes: 30

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false

- name: Setup Node.js and install dependencies
uses: ./.github/setup-node

- name: Npm build
run: npm run build -- --skip-types

# Wider than the `build*` directories, because the build also emits
# generated files next to sources: the block parsers, the icon
# library, and the worker entry points.
- name: Upload build output
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-output
path: |
build
packages/*/build
packages/*/build-module
packages/*/build-style
packages/*/build-types
packages/*/build-wp
packages/*/src/library/*.tsx
packages/*/src/library/index.ts
packages/*/src/worker-code.ts
packages/block-serialization-spec-parser/parser.js
packages/block-serialization-spec-parser/parser.php
retention-days: 3
if-no-files-found: error
# Allow re-running the workflow over a previous attempt.
overwrite: true

e2e-playwright:
name: Playwright - ${{ matrix.part }}
runs-on: ${{ vars.RUNNERS_NAME || 'ubuntu-24.04' }}
needs: build
timeout-minutes: 45
# A skipped check counts as passing for required status checks, so a
# broken build must not skip these jobs — they have to start and go red
# (see the guard step below). `!cancelled()` is what drops the implicit
# `success()`; `!= 'skipped'` keeps the fork/repository filter that now
# lives on the build job.
if: ${{ !cancelled() && needs.build.result != 'skipped' }}
permissions:
contents: read
id-token: write
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
part: [1, 2, 3, 4, 5, 6, 7, 8]
totalParts: [8]

steps:
# Bail out before checkout and `npm ci` rather than after.
- name: Fail if the build job failed
if: ${{ needs.build.result != 'success' }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adimoldovan It looks like needs.<job_id>.result can be either success, failure, cancelled, or skipped.

  • The ! cancelled() checks that the workflow run itself has not been cancelled and covers cancelled.
  • The result != 'skipped covers when build is skilled entirely.

That leaves failure and success.

I'm not clear on why this conditional check is necessary. If the build job fails, wouldn't the workflow run be stopped and all steps/jobs following the failure never run?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the build job fails the dependent e2e jobs will be skipped and a skipped job that is required will not block the merge. #81015 will make this step irrelevant though (and this reminded me to update it).

run: exit 1

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
Expand All @@ -43,8 +98,10 @@ jobs:
- name: Setup Node.js and install dependencies
uses: ./.github/setup-node

- name: Npm build
run: npm run build -- --skip-types
- name: Download build output
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: build-output

- name: Install Playwright dependencies
uses: ./.github/setup-playwright
Expand Down Expand Up @@ -80,13 +137,24 @@ jobs:
e2e-playwright-rtc-websocket:
name: Playwright - RTC WebSocket
runs-on: ${{ vars.RUNNERS_NAME || 'ubuntu-24.04' }}
needs: build
timeout-minutes: 20
# A skipped check counts as passing for required status checks, so a
# broken build must not skip these jobs — they have to start and go red
# (see the guard step below). `!cancelled()` is what drops the implicit
# `success()`; `!= 'skipped'` keeps the fork/repository filter that now
# lives on the build job.
if: ${{ !cancelled() && needs.build.result != 'skipped' }}
permissions:
contents: read
id-token: write
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
timeout-minutes: 20

steps:
# Bail out before checkout and `npm ci` rather than after.
- name: Fail if the build job failed
if: ${{ needs.build.result != 'success' }}
run: exit 1

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
Expand All @@ -95,8 +163,10 @@ jobs:
- name: Setup Node.js and install dependencies
uses: ./.github/setup-node

- name: Npm build
run: npm run build -- --skip-types
- name: Download build output
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: build-output

# No collaboration spec is tagged `@webkit` or `@firefox`.
- name: Install Playwright dependencies
Expand Down
Loading