Skip to content

Commit 9f5568b

Browse files
committed
Add packages to the uninstall list
1 parent 6ee4be5 commit 9f5568b

File tree

2 files changed

+151
-3
lines changed

2 files changed

+151
-3
lines changed

.github/workflows/prebuild.yaml

Lines changed: 149 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,79 @@ on: workflow_dispatch
4646
# Manually set this file depending on what you're building!!
4747

4848
jobs:
49+
Linux:
50+
strategy:
51+
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
55+
runs-on: ubuntu-latest
56+
container:
57+
image: chearon/canvas-prebuilt:7
58+
env:
59+
CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
60+
steps:
61+
- uses: actions/checkout@v4
62+
with:
63+
ref: ${{ matrix.canvas_tag }}
64+
65+
- uses: actions/setup-node@v4
66+
with:
67+
node-version: ${{ matrix.node }}
68+
69+
- name: Build
70+
run: |
71+
npm install -g node-gyp
72+
npm install --ignore-scripts
73+
. prebuild/Linux/preinstall.sh
74+
cp prebuild/Linux/binding.gyp binding.gyp
75+
node-gyp rebuild -j 2
76+
. prebuild/Linux/bundle.sh
77+
78+
- name: Test binary
79+
run: |
80+
cd /root/harfbuzz-* && make uninstall
81+
cd /root/cairo-* && make uninstall
82+
cd /root/pango-* && make uninstall
83+
cd /root/libpng-* && make uninstall
84+
cd /root/libjpeg-* && make uninstall
85+
cd /root/giflib-* && make uninstall
86+
cd $GITHUB_WORKSPACE && npm test
87+
88+
- name: Make bundle
89+
id: make_bundle
90+
run: . prebuild/tarball.sh
91+
92+
- name: Upload
93+
uses: actions/github-script@0.9.0
94+
with:
95+
script: |
96+
const fs = require("fs");
97+
const assetName = "${{ steps.make_bundle.outputs.asset_name }}";
98+
const tagName = process.env.UPLOAD_TO || process.env.CANVAS_VERSION_TO_BUILD;
99+
const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");
100+
101+
const releases = await github.repos.listReleases({owner, repo});
102+
const release = releases.data.find(r => r.tag_name === tagName);
103+
if (!release)
104+
throw new Error(`Tag ${tagName} not found. Did you make the GitHub release?`);
105+
106+
const oldAsset = release.assets.find(a => a.name === assetName);
107+
if (oldAsset)
108+
await github.repos.deleteReleaseAsset({owner, repo, asset_id: oldAsset.id});
109+
110+
// (This is equivalent to actions/upload-release-asset. We're
111+
// already in a script, so might as well do it here.)
112+
const r = await github.repos.uploadReleaseAsset({
113+
url: release.upload_url,
114+
headers: {
115+
"content-type": "application/x-gzip",
116+
"content-length": `${fs.statSync(assetName).size}`
117+
},
118+
name: assetName,
119+
data: fs.readFileSync(assetName)
120+
});
121+
49122
macOS:
50123
strategy:
51124
fail-fast: false
@@ -88,7 +161,7 @@ jobs:
88161
89162
- name: Test binary
90163
run: |
91-
brew uninstall --force --ignore-dependencies cairo pango librsvg giflib harfbuzz
164+
brew uninstall --force --ignore-dependencies cairo pango jpeg libpng librsvg giflib pixman harfbuzz
92165
npm test
93166
94167
- name: Make bundle
@@ -124,3 +197,78 @@ jobs:
124197
name: assetName,
125198
data: fs.readFileSync(assetName)
126199
});
200+
201+
Win:
202+
strategy:
203+
matrix:
204+
node: [18.12.0, 20.9.0]
205+
canvas_tag: [] # e.g. "v2.6.1"
206+
name: ${{ matrix.canvas_tag}}, Node.js ${{ matrix.node }}, Windows
207+
runs-on: windows-latest
208+
env:
209+
CANVAS_VERSION_TO_BUILD: ${{ matrix.canvas_tag }}
210+
steps:
211+
# TODO drop when https://github.com/actions/virtual-environments/pull/632 lands
212+
- uses: numworks/setup-msys2@v1
213+
with:
214+
update: true
215+
path-type: inherit
216+
217+
- uses: actions/setup-node@v4
218+
with:
219+
node-version: ${{ matrix.node }}
220+
221+
- uses: actions/checkout@v4
222+
with:
223+
ref: ${{ matrix.canvas_tag }}
224+
225+
- name: Build
226+
run: |
227+
npm install -g node-gyp
228+
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
233+
234+
- name: Bundle
235+
run: msys2do . prebuild/Windows/bundle.sh
236+
237+
- name: Test binary
238+
# By not running in msys2, this doesn't have access to the msys2 libs
239+
run: npm test
240+
241+
- name: Make asset
242+
id: make_bundle
243+
# 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
245+
246+
- name: Upload
247+
uses: actions/github-script@0.9.0
248+
with:
249+
script: |
250+
const fs = require("fs");
251+
const assetName = "${{ steps.make_bundle.outputs.asset_name }}";
252+
const tagName = process.env.UPLOAD_TO || process.env.CANVAS_VERSION_TO_BUILD;
253+
const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");
254+
255+
const releases = await github.repos.listReleases({owner, repo});
256+
const release = releases.data.find(r => r.tag_name === tagName);
257+
if (!release)
258+
throw new Error(`Tag ${tagName} not found. Did you make the GitHub release?`);
259+
260+
const oldAsset = release.assets.find(a => a.name === assetName);
261+
if (oldAsset)
262+
await github.repos.deleteReleaseAsset({owner, repo, asset_id: oldAsset.id});
263+
264+
// (This is equivalent to actions/upload-release-asset. We're
265+
// already in a script, so might as well do it here.)
266+
const r = await github.repos.uploadReleaseAsset({
267+
url: release.upload_url,
268+
headers: {
269+
"content-type": "application/x-gzip",
270+
"content-length": `${fs.statSync(assetName).size}`
271+
},
272+
name: assetName,
273+
data: fs.readFileSync(assetName)
274+
});

prebuild/tarball.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ FILENAME=$(
66
const tagName = p.env.UPLOAD_TO || p.env.CANVAS_VERSION_TO_BUILD;
77
console.log('canvas-' + tagName + '-napi-v7-' + p.platform + libc + '-' + p.arch);
88
"
9-
).tar.gz;
9+
).tar.gz
1010

1111
# Zip up the release
1212
tar -czvf $FILENAME build
1313

1414
if [ $? -ne 0 ]; then
1515
echo "failed to make tarball $FILENAME from node-canvas/build"
16-
exit 1;
16+
exit 1
1717
else
1818
echo "::set-output name=asset_name::$FILENAME"
1919
fi

0 commit comments

Comments
 (0)