From 6ea8607716c3df122b386ec41ca1971d353e4a88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Fri, 24 May 2024 12:32:50 +0200 Subject: [PATCH] ci: Switch to Node.js 20 by default. Add initial support for Node.js 22 (#9501) --- .../workflows/check-documentation-urls.yml | 4 +-- .github/workflows/check-pr-title.yml | 4 +-- .github/workflows/check-tests.yml | 4 +-- .github/workflows/chromatic.yml | 4 +-- .github/workflows/ci-master.yml | 27 +++++++------------ .github/workflows/ci-postgres-mysql.yml | 16 +++++------ .github/workflows/ci-pull-requests.yml | 16 +++++------ .github/workflows/docker-base-image.yml | 3 ++- .github/workflows/release-create-pr.yml | 4 +-- .github/workflows/release-publish.yml | 4 +-- .github/workflows/release-push-to-channel.yml | 4 +-- .github/workflows/test-workflows.yml | 4 +-- .github/workflows/units-tests-reusable.yml | 4 +-- CONTRIBUTING.md | 2 +- docker/images/n8n-base/Dockerfile | 2 +- docker/images/n8n-custom/Dockerfile | 2 +- docker/images/n8n/Dockerfile | 2 +- packages/cli/bin/n8n | 4 +-- 18 files changed, 50 insertions(+), 60 deletions(-) diff --git a/.github/workflows/check-documentation-urls.yml b/.github/workflows/check-documentation-urls.yml index a667b4088c..34db00aa9b 100644 --- a/.github/workflows/check-documentation-urls.yml +++ b/.github/workflows/check-documentation-urls.yml @@ -17,9 +17,9 @@ jobs: - uses: actions/checkout@v4.1.1 - run: corepack enable - - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: 18.x + node-version: 20.x cache: 'pnpm' - name: Install dependencies diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index a66ae1232f..add6e858a3 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -19,9 +19,9 @@ jobs: uses: actions/checkout@v4.1.1 - run: corepack enable - - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: 18.x + node-version: 20.x cache: 'pnpm' - name: Install dependencies diff --git a/.github/workflows/check-tests.yml b/.github/workflows/check-tests.yml index 30577bdc56..97f380974a 100644 --- a/.github/workflows/check-tests.yml +++ b/.github/workflows/check-tests.yml @@ -20,9 +20,9 @@ jobs: fetch-depth: 0 - name: Use Node.js - uses: actions/setup-node@v4.0.1 + uses: actions/setup-node@v4.0.2 with: - node-version: 18.x + node-version: 20.x - run: npm install --prefix=.github/scripts --no-package-lock diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 47894c53d2..4f041d8526 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -15,9 +15,9 @@ jobs: with: fetch-depth: 0 - run: corepack enable - - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: 18.x + node-version: 20.x cache: 'pnpm' - run: pnpm install --frozen-lockfile diff --git a/.github/workflows/ci-master.yml b/.github/workflows/ci-master.yml index 41ee830bd5..0ef88e4099 100644 --- a/.github/workflows/ci-master.yml +++ b/.github/workflows/ci-master.yml @@ -9,20 +9,15 @@ jobs: install-and-build: runs-on: ubuntu-latest - timeout-minutes: 30 - - strategy: - matrix: - node-version: [18.x, 20.x] + timeout-minutes: 10 steps: - uses: actions/checkout@v4.1.1 - run: corepack enable - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: ${{ matrix.node-version }} + node-version: 20.x cache: pnpm - name: Install dependencies @@ -35,7 +30,7 @@ jobs: uses: actions/cache/save@v4.0.0 with: path: ./packages/**/dist - key: ${{ github.sha }}-base:${{ matrix.node-version }}-test-lint + key: ${{ github.sha }}-base:build unit-test: name: Unit tests @@ -43,20 +38,17 @@ jobs: needs: install-and-build strategy: matrix: - node-version: [18.x, 20.x] + node-version: [18.x, 20.x, 22.x] with: ref: ${{ inputs.branch }} nodeVersion: ${{ matrix.node-version }} - cacheKey: ${{ github.sha }}-base:${{ matrix.node-version }}-test-lint + cacheKey: ${{ github.sha }}-base:build collectCoverage: true lint: name: Lint changes runs-on: ubuntu-latest needs: install-and-build - strategy: - matrix: - node-version: [18.x, 20.x] steps: - uses: actions/checkout@v4.1.1 with: @@ -64,10 +56,9 @@ jobs: ref: ${{ inputs.branch }} - run: corepack enable - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: ${{ matrix.node-version }} + node-version: 20.x cache: pnpm - name: Install dependencies @@ -77,7 +68,7 @@ jobs: uses: actions/cache/restore@v4.0.0 with: path: ./packages/**/dist - key: ${{ github.sha }}-base:${{ matrix.node-version }}-test-lint + key: ${{ github.sha }}-base:build - name: Lint env: diff --git a/.github/workflows/ci-postgres-mysql.yml b/.github/workflows/ci-postgres-mysql.yml index 9cf864b707..16d446cc92 100644 --- a/.github/workflows/ci-postgres-mysql.yml +++ b/.github/workflows/ci-postgres-mysql.yml @@ -20,9 +20,9 @@ jobs: steps: - uses: actions/checkout@v4.1.1 - run: corepack enable - - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: 18.x + node-version: 20.x cache: 'pnpm' - run: pnpm install --frozen-lockfile @@ -46,9 +46,9 @@ jobs: steps: - uses: actions/checkout@v4.1.1 - run: corepack enable - - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: 18.x + node-version: 20.x cache: 'pnpm' - run: pnpm install --frozen-lockfile @@ -72,9 +72,9 @@ jobs: steps: - uses: actions/checkout@v4.1.1 - run: corepack enable - - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: 18.x + node-version: 20.x cache: 'pnpm' - run: pnpm install --frozen-lockfile @@ -106,9 +106,9 @@ jobs: steps: - uses: actions/checkout@v4.1.1 - run: corepack enable - - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: 18.x + node-version: 20.x cache: 'pnpm' - run: pnpm install --frozen-lockfile diff --git a/.github/workflows/ci-pull-requests.yml b/.github/workflows/ci-pull-requests.yml index 17bfb05891..d467189d76 100644 --- a/.github/workflows/ci-pull-requests.yml +++ b/.github/workflows/ci-pull-requests.yml @@ -13,10 +13,9 @@ jobs: ref: refs/pull/${{ github.event.pull_request.number }}/merge - run: corepack enable - - name: Use Node.js 18 - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: 18.x + node-version: 20.x cache: pnpm - name: Install dependencies @@ -29,7 +28,7 @@ jobs: uses: actions/cache/save@v4.0.0 with: path: ./packages/**/dist - key: ${{ github.sha }}-base:18-test-lint + key: ${{ github.sha }}-base:build unit-test: name: Unit tests @@ -37,7 +36,7 @@ jobs: needs: install with: ref: refs/pull/${{ github.event.pull_request.number }}/merge - cacheKey: ${{ github.sha }}-base:18-test-lint + cacheKey: ${{ github.sha }}-base:build lint: name: Lint changes @@ -50,10 +49,9 @@ jobs: ref: refs/pull/${{ github.event.pull_request.number }}/merge - run: corepack enable - - name: Use Node.js 18 - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: 18.x + node-version: 20.x cache: pnpm - name: Install dependencies @@ -63,7 +61,7 @@ jobs: uses: actions/cache/restore@v4.0.0 with: path: ./packages/**/dist - key: ${{ github.sha }}-base:18-test-lint + key: ${{ github.sha }}-base:build - name: Lint run: pnpm lint diff --git a/.github/workflows/docker-base-image.yml b/.github/workflows/docker-base-image.yml index 1913828f78..c32160e763 100644 --- a/.github/workflows/docker-base-image.yml +++ b/.github/workflows/docker-base-image.yml @@ -7,10 +7,11 @@ on: description: 'Node.js version to build this image with.' type: choice required: true - default: '18' + default: '20' options: - '18' - '20' + - '22' jobs: build: diff --git a/.github/workflows/release-create-pr.yml b/.github/workflows/release-create-pr.yml index 612ef87920..a17fa1bf89 100644 --- a/.github/workflows/release-create-pr.yml +++ b/.github/workflows/release-create-pr.yml @@ -36,9 +36,9 @@ jobs: ref: ${{ github.event.inputs.base-branch }} - run: corepack enable - - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: 18.x + node-version: 20.x - run: npm install --prefix=.github/scripts --no-package-lock diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index f63166b6b5..d02c52c364 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -24,9 +24,9 @@ jobs: fetch-depth: 0 - run: corepack enable - - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: 18.x + node-version: 20.x cache: 'pnpm' - run: pnpm install --frozen-lockfile diff --git a/.github/workflows/release-push-to-channel.yml b/.github/workflows/release-push-to-channel.yml index 8f87593865..3eda6d4ebb 100644 --- a/.github/workflows/release-push-to-channel.yml +++ b/.github/workflows/release-push-to-channel.yml @@ -22,9 +22,9 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: - - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: 18.x + node-version: 20.x - run: | echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc npm dist-tag add n8n@${{ github.event.inputs.version }} ${{ github.event.inputs.release-channel }} diff --git a/.github/workflows/test-workflows.yml b/.github/workflows/test-workflows.yml index 7856b42f4f..8ba22b590c 100644 --- a/.github/workflows/test-workflows.yml +++ b/.github/workflows/test-workflows.yml @@ -26,9 +26,9 @@ jobs: - run: corepack enable working-directory: n8n - - uses: actions/setup-node@v4.0.1 + - uses: actions/setup-node@v4.0.2 with: - node-version: 18.x + node-version: 20.x cache: 'pnpm' cache-dependency-path: 'n8n/pnpm-lock.yaml' diff --git a/.github/workflows/units-tests-reusable.yml b/.github/workflows/units-tests-reusable.yml index a6f7588ab9..5ad5c24f71 100644 --- a/.github/workflows/units-tests-reusable.yml +++ b/.github/workflows/units-tests-reusable.yml @@ -12,7 +12,7 @@ on: description: 'Version of node to use.' required: false type: string - default: '18.x' + default: 20.x cacheKey: description: 'Cache key for modules and build artifacts.' required: false @@ -37,7 +37,7 @@ jobs: - run: corepack enable - name: Use Node.js ${{ inputs.nodeVersion }} - uses: actions/setup-node@v4.0.1 + uses: actions/setup-node@v4.0.2 with: node-version: ${{ inputs.nodeVersion }} cache: pnpm diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7480e60131..66667caef5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -64,7 +64,7 @@ dependencies are installed and the packages get linked correctly. Here's a short #### Node.js -[Node.js](https://nodejs.org/en/) version 16.9 or newer is required for development purposes. +[Node.js](https://nodejs.org/en/) version 18.10 or newer is required for development purposes. #### pnpm diff --git a/docker/images/n8n-base/Dockerfile b/docker/images/n8n-base/Dockerfile index 1a3236fae5..aee2028ae2 100644 --- a/docker/images/n8n-base/Dockerfile +++ b/docker/images/n8n-base/Dockerfile @@ -1,4 +1,4 @@ -ARG NODE_VERSION=18 +ARG NODE_VERSION=20 # 1. Use a builder step to download various dependencies FROM node:${NODE_VERSION}-alpine as builder diff --git a/docker/images/n8n-custom/Dockerfile b/docker/images/n8n-custom/Dockerfile index ed98f852fa..d9d2171084 100644 --- a/docker/images/n8n-custom/Dockerfile +++ b/docker/images/n8n-custom/Dockerfile @@ -1,4 +1,4 @@ -ARG NODE_VERSION=18 +ARG NODE_VERSION=20 # 1. Create an image to build n8n FROM --platform=linux/amd64 n8nio/base:${NODE_VERSION} as builder diff --git a/docker/images/n8n/Dockerfile b/docker/images/n8n/Dockerfile index af7803820c..d26c8c34d8 100644 --- a/docker/images/n8n/Dockerfile +++ b/docker/images/n8n/Dockerfile @@ -1,4 +1,4 @@ -ARG NODE_VERSION=18 +ARG NODE_VERSION=20 FROM n8nio/base:${NODE_VERSION} ARG N8N_VERSION diff --git a/packages/cli/bin/n8n b/packages/cli/bin/n8n index 005cd983cf..2e78f0bdb9 100755 --- a/packages/cli/bin/n8n +++ b/packages/cli/bin/n8n @@ -21,10 +21,10 @@ if (process.argv.length === 2) { const nodeVersion = process.versions.node; const nodeVersionMajor = require('semver').major(nodeVersion); -if (![18, 20].includes(nodeVersionMajor)) { +if (![18, 20, 22].includes(nodeVersionMajor)) { console.log(` Your Node.js version (${nodeVersion}) is currently not supported by n8n. - Please use Node.js v18 (recommended), or v20 instead! + Please use Node.js v18 (recommended), v20, or v22 instead! `); process.exit(1); }