| 
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 |  | -        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  | 
27 | 19 |         run: npm install --build-from-source  | 
28 | 20 |       - name: Test  | 
29 | 21 |         run: npm test  | 
30 | 22 | 
 
  | 
31 |  | -  Windows:  | 
32 |  | -    name: Test on Windows  | 
33 |  | -    runs-on: windows-2019  | 
 | 23 | +  Alpine:  | 
 | 24 | +    runs-on: ubuntu-latest  | 
34 | 25 |     strategy:  | 
35 | 26 |       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  | 
41 | 30 |     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  | 
43 | 55 |         with:  | 
44 | 56 |           node-version: ${{ matrix.node }}  | 
45 |  | -      - uses: actions/checkout@v4  | 
 | 57 | +      - name: Checkout  | 
 | 58 | +        uses: actions/checkout@v4  | 
46 | 59 |       - 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  | 
55 | 62 |         run: npm install --build-from-source  | 
56 | 63 |       - name: Test  | 
57 | 64 |         run: npm test  | 
58 | 65 | 
 
  | 
59 |  | -  macOS:  | 
60 |  | -    name: Test on macOS  | 
61 |  | -    runs-on: macos-latest  | 
 | 66 | +  Windows:  | 
 | 67 | +    runs-on: windows-latest  | 
62 | 68 |     strategy:  | 
63 | 69 |       matrix:  | 
64 |  | -        node: [18.12.0, 20.9.0]  | 
 | 70 | +        node: [ 18, 20 ]  | 
65 | 71 |     steps:  | 
66 | 72 |       - uses: actions/setup-node@v4  | 
67 | 73 |         with:  | 
68 | 74 |           node-version: ${{ matrix.node }}  | 
69 | 75 |       - uses: actions/checkout@v4  | 
 | 76 | +      - uses: msys2/setup-msys2@v2  | 
 | 77 | +        with:  | 
 | 78 | +          msystem: UCRT64  | 
 | 79 | +          path-type: inherit  | 
70 | 80 |       - 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}  | 
77 | 85 |         run: npm install --build-from-source  | 
78 | 86 |       - 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  | 
79 | 93 |         run: npm test  | 
80 | 94 | 
 
  | 
81 | 95 |   Lint:  | 
82 | 96 |     name: Lint  | 
83 | 97 |     runs-on: ubuntu-latest  | 
 | 98 | +    strategy:  | 
 | 99 | +      matrix:  | 
 | 100 | +        node: [ 20 ]  | 
 | 101 | +    container:  | 
 | 102 | +      image: node:${{ matrix.node }}-alpine  | 
84 | 103 |     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  | 
89 | 106 |       - name: Install  | 
90 | 107 |         run: npm install --ignore-scripts  | 
91 | 108 |       - name: Lint  | 
 | 
0 commit comments