-
Notifications
You must be signed in to change notification settings - Fork 2
109 lines (105 loc) · 3.7 KB
/
Copy pathpublish.yml
File metadata and controls
109 lines (105 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Publish Package to npmjs
on:
release:
types: [published]
permissions:
id-token: write # Required for OIDC
contents: read
jobs:
prebuilds:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: x64
- os: ubuntu-24.04-arm
arch: arm64
- os: macos-latest
arch: arm64
# macOS x64 prebuild publication is temporarily disabled.
# - os: macos-15-intel
# arch: x64
# Windows prebuild publication is temporarily disabled.
# - os: windows-latest
# arch: x64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
# Windows-only node-gyp setup stays disabled with the Windows matrix.
# - if: runner.os == 'Windows'
# run: npm install -g node-gyp
- run: bun install --ignore-scripts
- run: bun run prebuild
- run: node test/test.js
- run: bun ./test/test.js
# 曾发生过 Ubuntu 24.04 构建把最低要求抬到 GLIBC_2.38、导致
# Ubuntu 22.04/Debian 12 无法加载的回归;此处固定符号版本上限。
# 2.34 是现实基线:LZMA 多线程链接 pthread,在 glibc>=2.34 的
# 构建机上这些符号必然带 GLIBC_2.34 版本(v2.3.0 起即如此),
# 兼容 Ubuntu 22.04 / Debian 12 / RHEL 9。
- name: Check glibc symbol ceiling
if: runner.os == 'Linux'
run: |
set -euo pipefail
ceiling="2.34"
max=$(objdump -T prebuilds/*/*.node | grep -o 'GLIBC_[0-9.]*' | sed 's/GLIBC_//' | sort -Vu | tail -1)
test -n "$max"
echo "max required glibc: $max (ceiling: $ceiling)"
if [ "$(printf '%s\n%s\n' "$max" "$ceiling" | sort -V | tail -1)" != "$ceiling" ]; then
echo "::error::prebuild requires GLIBC_$max which exceeds the GLIBC_$ceiling ceiling"
exit 1
fi
# 用打包后的 tarball 独立验证:安装产物只含 prebuilds/,不得依赖
# 仓库里的 build/Release,同时钉死静态 require 的产物命名契约
- name: Smoke test packed tarball
run: |
set -euo pipefail
npm pack
mkdir -p "$RUNNER_TEMP/smoke"
cp node-hdiffpatch-*.tgz "$RUNNER_TEMP/smoke/"
cd "$RUNNER_TEMP/smoke"
npm init -y > /dev/null
npm install ./node-hdiffpatch-*.tgz
node -e "
const assert = require('assert');
const h = require('node-hdiffpatch');
const o = Buffer.from('hello world hello world');
const n = Buffer.from('hello brave new world!!');
const d = h.diff(o, n);
assert.deepStrictEqual(h.patch(o, d), n);
console.log('tarball smoke test ok');
"
- uses: actions/upload-artifact@v7.0.1
with:
name: prebuilds-${{ matrix.os }}-${{ matrix.arch }}
path: prebuilds
if-no-files-found: error
publish:
needs: prebuilds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/download-artifact@v7
with:
path: prebuilds
merge-multiple: true
- run: bun scripts/prepublish.ts
- run: npm publish --access public --tag latest --provenance