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