Skip to content

Shadow: Add a PHP helper for block support classes and styles #188784

Shadow: Add a PHP helper for block support classes and styles

Shadow: Add a PHP helper for block support classes and styles #188784

Workflow file for this run

name: Create Block
on:
pull_request:
push:
branches:
- trunk
- 'release/[0-9]+.[0-9]'
- 'wp/[0-9]+.[0-9]'
- wp/latest
- wp/next
# 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
# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}
jobs:
checks:
name: Checks w/Node.js ${{ matrix.node }} on ${{ contains( matrix.os, 'macos-' ) && 'MacOS' || contains( matrix.os, 'windows-' ) && 'Windows' || 'Linux' }}
runs-on: ${{ matrix.os }}
permissions:
contents: read
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
event: ['${{ github.event_name }}']
node: ['24', '26']
os: ['macos-15', 'ubuntu-24.04', 'windows-2025']
exclude:
# Only test Node 24 on Ubuntu for pull requests.
- event: 'pull_request'
node: '26'
- event: 'pull_request'
os: 'macos-15'
- event: 'pull_request'
os: 'windows-2025'
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
with:
node-version: ${{ matrix.node }}
- name: Create block
run: npm run test:create-block
packed-package:
name: Packed package w/Node.js ${{ matrix.node }}
runs-on: ubuntu-24.04
permissions:
contents: read
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
node: ['minimum']
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Resolve the Node.js version
id: node
env:
NODE_VERSION: ${{ matrix.node }}
run: |
if [ "$NODE_VERSION" = 'minimum' ]; then
NODE_VERSION="$(node --print 'require("./packages/create-block/package.json").engines.node.replace(/^>=/, "")')"
fi
echo "version=$NODE_VERSION" >> "$GITHUB_OUTPUT"
- name: Use Node.js ${{ steps.node.outputs.version }}
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ steps.node.outputs.version }}
package-manager-cache: false
- name: Test the packed package
working-directory: ${{ runner.temp }}
run: |
echo "Node version: $(node --version)"
echo "npm version: $(npm --version)"
npm pack "$GITHUB_WORKSPACE/packages/create-block" --pack-destination "$RUNNER_TEMP"
mkdir create-block-consumer
cd create-block-consumer
npm init --yes
npm install "$RUNNER_TEMP"/wordpress-create-block-*.tgz
npm exec --no -- wp-create-block runtime-floor --no-wp-scripts
test -f runtime-floor/src/runtime-floor/block.json