-
Notifications
You must be signed in to change notification settings - Fork 179
/
nodejs-22.yaml
106 lines (94 loc) · 2.88 KB
/
nodejs-22.yaml
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
package:
name: nodejs-22
version: 22.0.0
epoch: 0
description: "JavaScript runtime built on V8 engine"
dependencies:
provides:
- nodejs=${{package.full-version}}
copyright:
- license: MIT
environment:
contents:
packages:
- brotli-dev
- build-base
- busybox
- c-ares-dev
- ca-certificates-bundle
- icu-dev
- libuv-dev
- linux-headers
- nghttp2-dev
- openssl-dev
- py3-jinja2
- py3-setuptools
- python3
- samurai
- wolfi-base
- zlib-dev
pipeline:
- uses: fetch
with:
uri: https://nodejs.org/dist/v${{package.version}}/node-v${{package.version}}.tar.gz
expected-sha256: 47cd57486564a8cb4728ec01f1d98b510c6547e19e96a7f7583cf882d803d0c6
- name: Configure and build
runs: |
# Add defines recommended in libuv readme.
common_flags="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
# Compiling with O2 instead of Os increases binary size by ~10%
# (53.1 MiB -> 58.6 MiB), but also increases performance by ~20%
# according to v8/web-tooling-benchmark. Node.js is quite huge anyway;
# there are better options for size constrained environments.
export CFLAGS="${CFLAGS/-Os/-O2} $common_flags"
export CXXFLAGS="${CXXFLAGS/-Os/-O2} $common_flags"
export CPPFLAGS="${CPPFLAGS/-Os/-O2} $common_flags"
python3 configure.py --prefix=/usr \
--shared-brotli \
--shared-zlib \
--shared-openssl \
--shared-cares \
--shared-nghttp2 \
--shared-libuv \
--ninja \
--openssl-use-def-ca-store \
--with-icu-default-data-dir=$(icu-config --icudatadir) \
--with-intl=system-icu \
--openssl-conf-name=openssl_conf \
--without-corepack
make BUILDTYPE=Release -j$(nproc)
- uses: autoconf/make
- uses: autoconf/make-install
- runs: |
make DESTDIR="$${{targets.destdir}}" install
- uses: strip
# Get rid of the bundled npm, we don't need it.
- runs: |
rm -rf "${{targets.destdir}}"/usr/lib/node_modules
rm "${{targets.destdir}}"/usr/bin/npm
rm "${{targets.destdir}}"/usr/bin/npx
update:
enabled: true
github:
identifier: nodejs/node
strip-prefix: v
use-tag: true
tag-filter: v22.
test:
pipeline:
- name: Verify Node.js Installation
runs: |
node --version || exit 1
- name: Execute Basic JavaScript
runs: |
cat <<'EOF' > test.js
console.log('Hello, World!');
EOF
node test.js | grep 'Hello, World!' || exit 1
- name: Test International Number Formatting
runs: |
cat <<'EOF' > testIntl.js
console.log(new Intl.NumberFormat('en-EN').format(1234.56));
console.log(new Intl.NumberFormat('de-DE').format(1234.56));
EOF
node testIntl.js | grep '1,234.56' && node testIntl.js | grep '1.234,56' || exit 1