Skip to content
Draft
Show file tree
Hide file tree
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
41 changes: 13 additions & 28 deletions .github/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,39 @@
name: 'Setup Node.js and install npm dependencies'
description: 'Configure Node.js and install npm dependencies while managing all aspects of caching.'
description: 'Configure Node.js and install npm dependencies.'
inputs:
node-version:
description: 'Optional. The Node.js version to use. When not specified, the version specified in .nvmrc will be used.'
required: false
type: string
cache:
description: 'Optional. Whether to restore and save the npm cache. Set to false in workflows that publish built assets, so a poisoned cache cannot reach a release.'
required: false
default: 'true'

runs:
using: 'composite'
steps:
- name: Use desired version of Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: ${{ inputs.node-version == '' && '.nvmrc' || '' }}
node-version: ${{ inputs.node-version }}
check-latest: true
cache: npm

- name: Get Node.js and npm version
id: node-version
run: |
echo "NODE_VERSION=$(node -v)" >> "$GITHUB_OUTPUT"
shell: bash
package-manager-cache: false

- name: Cache node_modules
id: cache-node_modules
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
- name: Set up npm
uses: ./.github/setup-npm
with:
path: '**/node_modules'
key: node_modules-${{ runner.os }}-${{ runner.arch }}-${{ steps.node-version.outputs.NODE_VERSION }}-${{ hashFiles('package-lock.json', 'patches/**') }}
cache: ${{ inputs.cache }}

# No node_modules cache on release branches: its cache-hit path replays postinstall
# scripts that older branches cannot run, so every branch installs the same way.
- name: Install npm dependencies
if: ${{ steps.cache-node_modules.outputs.cache-hit != 'true' }}
run: |
npm ci
shell: bash
- name: Upload npm logs as an artifact on failure
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: failure()
with:
name: npm-logs
path: C:\npm\cache\_logs

# On cache hit, we run the post-install script to match the native `npm ci` behavior.
# An example of this is to patch `node_modules` using patch-package.
- name: Post-install
if: ${{ steps.cache-node_modules.outputs.cache-hit == 'true' }}
run: |
# Run the post-install script for the root project.
npm run postinstall
# Run the post-install scripts for workspaces.
npx lerna run postinstall
shell: bash
6 changes: 6 additions & 0 deletions .github/workflows/build-plugin-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ jobs:
with:
node-version-file: '.nvmrc'
check-latest: true
package-manager-cache: false

- name: Set up npm
uses: ./.github/setup-npm
with:
cache: false

- name: Configure build for wordpress-develop
if: ${{ ! matrix.IS_GUTENBERG_PLUGIN }}
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/bundle-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ jobs:
with:
node-version-file: '.nvmrc'
check-latest: true
cache: npm
package-manager-cache: false

- name: Set up npm
uses: ./.github/setup-npm

- uses: preactjs/compressed-size-action@946a292cd35bd1088e0d7eb92b69d1a8d5b5d76a # v2.8.0
with:
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/create-block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@ jobs:
fail-fast: false
matrix:
event: ['${{ github.event_name }}']
node: ['20', '22', '24']
node: ['24']
os: ['macos-15', 'ubuntu-24.04', 'windows-2025']
exclude:
# On PRs: Only test Node 20 on Ubuntu
- event: 'pull_request'
node: '22'
- event: 'pull_request'
node: '24'
# On PRs: Only test on Ubuntu
- event: 'pull_request'
os: 'macos-15'
- event: 'pull_request'
Expand Down
106 changes: 0 additions & 106 deletions .github/workflows/rnmobile-android-runner.yml

This file was deleted.

116 changes: 0 additions & 116 deletions .github/workflows/rnmobile-ios-runner.yml

This file was deleted.

13 changes: 6 additions & 7 deletions .github/workflows/static-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ permissions: {}

jobs:
check:
name: All${{ (matrix.node != '20' || matrix.os != 'ubuntu-24.04') && format(' (Node.js {0} on {1})', matrix.node, contains(matrix.os, 'macos-') && 'MacOS' || contains(matrix.os, 'windows-') && 'Windows' || 'Linux') || '' }}
name: All${{ (matrix.node != '24' || matrix.os != 'ubuntu-24.04') && format(' (Node.js {0} on {1})', matrix.node, contains(matrix.os, 'macos-') && 'MacOS' || contains(matrix.os, 'windows-') && 'Windows' || 'Linux') || '' }}
runs-on: ${{ matrix.os }}
env:
NODE_OPTIONS: --max-old-space-size=4096
Expand All @@ -31,12 +31,10 @@ jobs:
strategy:
matrix:
event: ['${{ github.event_name }}']
node: ['20', '22', '24']
node: ['24']
os: ['macos-15', 'ubuntu-24.04', 'windows-2025']
exclude:
# On PRs: Only test Node 20 on Ubuntu and Windows
- event: 'pull_request'
node: '22'
# On PRs: Only test on Ubuntu and Windows
- event: 'pull_request'
os: 'macos-15'

Expand All @@ -50,9 +48,10 @@ jobs:
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: ${{ matrix.node }}
package-manager-cache: false

- name: Pin npm version for consistency
run: npm install -g npm@10
- name: Set up npm
uses: ./.github/setup-npm

- name: Npm install
# A "full" install is executed, since `npm ci` does not always exit
Expand Down
Loading
Loading