From 6a1e1553fdd4f950b766aaada0fff13ba434ef76 Mon Sep 17 00:00:00 2001 From: Rasmus Porsager Date: Fri, 25 Oct 2024 15:41:17 +0200 Subject: [PATCH 1/4] New release script for individual binary installs --- .github/workflows/build.yml | 12 +++--- .github/workflows/release.yml | 79 +++++++++++++++++++++++++++++++++++ src/uws.js | 2 +- 3 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 554c7c73..87fa759a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: - name: Update binaries run: | $ErrorActionPreference = 'SilentlyContinue' - git clone --recursive https://github.com/uNetworking/uWebSockets.js.git + git clone --recursive https://github.com/${{ github.repository }}.git cd uWebSockets.js nmake git fetch origin binaries:binaries @@ -23,7 +23,7 @@ jobs: git config --global user.email "alexhultman@gmail.com" git config --global user.name "Alex Hultman" git commit -a -m "[GitHub Actions] Updated windows-latest binaries" - git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" binaries + git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/${{ github.repository }}" binaries git checkout master -- tests/smoke.js npm install ws node tests/smoke.js || true @@ -42,7 +42,7 @@ jobs: sudo apt update || true brew install go || true sudo apt install -y g++-aarch64-linux-gnu || true - git clone --recursive https://github.com/uNetworking/uWebSockets.js.git + git clone --recursive https://github.com/${{ github.repository }}.git cd uWebSockets.js make git fetch origin binaries:binaries @@ -55,7 +55,7 @@ jobs: git config --global user.email "alexhultman@gmail.com" git config --global user.name "Alex Hultman" git commit -a -m "[GitHub Actions] Updated ${{ matrix.os }} binaries" || true - git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" binaries + git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/${{ github.repository }}" binaries git checkout master -- tests/smoke.js npm install ws node tests/smoke.js @@ -69,8 +69,8 @@ jobs: os: ubuntu22.04 steps: - name: Clone - run: git clone --recursive https://github.com/uNetworking/uWebSockets.js.git - uses: uraimo/run-on-arch-action@v3.0.0 + run: git clone --recursive https://github.com/${{ github.repository }}.git name: Compile binaries with: arch: ${{ matrix.arch }} @@ -97,4 +97,4 @@ jobs: git config --global user.name "Alex Hultman" git add *.node *.js git commit -a -m "[GitHub Actions] Updated linux-${{ matrix.arch }} binaries" || true - git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" binaries + git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/${{ github.repository }}" binaries diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..506cc3a2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,79 @@ +name: Release + +on: + workflow_dispatch: + inputs: + version: + description: 'Version number for the new release' + required: true + +jobs: + release: + if: github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + steps: + - name: Release new version + run: | + git config --global user.email "alexhultman@gmail.com" + git config --global user.name "Alex Hultman" + git clone --branch binaries --single-branch --depth 1 https://github.com/${{ github.repository }}.git + cd uWebSockets.js + + version="${{ github.event.inputs.version }}" + binaries=($(find . -type f -name "*.node" -exec basename {} .node \;)) + + declare -A abi_map=( + ["108"]="18.x" + ["115"]="20.x" + ["120"]="21.x" + ["127"]="22.x" + ["131"]="23.x" + ) + + for binary in "${binaries[@]}"; do + IFS='_' read -r os cpu abi <<< "${binary#uws_}" + node_version="${abi_map[$abi]}" + + echo '{ + "name": "@uws/'"$binary"'", + "version": "'"${version}"'", + "main": "uws.js", + "os": ["'"$os"'"], + "cpu": ["'"$cpu"'"], + "engines": { + "node": "'"$node_version"'" + } + }' > package.json + + echo 'module.exports = require("./'"$binary"'.node")' > uws.js + + rm ESM_wrapper.mjs index.d.ts + find . -name '*.node' ! -name "${binary}.node" -exec rm -f {} + + + git checkout --detach + git add -A + git commit -m "Released @uws/$binary with version $version" + git tag "v${version}-$binary" + git push "https://x-access-token:${{ secrets.SECRET }}@github.com/${{ github.repository }}" "v${version}-$binary" + git checkout binaries + done + + rm -rf *.node + + deps="" + for binary in "${binaries[@]}"; do + deps+="\"@uws/$binary\": \"github:porsager/uWebSockets.js#v${version}-$binary\",\n " + done + deps=${deps%,*} + + sed -i "s|\"optionalDependencies\": {}|\"optionalDependencies\": {\n $deps\n}|" package.json + sed -i "s|\"version\": \"[^\"]*\"|\"version\": \"${version}\"|g" package.json + sed -i "s|./uws_|@uws/uws_|g" uws.js + + git checkout --detach + git add package.json + git add *.node + git commit -m "Release $version" + + git tag "v$version" + git push "https://x-access-token:${{ secrets.SECRET }}@github.com/${{ github.repository }}" "v$version" diff --git a/src/uws.js b/src/uws.js index 045575a7..f7468c90 100644 --- a/src/uws.js +++ b/src/uws.js @@ -17,7 +17,7 @@ module.exports = (() => { try { - return require('./uws_' + process.platform + '_' + process.arch + '_' + process.versions.modules + '.node'); + return require('./uws_' + process.platform + '_' + process.arch + '_' + process.versions.modules); } catch (e) { throw new Error('This version of uWS.js (v20.52.0) supports only Node.js versions 20, 22, 23 and 24 on (glibc) Linux, macOS and Windows, on Tier 1 platforms (https://github.com/nodejs/node/blob/master/BUILDING.md#platform-list).\n\n' + e.toString()); } From 37a4e8c12a52ad594aa9248924fd0ff0e8a27a48 Mon Sep 17 00:00:00 2001 From: Rasmus Porsager Date: Thu, 8 May 2025 00:41:21 -0600 Subject: [PATCH 2/4] Add node 24 support --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 87fa759a..51368261 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,8 +69,8 @@ jobs: os: ubuntu22.04 steps: - name: Clone - - uses: uraimo/run-on-arch-action@v3.0.0 run: git clone --recursive https://github.com/${{ github.repository }}.git + - uses: uraimo/run-on-arch-action@v3.0.0 name: Compile binaries with: arch: ${{ matrix.arch }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 506cc3a2..a83808f8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,6 +28,7 @@ jobs: ["120"]="21.x" ["127"]="22.x" ["131"]="23.x" + ["137"]="24.x" ) for binary in "${binaries[@]}"; do From cbaf0143bee8e1634d600a442cce3136688ac0cf Mon Sep 17 00:00:00 2001 From: Rasmus Porsager Date: Thu, 28 Aug 2025 08:48:21 -0600 Subject: [PATCH 3/4] Update uWebSockets to wider limits --- uWebSockets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uWebSockets b/uWebSockets index c8da12b5..c847c6bb 160000 --- a/uWebSockets +++ b/uWebSockets @@ -1 +1 @@ -Subproject commit c8da12b537516489b2e01dacf4d836b5bc74e826 +Subproject commit c847c6bb07d67b7c555050196c526b27b2452b5f From b42f0fb3edc9019fa8170a87d33639fc509d556b Mon Sep 17 00:00:00 2001 From: Patrick Tamstrup Date: Thu, 13 Nov 2025 12:16:26 +0100 Subject: [PATCH 4/4] Add GitHub Actions workflow for FreeBSD build --- .github/workflows/freebsd.yml | 62 +++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/freebsd.yml diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml new file mode 100644 index 00000000..e44b35bf --- /dev/null +++ b/.github/workflows/freebsd.yml @@ -0,0 +1,62 @@ +name: Build/Release FreeBSD + +on: + push: + branches: [ master ] + workflow_dispatch: + +jobs: + build-freebsd: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + show-progress: false + - name: Build node modules + uses: vmactions/freebsd-vm@v1.2.6 + with: + copyback: false + run: | + set -e + set -o pipefail + + echo '#define __linux 1' > build.c.temp + cat build.c >> build.c.temp + mv build.c.temp build.c + sed -i.bak 's|#define OS "linux"|#define OS "freebsd"|' build.c && rm -f build.c.bak + sed -i.bak 's/clang-18/clang18/' build.c && rm -f build.c.bak + sed -i.bak 's/clang++-18/clang++18/' build.c && rm -f build.c.bak + + pkg install -y cmake llvm18 libuv v8 curl git \ + node22 npm-node22 || + echo 'cannot install packages, no privileges' + + make + + git config --global --add safe.directory /home/runner/work/uWebSockets.js/uWebSockets.js + git fetch --depth 1 origin binaries:binaries + + mkdir /tmp/node-binaries + cp dist/*.node /tmp/node-binaries/ + cp dist/*.js /tmp/node-binaries/ + + git reset --hard + + git checkout binaries + cp /tmp/node-binaries/*.node . + git add ./*.node + git checkout master docs/index.d.ts && mv docs/index.d.ts . + git add index.d.ts + git status + git rev-parse master > source_commit + git config --global user.email "patrick@tamstrup.dk" + git config --global user.name "Patrick Tamstrup" + git commit -m "[GitHub Actions] Updated FreeBSD binaries" || true + git push origin binaries + git checkout master -- tests/smoke.js + + npm install ws + node tests/smoke.js + +