-
Notifications
You must be signed in to change notification settings - Fork 2
94 lines (91 loc) · 3.18 KB
/
Copy pathci.yml
File metadata and controls
94 lines (91 loc) · 3.18 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
name: Test
on:
push:
branches: [main]
pull_request:
jobs:
# engines 声明 >=14.17.0:用新工具链构建(N-API 8,ABI 稳定),
# 再切到最低支持的 Node 运行时跑完整测试,保证契约真实被测过
engines-floor:
runs-on: ubuntu-latest
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
- run: bun install --ignore-scripts
- run: bun run prebuild
- uses: actions/setup-node@v6
with:
node-version: 14.17.0
- run: node --version && node test/test.js
test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- ubuntu-24.04-arm
- macos-latest
# macOS x64 prebuild is temporarily unsupported.
# - macos-15-intel
# Windows prebuild is temporarily unsupported; keep it out of CI
# until a Windows runtime is needed by a production consumer.
# - windows-latest
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
# 与 publish 一致:固定 Linux prebuild 的 glibc 符号版本上限
# (2.34 基线依据见 publish.yml,兼容 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
# 安装 npm pack 产物并在无 build/Release 的环境加载,验证 prebuilds
# 命名契约与 files 白名单
- 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');
"