Skip to content

Commit 93bcf8d

Browse files
committed
Build/Test Tools: Make the logic around Playground testing reusable.
The workflow responsible for testing the build process is currently responsible for creating a ZIP file of the WordPress build and storing it as an artifact. This can be used for manual testing, but is mainly used for spinning up a Playground instance. Because of how comments with Playground testing instructions are left pull requests. the pull request number needs to be stored as a workflow artifact as well. This moves the logic responsible for this to the reusable workflow, which allows older branches to make use of Playground testing without additional maintenance burden. See #59416. git-svn-id: https://develop.svn.wordpress.org/trunk@58274 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 5aea85c commit 93bcf8d

2 files changed

Lines changed: 29 additions & 24 deletions

File tree

.github/workflows/reusable-test-core-build-process.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ on:
2121
required: false
2222
type: 'boolean'
2323
default: true
24+
prepare-playground:
25+
description: 'Whether to prepare the artifacts needed for Playground testing.'
26+
required: false
27+
type: 'boolean'
28+
default: false
2429

2530
env:
2631
PUPPETEER_SKIP_DOWNLOAD: ${{ true }}
@@ -39,6 +44,8 @@ jobs:
3944
# - Cleans up after building WordPress.
4045
# - Ensures version-controlled files are not modified or deleted.
4146
# - Uploads the ZIP as a GitHub Actions artifact (when building to the build directory).
47+
# - Saves the pull request number to a text file.
48+
# - Uploads the pull request number as an artifact.
4249
build-process-tests:
4350
name: Core running from ${{ inputs.directory }} / ${{ inputs.os == 'macos-latest' && 'MacOS' || inputs.os == 'windows-latest' && 'Windows' || 'Linux' }}
4451
runs-on: ${{ inputs.os }}
@@ -90,8 +97,23 @@ jobs:
9097

9198
- name: Upload ZIP as a GitHub Actions artifact
9299
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
93-
if: ${{ inputs.directory == 'build' && 'ubuntu-latest' == inputs.os }}
100+
if: ${{ inputs.prepare-playground }}
94101
with:
95102
name: wordpress-build-${{ github.event_name == 'pull_request' && github.event.number || github.sha }}
96103
path: wordpress.zip
97104
if-no-files-found: error
105+
106+
- name: Save PR number
107+
if: ${{ inputs.prepare-playground && github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request' }}
108+
run: |
109+
mkdir -p ./pr-number
110+
echo ${{ github.event.number }} > ./pr-number/NR
111+
112+
# Uploads the PR number as an artifact for the Pull Request Commenting workflow to download and then
113+
# leave a comment detailing how to test the PR within WordPress Playground.
114+
- name: Upload PR number as artifact
115+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
116+
if: ${{ inputs.prepare-playground && github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request' }}
117+
with:
118+
name: pr-number
119+
path: pr-number/

.github/workflows/test-build-processes.yml

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,15 @@ jobs:
4040
matrix:
4141
os: [ ubuntu-latest, windows-latest ]
4242
directory: [ 'src', 'build' ]
43+
include:
44+
# Only prepare artifacts for Playground once.
45+
- os: ubuntu-latest
46+
directory: 'build'
47+
prepare-playground: true
4348
with:
4449
os: ${{ matrix.os }}
4550
directory: ${{ matrix.directory }}
51+
prepare-playground: ${{ matrix.prepare-playground && matrix.prepare-playground || false }}
4652

4753
# Tests the WordPress Core build process on MacOS.
4854
#
@@ -106,29 +112,6 @@ jobs:
106112
os: ${{ matrix.os }}
107113
directory: ${{ matrix.directory }}
108114

109-
# Uploads the PR number as an artifact for the Pull Request Commenting workflow to download and then
110-
# leave a comment detailing how to test the PR within WordPress Playground.
111-
playground-comment:
112-
name: Leave WordPress Playground details
113-
runs-on: ubuntu-latest
114-
permissions:
115-
actions: write
116-
continue-on-error: true
117-
needs: [ test-core-build-process, test-core-build-process-macos, test-gutenberg-build-process, test-gutenberg-build-process-macos ]
118-
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request' }}
119-
120-
steps:
121-
- name: Save PR number
122-
run: |
123-
mkdir -p ./pr-number
124-
echo ${{ github.event.number }} > ./pr-number/NR
125-
126-
- name: Upload PR number as artifact
127-
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
128-
with:
129-
name: pr-number
130-
path: pr-number/
131-
132115
slack-notifications:
133116
name: Slack Notifications
134117
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk

0 commit comments

Comments
 (0)