-
Notifications
You must be signed in to change notification settings - Fork 1.2k
267 lines (259 loc) · 8.74 KB
/
prebuild.yaml
File metadata and controls
267 lines (259 loc) · 8.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# Release procedure:
# 1. On the master branch, update the changelog and stage it in git.
# 2. Run `yarn version --[major|minor|patch]`. (This tags the commit.)
# 3. Push both the commit and tags to GitHub (`git push --tags Automattic` and
# `git push Automattic HEAD:master`, where "Automattic" is the remote name
# for git@github.com:Automattic/node-canvas.git).
# 4. Create a draft release manually using the GitHub UI for the new tag.
# 5. Switch to the prebuilds branch.
# 6. Set the `jobs.*.strategy.matrix.node` arrays to the set of Node.js versions
# to build for.
# 7. Set the `jobs.*.strategy.matrix.canvas_tag` arrays to the set of Canvas
# tags to build. (Usually this is a single tag, but can be an array when a
# new version of Node.js is released and older versions of Canvas need to be
# built.)
# 8. Commit this file and push.
# 9. In the Actions tab, navigate to the "Make Prebuilds" workflow and click
# "Run workflow". Select the `prebuilds` branch so that that branch's
# prebuild.yaml file is used.
# 10.Once the builds succeed, promote the draft release to a full release and
# run npm publish.
# Note that the files in the prebuild/ directory will be used from the commit
# that was used to trigger the prebuild workflow. They will not be from the
# commit/tag that you are building. Because of differences in the provided
# versions of git, this is achieved in a different way on Linux than on Mac and
# Win.
#
# Pay particular attention to changes to binding.gyp on master. That file is not
# used! The ones in prebuild/**/ are.
# Tip: If uploads are inexplicably failing, open the release in GitHub, click
# "edit" and delete any assets that are in purgatory (have a /!\ next to them).
name: Make Prebuilds
on:
workflow_dispatch:
inputs:
buildVersion:
description: 'Version to build'
required: true
default: 'v3.0.0-rc2'
# UPLOAD_TO can be specified to upload the release assets under a different tag
# name (e.g. for testing). If omitted, the assets are published under the same
# release tag as the canvas version being built.
uploadTo:
description: 'Upload artefacts to version'
required: false
default: ''
env:
CANVAS_VERSION_TO_BUILD: ${{inputs.buildVersion}}
UPLOAD_TO: ${{inputs.uploadTo}}
jobs:
Debian:
strategy:
fail-fast: false
matrix:
node: [ 18, 20, 22 ]
runs-on: ubuntu-latest
# container:
# image: node:${{ matrix.node }}-slim
name: Node.js ${{ matrix.node }}, Debian
steps:
- name: Checkout Prebuild
uses: actions/checkout@v4
- name: Checkout Source
uses: actions/checkout@v4
with:
ref: ${{ env.CANVAS_VERSION_TO_BUILD }}
path: source
- name: Install Dependencies
run: |
npm install
. ./Debian/preinstall.sh
working-directory: ./prebuild
- name: Build
run: npm install --build-from-source
working-directory: ./source
- name: Test
run: npm test
working-directory: ./source
- name: Bundle
run: . ./prebuild/Debian/bundle.sh
- name: Uninstall Dependencies
run: . ./prebuild/Debian/uninstall.sh
- name: Test binary
run: npm test
working-directory: ./source
- name: Make asset
id: make_asset
run: . ./prebuild/tarball.sh
- name: Upload asset
uses: ncipollo/release-action@v1
with:
tag: ${{ env.UPLOAD_TO || env.CANVAS_VERSION_TO_BUILD }}
allowUpdates: true
artifacts: ${{ steps.make_asset.outputs.asset_name }}
artifactContentType: application/tar+gz
Alpine:
strategy:
fail-fast: false
matrix:
# FIXME: no 22 image yet
node: [ 18, 20 ]
canvas_tag: [ "v3.0.0-rc1" ] # e.g. "v2.6.1"
runs-on: ubuntu-latest
container:
image: node:${{ matrix.node }}-alpine
name: Node.js ${{ matrix.node }}, Alpine
steps:
- name: Checkout Prebuild
uses: actions/checkout@v4
- name: Checkout Source
uses: actions/checkout@v4
with:
ref: ${{ env.CANVAS_VERSION_TO_BUILD }}
path: source
- name: Install Dependencies
run: |
npm install
. ./Alpine/preinstall.sh
working-directory: ./prebuild
- name: Build
run: npm install --build-from-source
working-directory: ./source
- name: Test
# some tests failed
continue-on-error: true
run: npm test
working-directory: ./source
- name: Bundle
run: . ./prebuild/Debian/bundle.sh
- name: Uninstall Dependencies
run: . ./prebuild/Alpine/uninstall.sh
- name: Test binary
# some tests failed
continue-on-error: true
run: npm test
working-directory: ./source
- name: Make asset
id: make_asset
run: . ./prebuild/tarball.sh
- name: Upload asset
uses: ncipollo/release-action@v1
with:
tag: ${{ env.UPLOAD_TO || env.CANVAS_VERSION_TO_BUILD }}
allowUpdates: true
artifacts: ${{ steps.make_asset.outputs.asset_name }}
artifactContentType: application/tar+gz
macOS:
strategy:
fail-fast: false
matrix:
node: [ 18, 20, 22 ]
os:
- runner: macos-latest
arch: x64
# - runner: macos-latest-xlarge # GitHub's Apple Silicon runner
# arch: arm64
runs-on: ${{ matrix.os.runner }}
name: Node.js ${{ matrix.node }}, macOS ${{ matrix.os.arch }}
steps:
- name: Checkout Prebuild
uses: actions/checkout@v4
- name: Checkout Source
uses: actions/checkout@v4
with:
ref: ${{ env.CANVAS_VERSION_TO_BUILD }}
path: source
- name: Install Node.JS
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install Dependencies
run: |
npm install
. ./macOS/preinstall.sh
working-directory: ./prebuild
- name: Build
run: npm install --build-from-source
working-directory: ./source
- name: Test
run: npm test
working-directory: ./source
- name: Bundle
run: |
. ./prebuild/macOS/prebundle.sh
. ./prebuild/macOS/bundle.sh
- name: Uninstall Dependencies
run: . ./prebuild/macOS/uninstall.sh
- name: Test binary
run: npm test
working-directory: ./source
- name: Make bundle
id: make_bundle
run: . prebuild/tarball.sh
- name: Make asset
id: make_asset
run: . ./prebuild/tarball.sh
- name: Upload asset
uses: ncipollo/release-action@v1
with:
tag: ${{ env.UPLOAD_TO || env.CANVAS_VERSION_TO_BUILD }}
allowUpdates: true
artifacts: ${{ steps.make_asset.outputs.asset_name }}
artifactContentType: application/tar+gz
Windows:
strategy:
fail-fast: false
matrix:
node: [ 18, 20, 22 ]
name: Node.js ${{ matrix.node }}, Windows
runs-on: windows-latest
steps:
- name: Checkout Prebuild
uses: actions/checkout@v4
- name: Checkout Source
uses: actions/checkout@v4
with:
ref: ${{ env.CANVAS_VERSION_TO_BUILD }}
path: source
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
path-type: inherit
- name: Install Dependencies
shell: msys2 {0}
run: |
npm install
. ./Windows/preinstall.sh
working-directory: ./prebuild
- name: Build
shell: msys2 {0}
run: npm install --build-from-source
working-directory: ./source
- name: Test
shell: msys2 {0}
working-directory: ./source
run: npm test
- name: Bundle
shell: msys2 {0}
run: . ./prebuild/Windows/bundle.sh
- name: Test binary
# By not running in msys2, this doesn't have access to the msys2 libs
run: npm test
# broke on Node 22, may be cause by https://github.com/actions/setup-node/issues/1016
continue-on-error: true
working-directory: ./source
- name: Make asset
id: make_asset
shell: msys2 {0}
# I can't figure out why this isn't an env var already. It shows up with `env`.
run: . ./prebuild/tarball.sh
- name: Upload asset
uses: ncipollo/release-action@v1
with:
tag: ${{ env.UPLOAD_TO || env.CANVAS_VERSION_TO_BUILD }}
allowUpdates: true
artifacts: ${{ steps.make_asset.outputs.asset_name }}
artifactContentType: application/tar+gz