forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreusable-test-gutenberg-build-process.yml
More file actions
100 lines (86 loc) · 3.48 KB
/
reusable-test-gutenberg-build-process.yml
File metadata and controls
100 lines (86 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
##
# A reusable 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-24.04'
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'
# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}
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 }} / ${{ contains( inputs.os, 'macos-' ) && 'MacOS' || contains( inputs.os, 'windows-' ) && 'Windows' || 'Linux' }}
permissions:
contents: read
runs-on: ${{ inputs.os }}
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Checkout Gutenberg plugin
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: 'WordPress/gutenberg'
path: ${{ env.GUTENBERG_DIRECTORY }}
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
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 ${{ inputs.directory == 'src' && 'build:dev' || 'build' }}
- 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