Skip to content

Commit 8d399c6

Browse files
committed
Restore changes in prebuild.yaml
1 parent 9f5568b commit 8d399c6

File tree

1 file changed

+75
-31
lines changed

1 file changed

+75
-31
lines changed

.github/workflows/prebuild.yaml

Lines changed: 75 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -48,49 +48,68 @@ on: workflow_dispatch
4848
jobs:
4949
Linux:
5050
strategy:
51+
fail-fast: false
5152
matrix:
52-
node: [18.12.0, 20.9.0]
53-
canvas_tag: [] # e.g. "v2.6.1"
54-
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, Linux
53+
node: [21]
54+
canvas_tag: ["v3.0.0-rc2"] # e.g. "v2.6.1"
55+
name: ${{ matrix.canvas_tag }}, Node.js ${{ matrix.node }}, Linux
5556
runs-on: ubuntu-latest
5657
container:
57-
image: chearon/canvas-prebuilt:7
58+
image: ${{ matrix.node < 18 && 'chearon/canvas-prebuilt:9' || 'zbbjornson/canvas-prebuilt:11' }}
5859
env:
5960
CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
6061
steps:
61-
- uses: actions/checkout@v4
62+
- uses: actions/checkout@v2
6263
with:
6364
ref: ${{ matrix.canvas_tag }}
6465

65-
- uses: actions/setup-node@v4
66+
# Use the files in the prebuild/ directory from the commit that was used
67+
# to trigger the prebuild workflow. The version of git that's installed on
68+
# this Linux here doesn't support the method used on Mac and Win, so we
69+
# checkout the prebuild branch and copy the files from the prebuild/
70+
# directory in the Build step.
71+
- uses: actions/checkout@v2
72+
with:
73+
ref: ${{ env.GITHUB_SHA }}
74+
path: prebuild-branch
75+
76+
- uses: actions/setup-node@v1
6677
with:
6778
node-version: ${{ matrix.node }}
6879

