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