Skip to content

Commit

Permalink
Release NodeJS 22 Support (#44)
Browse files Browse the repository at this point in the history
* Update to NAN 2.19.0 - better support for Electron 29

* feat: support node abi 127 (Node v22) (#43)

* update `README`

* feat: support node abi 127 (Node v22)

Fixes #42

---------

Co-authored-by: Ben <[email protected]>
Co-authored-by: Northern Man <[email protected]>

* Build updates for warning messages

* Update Prepare prebuild environment.yml

* Update Prepare prebuild environment.yml

* Update Prepare prebuild environment.yml

* Update Prepare prebuild environment.yml

* Update Prepare prebuild environment.yml

* Update Prepare prebuild environment.yml

* drop older versions

* Fix MacOS Arm Build

* Update Prepare prebuild environment.yml

* Update Prepare prebuild environment.yml

* ModuleNotFoundError: No module named 'distutils'

* Reduce warning messages

* Update Prepare prebuild environment.yml

* Update Prepare prebuild environment.yml

* Update Prepare prebuild environment.yml

* Update dependencies

* Update Prepare prebuild environment.yml

* Rollback for this issue - prebuild/prebuildify#90

prebuild/prebuildify#90

* Update README.md

---------

Co-authored-by: Steffen Neubauer <[email protected]>
Co-authored-by: Ben <[email protected]>
  • Loading branch information
3 people authored Jun 7, 2024
1 parent 17b801e commit 5a21043
Show file tree
Hide file tree
Showing 8 changed files with 3,735 additions and 3,539 deletions.
124 changes: 70 additions & 54 deletions .github/workflows/Prepare prebuild environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,35 @@ on:
type: boolean

env:
oldNodeBuildTargets: -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 -t 15.0.0 -t 16.0.0 -t 17.0.1 -t 18.0.0
nodeBuildTargets: -t 19.0.0 -t 20.0.0 -t 21.0.0
oldElectronBuildTargets: -t 5.0.0 -t 6.0.0 -t 7.0.0 -t 8.0.0 -t 9.0.0 -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.2 -t 15.0.0 -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0
electronBuildTargets: -t 20.0.0 -t 21.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0 -t 25.0.0 -t 26.0.0 -t 27.0.0 -t 28.0.0 -t 29.0.0
winIA32nodeBuildTargets: -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 -t 15.0.0 -t 16.0.0 -t 17.0.1
winIA32electronBuildTargets: -t 20.0.0 -t 21.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0 -t 25.0.0 -t 26.0.0 -t 27.0.0 -t 28.0.0 -t 29.0.0
# Order reversed so newer versions are built first - Add new versions to the front (fail fast)
# electronBuildTargets version 28 has an issue
oldNodeBuildTargets: -t 18.0.0 -t 17.0.1 -t 16.0.0
nodeBuildTargets: -t 22.0.0 -t 21.0.0 -t 20.0.0 -t 19.0.0
oldElectronBuildTargets: -t 19.0.0 -t 18.0.0 -t 17.0.0 -t 16.0.0
electronBuildTargets: -t 29.0.0 -t 27.0.0 -t 26.0.0 -t 25.0.0 -t 24.0.0 -t 23.0.0 -t 22.0.0 -t 21.0.0 -t 20.0.0
winIA32nodeBuildTargets: -t 17.0.1 -t 16.0.0
winIA32electronBuildTargets: -t 29.0.0 -t 27.0.0 -t 26.0.0 -t 25.0.0 -t 24.0.0 -t 23.0.0 -t 22.0.0 -t 21.0.0 -t 20.0.0
ReleasePrebuildCount: 204
ReleasePrebuildifyCount: 84
ReleasePrebuildifyCount: 49

jobs:
Prepare_prebuild_environment:
name: Prepare prebuild environment ${{ github.ref_name }}
runs-on: ubuntu-latest
steps:
- name: Delete pr-* branches
uses: dawidd6/action-delete-branch@v3
uses: homebridge/action-delete-branch@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: "release-candidate"

- uses: actions/checkout@v4
- name: Create Branch
uses: peterjgrainger/action-create-branch@v2.2.0
uses: peterjgrainger/action-create-branch@v3.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: lts/*

Expand Down Expand Up @@ -70,6 +72,7 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: "release-candidate"
message: "Prepare prebuild environment ${{ github.ref_name }}"
rebase: true

prebuild:
name: ${{ matrix.name }} - Prebuild NPM and GitHub Release artifacts
Expand Down Expand Up @@ -102,35 +105,35 @@ jobs:
DOCKERFILE: Dockerfile.alpine
QEMU_ARCH: x86_64
CMD: BuildAllCMD
COUNT: 35
NPMCOUNT: 12
COUNT: 19
NPMCOUNT: 7

- name: linuxmusl-arm
os: ubuntu-latest
BASE_IMAGE: arm32v6/node:16-alpine
DOCKERFILE: Dockerfile.alpine
QEMU_ARCH: arm
CMD: BuildAllCMD
COUNT: 35
NPMCOUNT: 12
COUNT: 19
NPMCOUNT: 7

- name: linuxmusl-arm64
os: ubuntu-latest
BASE_IMAGE: arm64v8/node:16-alpine
DOCKERFILE: Dockerfile.alpine
QEMU_ARCH: aarch64
CMD: BuildAllCMD
COUNT: 35
NPMCOUNT: 12
COUNT: 19
NPMCOUNT: 7

- name: linux-arm
os: ubuntu-latest
BASE_IMAGE: balenalib/raspberry-pi-debian:buster
DOCKERFILE: Dockerfile.debian
QEMU_ARCH: arm
CMD: BuildAllCMD
COUNT: 34
NPMCOUNT: 12
COUNT: 19
NPMCOUNT: 7

# Builds for NodeJS 19+

Expand All @@ -140,26 +143,26 @@ jobs:
DOCKERFILE: Dockerfile.debian
QEMU_ARCH: x86_64
CMD: BuildNewCMD
COUNT: 11
NPMCOUNT: 3
COUNT: 12
NPMCOUNT: 4

- name: linux-ia32
os: ubuntu-latest
BASE_IMAGE: i386/debian:buster-slim
DOCKERFILE: Dockerfile.debian
QEMU_ARCH: i386
CMD: BuildNewCMD
COUNT: 11
NPMCOUNT: 3
COUNT: 12
NPMCOUNT: 4

- name: linux-arm64
os: ubuntu-latest
BASE_IMAGE: arm64v8/debian:buster-slim
DOCKERFILE: Dockerfile.debian
QEMU_ARCH: aarch64
CMD: BuildNewCMD
COUNT: 11
NPMCOUNT: 3
COUNT: 12
NPMCOUNT: 4

# Builds for NodeJS 18 or lower

Expand All @@ -169,59 +172,59 @@ jobs:
DOCKERFILE: Dockerfile.oldDebian
QEMU_ARCH: x86_64
CMD: BuildOldCMD
COUNT: 24
NPMCOUNT: 9
COUNT: 7
NPMCOUNT: 3

- name: linux-ia32-older
os: ubuntu-latest
BASE_IMAGE: i386/debian:9.6-slim
DOCKERFILE: Dockerfile.oldDebian
QEMU_ARCH: i386
CMD: BuildOldCMD
COUNT: 24
NPMCOUNT: 9
COUNT: 7
NPMCOUNT: 3

- name: linux-arm64-older
os: ubuntu-latest
BASE_IMAGE: arm64v8/debian:9.6-slim
DOCKERFILE: Dockerfile.oldDebian
QEMU_ARCH: aarch64
CMD: BuildOldCMD
COUNT: 24
NPMCOUNT: 9
COUNT: 7
NPMCOUNT: 3

# Other OS's

- name: darwin-x64
os: macOS-latest
COUNT: 35
os: macOS-13
COUNT: 19
NPMCOUNT: 11

- name: darwin-arm64
os: [self-hosted, macOS, ARM64]
COUNT: 35
os: macOS-14
COUNT: 19
NPMCOUNT: 11

- name: win32-ia32
os: windows-2019
arch: ia32
COUNT: 31
COUNT: 14
NPMCOUNT: 0

- name: win32-x64
os: windows-2019
arch: x64
COUNT: 35
COUNT: 19
NPMCOUNT: 0

steps:
- uses: actions/checkout@v4
with:
ref: "release-candidate"

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: lts/*

- name: get-npm-version
if: runner.os == 'Linux'
Expand All @@ -246,9 +249,9 @@ jobs:
echo "BuildNewCMD=\"./.prebuild/build.sh .prebuild/prebuild.js ${nodeBuildTargets} && \
./.prebuild/build.sh .prebuild/prebuildify.js ${nodeBuildTargets}&& \
./.prebuild/build.sh .prebuild/electron.js ${electronBuildTargets}\"" >> $GITHUB_ENV
echo "BuildAllCMD=\"./.prebuild/build.sh .prebuild/prebuild.js ${oldNodeBuildTargets} ${nodeBuildTargets} && \
./.prebuild/build.sh .prebuild/prebuildify.js ${oldNodeBuildTargets} ${nodeBuildTargets} && \
./.prebuild/build.sh .prebuild/electron.js ${oldElectronBuildTargets} ${electronBuildTargets}\"" >> $GITHUB_ENV
echo "BuildAllCMD=\"./.prebuild/build.sh .prebuild/prebuild.js ${nodeBuildTargets} ${oldNodeBuildTargets} && \
./.prebuild/build.sh .prebuild/prebuildify.js ${nodeBuildTargets} ${oldNodeBuildTargets} && \
./.prebuild/build.sh .prebuild/electron.js ${electronBuildTargets} ${oldElectronBuildTargets}\"" >> $GITHUB_ENV
echo "CMD=${{ matrix.CMD }}" >> $GITHUB_ENV
- name: Linux - Prep Build EXECCMD = ${{ env.CMD }}
Expand All @@ -271,16 +274,29 @@ jobs:
# Mac OS

- name: macOS - Prebuild Binaries
if: runner.os == 'macOS'
- name: macOS - Prebuild Binaries X64
if: ${{ (runner.os == 'macOS') && (runner.arch == 'X64') }}
run: |
python3 -m pip install packaging setuptools
npm ci --ignore-scripts
env JOBS=max node .prebuild/prebuild.js ${oldNodeBuildTargets} ${nodeBuildTargets}
env JOBS=max node .prebuild/electron.js ${oldElectronBuildTargets} ${electronBuildTargets}
env JOBS=max node .prebuild/prebuild.js ${nodeBuildTargets} ${oldNodeBuildTargets}
env JOBS=max node .prebuild/electron.js ${electronBuildTargets} ${oldElectronBuildTargets}
# buildify doesn't work on Mac due to missing spawn_helper
# env JOBS=max node .prebuild/buildify.js

- name: macOS - Prebuild Binaries ARM64
if: ${{ (runner.os == 'macOS') && (runner.arch == 'ARM64') }}
run: |
python3 -m venv build
source build/bin/activate
python3 -m pip install packaging setuptools
brew install python-setuptools
npm ci --ignore-scripts
env JOBS=max node .prebuild/prebuild.js ${nodeBuildTargets} ${oldNodeBuildTargets}
env JOBS=max node .prebuild/electron.js ${electronBuildTargets} ${oldElectronBuildTargets}
# buildify doesn't work on Mac due to missing spawn_helper
# env JOBS=max node .prebuild/buildify.js

# Windows

- name: Windows ia32 - Prebuild Binaries
Expand All @@ -289,15 +305,15 @@ jobs:
run: |
npm ci --ignore-scripts
env JOBS=max node_modules/.bin/prebuild ${winIA32nodeBuildTargets} --include-regex "\.(node|exe|dll|pdb)" --arch ${{ matrix.arch }}
env JOBS=max node_modules/.bin/prebuild ${oldElectronBuildTargets} ${winIA32electronBuildTargets} --include-regex "\.(node|exe|dll|pdb)" -r electron -a ${{ matrix.arch }}
env JOBS=max node_modules/.bin/prebuild ${winIA32electronBuildTargets} ${oldElectronBuildTargets} --include-regex "\.(node|exe|dll|pdb)" -r electron -a ${{ matrix.arch }}
- name: Windows x64 - Prebuild Binaries
if: ${{ (runner.os == 'Windows') && (matrix.arch == 'x64') }}
shell: bash
run: |
npm ci --ignore-scripts
env JOBS=max node_modules/.bin/prebuild ${oldNodeBuildTargets} ${nodeBuildTargets} --include-regex "\.(node|exe|dll|pdb)" --arch ${{ matrix.arch }}
env JOBS=max node_modules/.bin/prebuild ${oldElectronBuildTargets} ${electronBuildTargets} --include-regex "\.(node|exe|dll|pdb)" -r electron --arch ${{ matrix.arch }}
env JOBS=max node_modules/.bin/prebuild ${nodeBuildTargets} ${oldNodeBuildTargets} --include-regex "\.(node|exe|dll|pdb)" --arch ${{ matrix.arch }}
env JOBS=max node_modules/.bin/prebuild ${electronBuildTargets} ${oldElectronBuildTargets} --include-regex "\.(node|exe|dll|pdb)" -r electron --arch ${{ matrix.arch }}
# Start of Checks

Expand All @@ -310,7 +326,7 @@ jobs:
- name: "Check file existence"
id: check_files
uses: andstor/file-existence-action@v2
uses: andstor/file-existence-action@v3
with:
files: "prebuilds/*/node*node"

Expand All @@ -326,13 +342,13 @@ jobs:
run: sudo chown -R $USER:$USER .

- name: Commit & Push changes
uses: actions-js/push@be2c6e7c16dba301499992e84b3b32aaaa56507c
uses: actions-js/push@master
with:
author_name: ${{ github.actor }}
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: "release-candidate"
message: "Prebuilds for ${{ steps.package-version.outputs.current-version}} - ${{ matrix.name }}"
pull: true
rebase: true

publish:
name: Publish GitHub and NPM Release
Expand All @@ -346,7 +362,7 @@ jobs:
ref: "release-candidate"

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: "https://registry.npmjs.org"
Expand All @@ -367,7 +383,7 @@ jobs:
- name: Check Release prebuildify`s exist
shell: bash
run: |
fileCount=$(ls prebuilds/*/node*node | wc -l)
fileCount=$(ls prebuilds/*/*node | wc -l)
echo "Release Prebuild count ${fileCount}"
if [ "$fileCount" -ne ${ReleasePrebuildifyCount} ]; then echo "::error::Release Prebuildify count ${fileCount}, expected ${ReleasePrebuildifyCount}"; exit 1; else echo "::notice::Release Prebuildify count ${fileCount}, expected ${ReleasePrebuildifyCount}"; fi
Expand Down Expand Up @@ -410,7 +426,7 @@ jobs:

- name: "Check file existence"
id: check_files
uses: andstor/file-existence-action@v2
uses: andstor/file-existence-action@v3
with:
files: "prebuilds/*/node-pty-prebuilt-multiarch-*-node-*-darwin-arm64.tar.gz"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: lts

- name: Linux - Setup Dependencies
if: runner.os == 'Linux'
Expand Down
9 changes: 8 additions & 1 deletion .prebuild/abi_registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,12 @@
"lts": false,
"future": true,
"abi": "120"
},
{
"runtime": "node",
"target": "22.0.0",
"lts": false,
"future": true,
"abi": "127"
}
]
]
4 changes: 2 additions & 2 deletions .prebuild/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ echo
#node .prebuild/build.js
env JOBS=max node $*
echo
#env JOBS=max node .prebuild/prebuild.js -t 19.0.0 -t 20.0.0 -t 21.0.0
#env JOBS=max node .prebuild/prebuildify.js -t 19.0.0 -t 20.0.0 -t 21.0.0
#env JOBS=max node .prebuild/prebuild.js -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0
#env JOBS=max node .prebuild/prebuildify.js -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0

#env JOBS=max node .prebuild/prebuild.js -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 -t 15.0.0 -t 16.0.0 -t 17.0.1 -t 18.0.0
#env JOBS=max node .prebuild/prebuildify.js -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 -t 15.0.0 -t 16.0.0 -t 17.0.1 -t 18.0.0
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ If a corresponding prebuilt package is not found, `node-gyp` is invoked to build
| Linux (musl) | x64, armv6, aarch64 |
| Windows | ia32, x64 |

We only provide prebuilt binaries for Node.js 10 and Electron 5.0.0 or higher.
We only provide prebuilt binaries for Node.js 16 and Electron 16.0.0 or higher. Pls note that prebuilds for Electron 28 are not supplied due to build issues.

## Build / Package

Expand All @@ -56,10 +56,9 @@ When this occurs just re-run. This is due to concurrency issues between the step
A typical run has 3-4 steps fail.

1. Create branch `release-candidate` if not existing (the script deletes it before starting and will fail if it isn't present)
2. Start macOS ARM 64 local runner
3. Ensure version tag within package.json reflects version you want to publish, please note beta tags are added by the action.
4. Run Action `Run prebuild's and Create GitHub and NPM release`, and select branch you wish to publish, and if it needs to be BETA tagged and versioned
5. This will run for about an hour, and create a GitHub release with the prebuild artifacts attached, and a npm release with the prebuild artifacts attached
2. Ensure version tag within package.json reflects version you want to publish, please note beta tags are added by the action.
3. Run Action `Run prebuild's and Create GitHub and NPM release`, and select branch you wish to publish, and if it needs to be BETA tagged and versioned
4. This will run for about an hour, and create a GitHub release with the prebuild artifacts attached, and a npm release with the prebuild artifacts attached

## License

Expand Down
Loading

0 comments on commit 5a21043

Please sign in to comment.