6980
- name: Build
7081
run: |
82+
set -ex
83+
mkdir -p prebuild
84+
cp -rfv ./prebuild-branch/prebuild/* ./prebuild/
7185
npm install -g node-gyp
7286
npm install --ignore-scripts
73-
. prebuild/Linux/preinstall.sh
7487
cp prebuild/Linux/binding.gyp binding.gyp
7588
node-gyp rebuild -j 2
7689
. prebuild/Linux/bundle.sh
7790
7891
- name: Test binary
92+
continue-on-error: true
7993
run: |
94+
set -ex
8095
cd /root/harfbuzz-* && make uninstall
8196
cd /root/cairo-* && make uninstall
82-
cd /root/pango-* && make uninstall
97+
cd /root/pango-* && cd _build && ninja uninstall
8398
cd /root/libpng-* && make uninstall
84-
cd /root/libjpeg-* && make uninstall
99+
cd /root/libjpeg-* && cd b && make uninstall
85100
cd /root/giflib-* && make uninstall
86-
cd $GITHUB_WORKSPACE && npm test
101+
102+
cd $GITHUB_WORKSPACE
103+
ls build/Release
104+
ldd build/Release/canvas.node
105+
npx mocha test/*.test.js
87106
88107
- name: Make bundle
89108
id: make_bundle
90109
run: . prebuild/tarball.sh
91110

92111
- name: Upload
93-
uses: actions/github-script@0.9.0
112+
uses: actions/github-script@v2
94113
with:
95114
script: |
96115
const fs = require("fs");
@@ -124,11 +143,11 @@ jobs:
124143
fail-fast: false
125144
matrix:
126145
node: [21]
127-
canvas_tag: ["m1-testing"] # e.g. "v2.6.1"
146+
canvas_tag: ["v3.0.0-rc2"] # e.g. "v2.6.1"
128147
os:
129-
- runner: macos-12
148+
- runner: macos-latest
130149
arch: x64
131-
- runner: macos-14 # GitHub's Apple Silicon runner
150+
- runner: macos-latest-xlarge # GitHub's Apple Silicon runner
132151
arch: arm64
133152
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, macOS ${{ matrix.os.arch }}
134153
runs-on: ${{ matrix.os.runner }}
@@ -153,15 +172,14 @@ jobs:
153172
git checkout $GITHUB_SHA -- prebuild/
154173
npm install -g node-gyp
155174
npm install --ignore-scripts
156-
npm install nan
157175
. prebuild/macOS/preinstall.sh
158176
cp prebuild/macOS/binding.gyp binding.gyp
159177
node-gyp rebuild -j 2 --arch=${{ matrix.os.arch }}
160178
. prebuild/macOS/bundle.sh
161179
162180
- name: Test binary
163181
run: |
164-
brew uninstall --force --ignore-dependencies cairo pango jpeg libpng librsvg giflib pixman harfbuzz
182+
brew uninstall --force --ignore-dependencies cairo pango jpeg libpng librsvg giflib harfbuzz pixman
165183
npm test
166184
167185
- name: Make bundle
@@ -200,39 +218,65 @@ jobs:
200218
201219
Win:
202220
strategy:
221+
fail-fast: false
203222
matrix:
204-
node: [18.12.0, 20.9.0]
205-
canvas_tag: [] # e.g. "v2.6.1"
223+
node: [21]
224+
canvas_tag: ["v3.0.0-rc2"] # e.g. "v2.6.1"
206225
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, Windows
207-
runs-on: windows-latest
226+
runs-on: windows-2019
208227
env:
209228
CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
210229
steps:
211-
# TODO drop when https://github.com/actions/virtual-environments/pull/632 lands
212-
- uses: numworks/setup-msys2@v1
230+
# GitHub runners now have msys2 installed, but msys is not on the path and
231+
# is apparently slow to start.
232+
# https://github.com/msys2/setup-msys2#setup-msys2
233+
# https://github.com/actions/virtual-environments/pull/632
234+
- uses: msys2/setup-msys2@v2
213235
with:
236+
msystem: UCRT64
214237
update: true
215238
path-type: inherit
216239

217-
- uses: actions/setup-node@v4
240+
- uses: actions/setup-node@v3
218241
with:
219242
node-version: ${{ matrix.node }}
220243

221-
- uses: actions/checkout@v4
244+
- uses: actions/checkout@v3
222245
with:
223246
ref: ${{ matrix.canvas_tag }}
247+
# Fetch all commits/all branches so we can checkout the prebuild
248+
# branch's files
249+
fetch-depth: 0
224250

225251
- name: Build
226252
run: |
253+
git checkout ${{ matrix.canvas_tag }}
254+
git checkout $env:GITHUB_SHA -- prebuild/
227255
npm install -g node-gyp
256+
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
228257
npm install --ignore-scripts
229-
msys2do . prebuild/Windows/preinstall.sh
230-
msys2do cp prebuild/Windows/binding.gyp binding.gyp
231-
msys2do node-gyp configure
232-
msys2do node-gyp rebuild -j 2
258+
msys2 -c ". prebuild/Windows/preinstall.sh"
259+
msys2 -c "cp prebuild/Windows/binding.gyp binding.gyp"
260+
npm install --build-from-source
233261
234-
- name: Bundle
235-
run: msys2do . prebuild/Windows/bundle.sh
262+
- name: Install Depends
263+
run: |
264+
Invoke-WebRequest "http://www.dependencywalker.com/depends22_x64.zip" -OutFile depends22_x64.zip
265+
7z e depends22_x64.zip
266+
- name: Bundle pt 2
267+
shell: msys2 {0}
268+
run: |
269+
./depends.exe -c -oc depends.csv build\\Release\\canvas.node || true
270+
[ -f depends.csv ] || { echo "error invoking depends.exe"; exit 1; }
271+
272+
copies=$(comm -12 \
273+
<(cat depends.csv | cut -d ',' -f2 | sed 's/"//g' | tr '[:upper:]' '[:lower:]' | sort) \
274+
<(find /ucrt64/bin -name '*.dll' -printf "%f\n" | tr '[:upper:]' '[:lower:]' | sort) \
275+
)
276+
277+
for dll in $copies; do
278+
cp /ucrt64/bin/$dll build/Release
279+
done;
236280
237281
- name: Test binary
238282
# By not running in msys2, this doesn't have access to the msys2 libs
@@ -241,10 +285,10 @@ jobs:
241285
- name: Make asset
242286
id: make_bundle
243287
# I can't figure out why this isn't an env var already. It shows up with `env`.
244-
run: msys2do UPLOAD_TO=${{ env.UPLOAD_TO }} CANVAS_VERSION_TO_BUILD=${{ env.CANVAS_VERSION_TO_BUILD}} . prebuild/tarball.sh
288+
run: msys2 -c "UPLOAD_TO=${{ env.UPLOAD_TO }} CANVAS_VERSION_TO_BUILD=${{ env.CANVAS_VERSION_TO_BUILD}} . prebuild/tarball.sh"
245289

246290
- name: Upload
247-
uses: actions/github-script@0.9.0
291+
uses: actions/github-script@v2
248292
with:
249293
script: |
250294
const fs = require("fs");

0 commit comments

Comments
 (0)