Skip to content

Commit 1393041

Browse files
committed
feat(prebuild): support of Alpine binaries
- update dependencies - rework binding.gyp - rework msys bundle for Windows - add bundle for MUSL (Alpine) - rework bundle scripts and ci
1 parent 25fbac5 commit 1393041

31 files changed

+491
-723
lines changed

.github/workflows/ci.yaml

Lines changed: 67 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,108 @@
11
name: Test
2-
on:
3-
push:
4-
paths-ignore:
5-
- ".github/workflows/prebuild.yaml"
6-
pull_request:
7-
paths-ignore:
8-
- ".github/workflows/prebuild.yaml"
2+
3+
on: [ push ]
94

105
jobs:
11-
Linux:
12-
name: Test on Linux
6+
Debian:
137
runs-on: ubuntu-latest
148
strategy:
159
matrix:
16-
node: [18.12.0, 20.9.0]
10+
node: [ 18, 20 ]
11+
container:
12+
image: node:${{ matrix.node }}-slim
1713
steps:
18-
- uses: actions/setup-node@v4
19-
with:
20-
node-version: ${{ matrix.node }}
21-
- uses: actions/checkout@v4
14+
- name: Checkout
15+
uses: actions/checkout@v4
2216
- name: Install Dependencies
23-
run: |
24-
sudo apt update
25-
sudo apt install -y libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev librsvg2-dev
26-
- name: Install
17+
run: . ./prebuild/Debian/preinstall.sh
18+
- name: Build
2719
run: npm install --build-from-source
2820
- name: Test
2921
run: npm test
3022

31-
Windows:
32-
name: Test on Windows
33-
runs-on: windows-2019
23+
Alpine:
24+
runs-on: ubuntu-latest
3425
strategy:
3526
matrix:
36-
# FIXME: Node.js 20.9.0 is currently broken on Windows, in the `registerFont` test:
37-
# ENOENT: no such file or directory, lstat 'D:\a\node-canvas\node-canvas\examples\pfennigFont\pfennigMultiByte🚀.ttf'
38-
# ref: https://github.com/nodejs/node/issues/48673
39-
# ref: https://github.com/nodejs/node/pull/50650
40-
node: [18.12.0]
27+
node: [ 18, 20 ]
28+
container:
29+
image: node:${{ matrix.node }}-alpine
4130
steps:
42-
- uses: actions/setup-node@v4
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
- name: Install Dependencies
34+
run: . ./prebuild/Alpine/preinstall.sh
35+
- name: Build
36+
run: npm install --build-from-source
37+
- name: Test
38+
# some tests failed
39+
continue-on-error: true
40+
run: npm test
41+
42+
macOS:
43+
strategy:
44+
matrix:
45+
node: [ 18, 20 ]
46+
os:
47+
- runner: macos-latest
48+
arch: x64
49+
# - runner: macos-latest-xlarge
50+
# arch: arm64
51+
runs-on: ${{ matrix.os.runner }}
52+
steps:
53+
- name: Install Node.JS
54+
uses: actions/setup-node@v4
4355
with:
4456
node-version: ${{ matrix.node }}
45-
- uses: actions/checkout@v4
57+
- name: Checkout
58+
uses: actions/checkout@v4
4659
- name: Install Dependencies
47-
run: |
48-
Invoke-WebRequest "https://ftp-osl.osuosl.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip" -OutFile "gtk.zip"
49-
Expand-Archive gtk.zip -DestinationPath "C:\GTK"
50-
Invoke-WebRequest "https://downloads.sourceforge.net/project/libjpeg-turbo/2.0.4/libjpeg-turbo-2.0.4-vc64.exe" -OutFile "libjpeg.exe" -UserAgent NativeHost
51-
.\libjpeg.exe /S
52-
npm install -g node-gyp@8
53-
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
54-
- name: Install
60+
run: . ./prebuild/macOS/preinstall.sh
61+
- name: Build
5562
run: npm install --build-from-source
5663
- name: Test
5764
run: npm test
5865

59-
macOS:
60-
name: Test on macOS
61-
runs-on: macos-latest
66+
Windows:
67+
runs-on: windows-latest
6268
strategy:
6369
matrix:
64-
node: [18.12.0, 20.9.0]
70+
node: [ 18, 20 ]
6571
steps:
6672
- uses: actions/setup-node@v4
6773
with:
6874
node-version: ${{ matrix.node }}
6975
- uses: actions/checkout@v4
76+
- uses: msys2/setup-msys2@v2
77+
with:
78+
msystem: UCRT64
79+
path-type: inherit
7080
- name: Install Dependencies
71-
run: |
72-
brew update
73-
brew install python3 || : # python doesn't need to be linked
74-
brew install pkg-config cairo pango libpng jpeg giflib librsvg
75-
pip install setuptools
76-
- name: Install
81+
shell: msys2 {0}
82+
run: . ./prebuild/Windows/preinstall.sh
83+
- name: Build
84+
shell: msys2 {0}
7785
run: npm install --build-from-source
7886
- name: Test
87+
shell: msys2 {0}
88+
# FIXME: Node.js 20.x is currently broken on Windows, in the `registerFont` test:
89+
# ENOENT: no such file or directory, lstat 'node-canvas\examples\pfennigFont\pfennigMultiByte🚀.ttf'
90+
# ref: https://github.com/nodejs/node/issues/48673
91+
# ref: https://github.com/nodejs/node/pull/50650
92+
continue-on-error: true
7993
run: npm test
8094

8195
Lint:
8296
name: Lint
8397
runs-on: ubuntu-latest
98+
strategy:
99+
matrix:
100+
node: [ 20 ]
101+
container:
102+
image: node:${{ matrix.node }}-alpine
84103
steps:
85-
- uses: actions/setup-node@v4
86-
with:
87-
node-version: 20.9.0
88-
- uses: actions/checkout@v4
104+
- name: Checkout
105+
uses: actions/checkout@v4
89106
- name: Install
90107
run: npm install --ignore-scripts
91108
- name: Lint

0 commit comments

Comments
 (0)