|
1 | 1 | 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 ] |
9 | 4 |
|
10 | 5 | jobs:
|
11 |
| - Linux: |
12 |
| - name: Test on Linux |
| 6 | + Debian: |
13 | 7 | runs-on: ubuntu-latest
|
14 | 8 | strategy:
|
15 | 9 | matrix:
|
16 |
| - node: [18.12.0, 20.9.0] |
| 10 | + node: [ 18, 20 ] |
| 11 | + container: |
| 12 | + image: node:${{ matrix.node }}-slim |
17 | 13 | 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 |
22 | 16 | - name: Install Dependencies
|
23 | 17 | run: |
|
24 |
| - sudo apt update |
25 |
| - sudo apt install -y libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev librsvg2-dev |
26 |
| - - name: Install |
| 18 | + apt update |
| 19 | + apt install -y build-essential libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev librsvg2-dev libpixman-1-dev |
| 20 | + - name: Build |
27 | 21 | run: npm install --build-from-source
|
28 | 22 | - name: Test
|
29 | 23 | run: npm test
|
30 | 24 |
|
31 |
| - Windows: |
32 |
| - name: Test on Windows |
33 |
| - runs-on: windows-2019 |
| 25 | + Alpine: |
| 26 | + runs-on: ubuntu-latest |
34 | 27 | strategy:
|
35 | 28 | 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] |
| 29 | + node: [ 18, 20 ] |
| 30 | + container: |
| 31 | + image: node:${{ matrix.node }}-alpine |
41 | 32 | steps:
|
42 |
| - - uses: actions/setup-node@v4 |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@v4 |
| 35 | + - name: Install Dependencies |
| 36 | + run: apk --no-cache add build-base cairo-dev jpeg-dev pango-dev giflib-dev librsvg-dev pixman-dev |
| 37 | + - name: Build |
| 38 | + run: npm install --build-from-source |
| 39 | + - name: Test |
| 40 | + # some tests failed |
| 41 | + continue-on-error: true |
| 42 | + run: npm test |
| 43 | + |
| 44 | + macOS: |
| 45 | + strategy: |
| 46 | + matrix: |
| 47 | + node: [ 18, 20 ] |
| 48 | + os: |
| 49 | + - runner: macos-latest |
| 50 | + arch: x64 |
| 51 | + # - runner: macos-latest-xlarge |
| 52 | + # arch: arm64 |
| 53 | + runs-on: ${{ matrix.os.runner }} |
| 54 | + steps: |
| 55 | + - name: Install Node.JS |
| 56 | + uses: actions/setup-node@v4 |
43 | 57 | with:
|
44 | 58 | node-version: ${{ matrix.node }}
|
45 |
| - - uses: actions/checkout@v4 |
| 59 | + - name: Checkout |
| 60 | + uses: actions/checkout@v4 |
46 | 61 | - 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 |
| 62 | + run: brew install pkg-config cairo pango libpng giflib librsvg pixman |
| 63 | + - name: Build |
55 | 64 | run: npm install --build-from-source
|
56 | 65 | - name: Test
|
57 | 66 | run: npm test
|
58 | 67 |
|
59 |
| - macOS: |
60 |
| - name: Test on macOS |
61 |
| - runs-on: macos-latest |
| 68 | + Windows: |
| 69 | + runs-on: windows-latest |
62 | 70 | strategy:
|
63 | 71 | matrix:
|
64 |
| - node: [18.12.0, 20.9.0] |
| 72 | + node: [ 18, 20 ] |
65 | 73 | steps:
|
66 | 74 | - uses: actions/setup-node@v4
|
67 | 75 | with:
|
68 | 76 | node-version: ${{ matrix.node }}
|
69 | 77 | - uses: actions/checkout@v4
|
| 78 | + - uses: msys2/setup-msys2@v2 |
| 79 | + with: |
| 80 | + msystem: UCRT64 |
| 81 | + path-type: inherit |
70 | 82 | - name: Install Dependencies
|
| 83 | + shell: msys2 {0} |
71 | 84 | 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 |
| 85 | + prefix=${MSYSTEM,,} |
| 86 | + arch=${MSYSTEM_CARCH} |
| 87 | + |
| 88 | + pacman --noconfirm --needed -S \ |
| 89 | + ${prefix}/mingw-w64-ucrt-${arch}-binutils \ |
| 90 | + ${prefix}/mingw-w64-ucrt-${arch}-tools \ |
| 91 | + ${prefix}/mingw-w64-ucrt-${arch}-libjpeg-turbo \ |
| 92 | + ${prefix}/mingw-w64-ucrt-${arch}-pango \ |
| 93 | + ${prefix}/mingw-w64-ucrt-${arch}-cairo \ |
| 94 | + ${prefix}/mingw-w64-ucrt-${arch}-giflib \ |
| 95 | + ${prefix}/mingw-w64-ucrt-${arch}-harfbuzz \ |
| 96 | + ${prefix}/mingw-w64-ucrt-${arch}-freetype \ |
| 97 | + ${prefix}/mingw-w64-ucrt-${arch}-fontconfig \ |
| 98 | + ${prefix}/mingw-w64-ucrt-${arch}-librsvg \ |
| 99 | + ${prefix}/mingw-w64-ucrt-${arch}-libxml2 |
| 100 | + |
| 101 | + libs="cairo-2 png16-16 jpeg-8 pango-1.0-0 pangocairo-1.0-0 gobject-2.0-0 glib-2.0-0 turbojpeg gif-7 freetype-6 rsvg-2-2" |
| 102 | + for lib in $libs; do |
| 103 | + gendef /${prefix}/bin/lib$lib.dll > /dev/null 2>&1 || { |
| 104 | + echo "could not find lib$lib.dll, have to skip "; |
| 105 | + continue; |
| 106 | + } |
| 107 | + dlltool -d lib$lib.def -l /${prefix}/lib/lib$lib.lib > /dev/null 2>&1 || { |
| 108 | + echo "could not create dll for lib$lib.dll"; |
| 109 | + continue; |
| 110 | + } |
| 111 | + echo "created lib$lib.lib from lib$lib.dll"; |
| 112 | + rm lib$lib.def |
| 113 | + done |
| 114 | + - name: Build |
| 115 | + shell: msys2 {0} |
77 | 116 | run: npm install --build-from-source
|
78 | 117 | - name: Test
|
| 118 | + shell: msys2 {0} |
| 119 | + # FIXME: Node.js 20.x is currently broken on Windows, in the `registerFont` test: |
| 120 | + # ENOENT: no such file or directory, lstat 'node-canvas\examples\pfennigFont\pfennigMultiByte🚀.ttf' |
| 121 | + # ref: https://github.com./nodejs/node/issues/48673 |
| 122 | + # ref: https://github.com./nodejs/node/pull/50650 |
| 123 | + continue-on-error: true |
79 | 124 | run: npm test
|
80 | 125 |
|
81 | 126 | Lint:
|
82 | 127 | name: Lint
|
83 | 128 | runs-on: ubuntu-latest
|
| 129 | + strategy: |
| 130 | + matrix: |
| 131 | + node: [ 20 ] |
| 132 | + container: |
| 133 | + image: node:${{ matrix.node }}-slim |
84 | 134 | steps:
|
85 |
| - - uses: actions/setup-node@v4 |
86 |
| - with: |
87 |
| - node-version: 20.9.0 |
88 |
| - - uses: actions/checkout@v4 |
| 135 | + - name: Checkout |
| 136 | + uses: actions/checkout@v4 |
89 | 137 | - name: Install
|
90 | 138 | run: npm install --ignore-scripts
|
91 | 139 | - name: Lint
|
|
0 commit comments