mirror of
git://develop.git.wordpress.org/
synced 2025-02-22 07:35:46 +01:00
The `check-latest` setting is used to ensure the latest version of Node.js is always installed in GitHub Action workflows. This input was added and turned on in [57212] when the minimum required version of Node.js was bumped to `20.10.0`. Because GitHub Action runner image updates are deployed on a rolling basis over the course of several days, a version of Node.js that met this new requirement was not always present (especially on Windows runners). Using this input was a temporary fix to ensure stability for Core’s test workflows. The `check-latest` input does have some side effects. Two examples are: - An additional request is performed to check the latest version every time `setup-node` is used with this option enabled. More requests are made to download and install a newer version of Node.js when one is available. - When new versions of Node.js are released, the Core workflows immediately switch to the new version, which could potentially have undiscovered bugs or regressions. The latter has surfaced today due to a regression in Node.js 20.13.0 on Windows (see https://github.com/nodejs/node/issues/52884). A bit of time has passed and a version >=20.10.0 is now reliably available on all GitHub Action runners. Running the very latest release Node.js is also not important for Core’s testing setup, so `check-version` can safely be removed to address both side effects detailed above. Props johnbillion. Fixes #60129. git-svn-id: https://develop.svn.wordpress.org/trunk@58120 602fd350-edb4-49c9-b593-d223f7449a82
93 lines
3.2 KiB
YAML
93 lines
3.2 KiB
YAML
##
|
|
# A callable workflow that tests the Gutenberg plugin build process when run within a wordpress-develop checkout.
|
|
##
|
|
name: Test the Gutenberg plugin Build Process
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
os:
|
|
description: 'Operating system to run tests on'
|
|
required: false
|
|
type: 'string'
|
|
default: 'ubuntu-latest'
|
|
directory:
|
|
description: 'Directory to run WordPress from. Valid values are `src` or `build`'
|
|
required: false
|
|
type: 'string'
|
|
default: 'src'
|
|
|
|
env:
|
|
GUTENBERG_DIRECTORY: ${{ inputs.directory == 'build' && 'build' || 'src' }}/wp-content/plugins/gutenberg
|
|
PUPPETEER_SKIP_DOWNLOAD: ${{ true }}
|
|
NODE_OPTIONS: '--max-old-space-size=8192'
|
|
|
|
jobs:
|
|
# Verifies that installing npm dependencies and building the Gutenberg plugin works as expected.
|
|
#
|
|
# Performs the following steps:
|
|
# - Checks out the repository.
|
|
# - Checks out the Gutenberg plugin into the plugins directory.
|
|
# - Sets up Node.js.
|
|
# - Logs debug information about the GitHub Action runner.
|
|
# - Installs Core npm dependencies.
|
|
# - Installs Gutenberg npm dependencies.
|
|
# - Runs the Gutenberg build process.
|
|
# - Builds WordPress to run from the relevant location (src or build).
|
|
# - Builds Gutenberg.
|
|
# - Ensures version-controlled files are not modified or deleted.
|
|
build-process-tests:
|
|
name: Gutenberg running from ${{ inputs.directory }} / ${{ inputs.os == 'macos-latest' && 'MacOS' || inputs.os == 'windows-latest' && 'Windows' || 'Linux' }}
|
|
runs-on: ${{ inputs.os }}
|
|
timeout-minutes: 30
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
with:
|
|
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
|
|
|
|
- name: Checkout Gutenberg plugin
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
with:
|
|
repository: 'WordPress/gutenberg'
|
|
path: ${{ env.GUTENBERG_DIRECTORY }}
|
|
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
cache: npm
|
|
cache-dependency-path: |
|
|
package-lock.json
|
|
${{ env.GUTENBERG_DIRECTORY }}/package-lock.json
|
|
|
|
- name: Log debug information
|
|
run: |
|
|
npm --version
|
|
node --version
|
|
curl --version
|
|
git --version
|
|
|
|
- name: Install Core Dependencies
|
|
run: npm ci
|
|
|
|
- name: Install Gutenberg Dependencies
|
|
run: npm ci
|
|
working-directory: ${{ env.GUTENBERG_DIRECTORY }}
|
|
|
|
- name: Build Gutenberg
|
|
run: npm run build
|
|
working-directory: ${{ env.GUTENBERG_DIRECTORY }}
|
|
|
|
- name: Build WordPress to run from ${{ inputs.directory }}
|
|
run: npm run build${{ inputs.directory == 'src' && ':dev' || '' }}
|
|
|
|
- name: Run Gutenberg build script after building Core to run from ${{ inputs.directory }}
|
|
run: npm run build
|
|
working-directory: ${{ env.GUTENBERG_DIRECTORY }}
|
|
|
|
- name: Ensure version-controlled files are not modified or deleted during building
|
|
run: git diff --exit-code
|