|
| 1 | +# This workflow just installs canvas and tests it. |
| 2 | + |
| 3 | +name: Test Prebuilds |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + os: |
| 8 | + description: 'Target os' |
| 9 | + required: true |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - '["ubuntu-latest"]' |
| 13 | + - '["windows-latest"]' |
| 14 | + - '["macos-13"]' |
| 15 | + - '["macos-latest"]' |
| 16 | + - '["ubuntu-latest", "windows-latest", "macos-13", "macos-latest"]' |
| 17 | + default: '["ubuntu-latest", "windows-latest", "macos-13", "macos-latest"]' |
| 18 | + canvas: |
| 19 | + description: 'Target node-canvas version' |
| 20 | + required: true |
| 21 | + type: choice |
| 22 | + options: |
| 23 | + - '["vdev"]' |
| 24 | + - '["v3.0.0-rc2"]' |
| 25 | + - '["vdev", "v3.0.0-rc2"]' |
| 26 | + default: '["vdev", "v3.0.0-rc2"]' |
| 27 | + node: |
| 28 | + description: 'Target node version' |
| 29 | + required: true |
| 30 | + type: choice |
| 31 | + options: |
| 32 | + - '["18"]' |
| 33 | + - '["20"]' |
| 34 | + - '["21"]' |
| 35 | + - '["22"]' |
| 36 | + - '["18", "20", "22"]' |
| 37 | + default: '["18", "20", "22"]' |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +# UPLOAD_TO can be specified to upload the release assets under a different tag |
| 42 | +# name (e.g. for testing). If omitted, the assets are published under the same |
| 43 | +# release tag as the canvas version being built. |
| 44 | +# env: |
| 45 | +# UPLOAD_TO: "v0.0.1" |
| 46 | + |
| 47 | +# Node 19 requires a recent node-gyp |
| 48 | +# Node 10, 11 require 8 |
| 49 | +# Node 8, 9 require 6.1 |
| 50 | +# Manually set this file depending on what you're building!! |
| 51 | + |
| 52 | +jobs: |
| 53 | + Linux: |
| 54 | + strategy: |
| 55 | + fail-fast: false |
| 56 | + matrix: |
| 57 | + node: ${{ fromJson(inputs.node) }} |
| 58 | + canvas_tag: ${{ fromJson(inputs.canvas) }} # e.g. "v2.6.1" |
| 59 | + name: ${{ matrix.canvas_tag }}, Node.js ${{ matrix.node }}, Linux |
| 60 | + runs-on: ubuntu-latest |
| 61 | + if: contains(fromJson(inputs.os), 'ubuntu-latest') |
| 62 | + env: |
| 63 | + CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }} |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v2 |
| 66 | + with: |
| 67 | + ref: ${{ matrix.canvas_tag }} |
| 68 | + |
| 69 | + - uses: actions/setup-node@v1 |
| 70 | + with: |
| 71 | + node-version: ${{ matrix.node }} |
| 72 | + |
| 73 | + - name: Build |
| 74 | + run: | |
| 75 | + npm install |
| 76 | +
|
| 77 | + - name: Test binary |
| 78 | + continue-on-error: true |
| 79 | + run: | |
| 80 | + set -ex |
| 81 | + cd /root/harfbuzz-* && make uninstall |
| 82 | + cd /root/cairo-* && make uninstall |
| 83 | + cd /root/pango-* && cd _build && ninja uninstall |
| 84 | + cd /root/libpng-* && make uninstall |
| 85 | + cd /root/libjpeg-* && cd b && make uninstall |
| 86 | + cd /root/giflib-* && make uninstall |
| 87 | +
|
| 88 | + cd $GITHUB_WORKSPACE |
| 89 | + npx mocha test/*.test.js |
| 90 | +
|
| 91 | + macOSarm: |
| 92 | + strategy: |
| 93 | + fail-fast: false |
| 94 | + matrix: |
| 95 | + node: ${{ fromJson(inputs.node) }} |
| 96 | + canvas_tag: ${{ fromJson(inputs.canvas) }} # e.g. "v2.6.1" |
| 97 | + name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, macOSarm64 |
| 98 | + runs-on: macos-latest # macos-14+ is M1 |
| 99 | + if: contains(fromJson(inputs.os), 'macos-latest') |
| 100 | + env: |
| 101 | + CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }} |
| 102 | + steps: |
| 103 | + - uses: actions/checkout@v2 |
| 104 | + with: |
| 105 | + ref: ${{ matrix.canvas_tag }} |
| 106 | + # Fetch all commits/all branches so we can checkout the prebuild |
| 107 | + # branch's files |
| 108 | + fetch-depth: 0 |
| 109 | + |
| 110 | + - uses: actions/setup-node@v1 |
| 111 | + with: |
| 112 | + node-version: ${{ matrix.node }} |
| 113 | + |
| 114 | + - name: Build |
| 115 | + run: | |
| 116 | + set -Eeuxo pipefail |
| 117 | + git checkout ${{ matrix.canvas_tag }} |
| 118 | + npm install |
| 119 | +
|
| 120 | + - name: Test binary |
| 121 | + run: | |
| 122 | + brew uninstall --force --ignore-dependencies cairo pango librsvg giflib harfbuzz |
| 123 | + npm test |
| 124 | +
|
| 125 | + macOS: |
| 126 | + strategy: |
| 127 | + fail-fast: false |
| 128 | + matrix: |
| 129 | + node: ${{ fromJson(inputs.node) }} |
| 130 | + canvas_tag: ${{ fromJson(inputs.canvas) }} # e.g. "v2.6.1" |
| 131 | + name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, macOS |
| 132 | + runs-on: macos-13 # macos-14+ is M1 |
| 133 | + if: contains(fromJson(inputs.os), 'macos-13') |
| 134 | + env: |
| 135 | + CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }} |
| 136 | + steps: |
| 137 | + - uses: actions/checkout@v2 |
| 138 | + with: |
| 139 | + ref: ${{ matrix.canvas_tag }} |
| 140 | + # Fetch all commits/all branches so we can checkout the prebuild |
| 141 | + # branch's files |
| 142 | + fetch-depth: 0 |
| 143 | + |
| 144 | + - uses: actions/setup-node@v1 |
| 145 | + with: |
| 146 | + node-version: ${{ matrix.node }} |
| 147 | + |
| 148 | + - name: Build |
| 149 | + run: | |
| 150 | + set -Eeuxo pipefail |
| 151 | + git checkout ${{ matrix.canvas_tag }} |
| 152 | + npm install |
| 153 | +
|
| 154 | + - name: Test binary |
| 155 | + run: | |
| 156 | + brew uninstall --force --ignore-dependencies cairo pango librsvg giflib harfbuzz |
| 157 | + npm test |
| 158 | + |
| 159 | + Win: |
| 160 | + strategy: |
| 161 | + fail-fast: false |
| 162 | + matrix: |
| 163 | + node: ${{ fromJson(inputs.node) }} |
| 164 | + canvas_tag: ${{ fromJson(inputs.canvas) }} # e.g. "v2.6.1" |
| 165 | + name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, Windows |
| 166 | + runs-on: windows-latest |
| 167 | + if: contains(fromJson(inputs.os), 'windows-latest') |
| 168 | + env: |
| 169 | + CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }} |
| 170 | + steps: |
| 171 | + # GitHub runners now have msys2 installed, but msys is not on the path and |
| 172 | + # is apparently slow to start. |
| 173 | + # https://github.com/msys2/setup-msys2#setup-msys2 |
| 174 | + # https://github.com/actions/virtual-environments/pull/632 |
| 175 | + - uses: msys2/setup-msys2@v2 |
| 176 | + with: |
| 177 | + msystem: UCRT64 |
| 178 | + update: true |
| 179 | + path-type: inherit |
| 180 | + |
| 181 | + - uses: actions/setup-node@v3 |
| 182 | + with: |
| 183 | + node-version: ${{ matrix.node }} |
| 184 | + |
| 185 | + - uses: actions/checkout@v3 |
| 186 | + with: |
| 187 | + ref: ${{ matrix.canvas_tag }} |
| 188 | + # Fetch all commits/all branches so we can checkout the prebuild |
| 189 | + # branch's files |
| 190 | + fetch-depth: 0 |
| 191 | + |
| 192 | + - name: Build |
| 193 | + run: | |
| 194 | + git checkout ${{ matrix.canvas_tag }} |
| 195 | + npm install |
| 196 | + |
| 197 | + - name: Test binary |
| 198 | + # By not running in msys2, this doesn't have access to the msys2 libs |
| 199 | + run: npm test |
0 commit comments