forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 14
348 lines (323 loc) · 15.5 KB
/
build.yml
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
macos:
name: macOS
runs-on: ${{ matrix.runner }}
timeout-minutes: 90
strategy:
matrix:
include:
- runner: macos-11
lto_flag: ""
cpu: haswell
label: bun-webkit-macos-amd64-debug
brew_prefix: /usr/local/opt
package_json_arch: "x64"
CMAKE_BUILD_TYPE: Debug
- runner: macOS-arm64
lto_flag: ""
cpu: native
label: bun-webkit-macos-arm64-debug
brew_prefix: /opt/homebrew/opt
package_json_arch: "arm64"
CMAKE_BUILD_TYPE: Debug
- runner: macos-11
lto_flag: -flto='full'
cpu: haswell
label: bun-webkit-macos-amd64-lto
brew_prefix: /usr/local/opt
package_json_arch: "x64"
CMAKE_BUILD_TYPE: Release
- runner: macos-11
lto_flag: ""
cpu: haswell
label: bun-webkit-macos-amd64
brew_prefix: /usr/local/opt
package_json_arch: "x64"
CMAKE_BUILD_TYPE: Release
- runner: macOS-arm64
lto_flag: -flto='full'
cpu: native
label: bun-webkit-macos-arm64-lto
brew_prefix: /opt/homebrew/opt
package_json_arch: "arm64"
CMAKE_BUILD_TYPE: Release
- runner: macOS-arm64
lto_flag: ""
cpu: native
label: bun-webkit-macos-arm64
brew_prefix: /opt/homebrew/opt
package_json_arch: "arm64"
CMAKE_BUILD_TYPE: Release
steps:
- uses: actions/checkout@v3
- name: PATH
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_ANALYTICS_THIS_RUN: 1
run: |
echo "${{matrix.brew_prefix}}/llvm@15/bin" >> $GITHUB_PATH
brew install llvm@15 python icu4c ninja -f --overwrite
brew link llvm@15 -f --overwrite
- name: Run
env:
ICU_INCLUDE_DIRS: ${{matrix.brew_prefix}}/icu4c/include
LDFLAGS: "${{env.LDFLAGS}} -L${{matrix.brew_prefix}}/llvm/lib/c++ -Wl,-rpath,${{matrix.brew_prefix}}/llvm/lib/c++"
CC: "${{matrix.brew_prefix}}/llvm@15/bin/clang"
CXX: "${{matrix.brew_prefix}}/llvm@15/bin/clang++"
CMAKE_C_COMPILER: "${{matrix.brew_prefix}}/llvm@15/bin/clang"
CMAKE_CXX_COMPILER: "${{matrix.brew_prefix}}/llvm@15/bin/clang++"
CMAKE_C_FLAGS: "-fuse-ld=lld -fno-exceptions ${{matrix.lto_flag}} -fvisibility=hidden -fvisibility-inlines-hidden -O3"
CMAKE_CXX_FLAGS: "-fuse-ld=lld -I${{matrix.brew_prefix}}/llvm/include -fno-exceptions ${{matrix.lto_flag}} -fvisibility=hidden -fvisibility-inlines-hidden -O3"
CMAKE_OSX_DEPLOYMENT_TARGET: "11.0"
CMAKE_BUILD_TYPE: ${{matrix.CMAKE_BUILD_TYPE}}
PACKAGE_JSON_ARCH: ${{matrix.package_json_arch}}
PACKAGE_JSON_LABEL: ${{matrix.label}}
run: GITHUB_REPOSITORY=$GITHUB_REPOSITORY bash mac-release.bash
- uses: actions/upload-artifact@v3
with:
name: ${{matrix.label}}
path: ${{runner.temp}}/bun-webkit.tar.gz
linux:
name: Linux
runs-on: ${{matrix.os}}
strategy:
matrix:
include:
- lto_flag: ""
label: bun-webkit-linux-amd64-debug
os: big-ubuntu
package_json_arch: "x64"
CMAKE_BUILD_TYPE: "Debug"
- lto_flag: ""
label: bun-webkit-linux-arm64-debug
os: big-ubuntu
package_json_arch: "x64"
CMAKE_BUILD_TYPE: "Debug"
- lto_flag: "-flto='full'"
label: bun-webkit-linux-arm64-lto
os: linux-arm64
package_json_arch: "arm64"
CMAKE_BUILD_TYPE: "Release"
- lto_flag: ""
label: bun-webkit-linux-arm64
os: linux-arm64
package_json_arch: "arm64"
CMAKE_BUILD_TYPE: "Release"
- lto_flag: "-flto='full'"
label: bun-webkit-linux-amd64-lto
os: big-ubuntu
package_json_arch: "x64"
CMAKE_BUILD_TYPE: "Release"
- lto_flag: ""
label: bun-webkit-linux-amd64
os: big-ubuntu
package_json_arch: "x64"
CMAKE_BUILD_TYPE: "Release"
timeout-minutes: 90
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true
- name: Run
run: |
rm -rf ${{runner.temp}}/bun-webkit ${{runner.temp}}/bun-webkit.tar.gz
WEBKIT_RELEASE_TYPE=${{matrix.CMAKE_BUILD_TYPE}} CPU="native" cpu=native LTO_FLAG=${{matrix.lto_flag}} temp=${{runner.temp}} bash release.sh
cd ${{runner.temp}}
echo "#define BUN_WEBKIT_VERSION \"${{github.sha}}\"" >> bun-webkit/include/cmakeconfig.h
echo '{ "name": "${{matrix.label}}", "version": "0.0.1-${{github.sha}}", "os": ["linux"], "cpu": ["${{matrix.package_json_arch}}"], "repository": "https://github.com/${{github.repository}}" }' > bun-webkit/package.json
rm -rf bun-webkit/lib/*.so
rm -rf bun-webkit/lib/*.so.*
tar -czf bun-webkit.tar.gz bun-webkit
rm -rf bun-webkit
- uses: actions/upload-artifact@v3
with:
name: ${{matrix.label}}
path: ${{runner.temp}}/bun-webkit.tar.gz
release:
name: release
runs-on: ubuntu-latest
timeout-minutes: 90
needs:
- linux
- macos
steps:
- uses: actions/download-artifact@v3
with:
name: bun-webkit-linux-amd64
path: ${{runner.temp}}/bun-webkit-linux-amd64
- uses: actions/download-artifact@v3
with:
name: bun-webkit-linux-arm64
path: ${{runner.temp}}/bun-webkit-linux-arm64
- uses: actions/download-artifact@v3
with:
name: bun-webkit-linux-amd64-debug
path: ${{runner.temp}}/bun-webkit-linux-amd64-debug
- uses: actions/download-artifact@v3
with:
name: bun-webkit-linux-arm64-debug
path: ${{runner.temp}}/bun-webkit-linux-arm64-debug
- uses: actions/download-artifact@v3
with:
name: bun-webkit-macos-arm64
path: ${{runner.temp}}/bun-webkit-macos-arm64
- uses: actions/download-artifact@v3
with:
name: bun-webkit-macos-arm64-debug
path: ${{runner.temp}}/bun-webkit-macos-arm64-debug
- uses: actions/download-artifact@v3
with:
name: bun-webkit-macos-arm64-lto
path: ${{runner.temp}}/bun-webkit-macos-arm64-lto
- uses: actions/download-artifact@v3
with:
name: bun-webkit-macos-amd64
path: ${{runner.temp}}/bun-webkit-macos-amd64
- uses: actions/download-artifact@v3
with:
name: bun-webkit-macos-amd64-debug
path: ${{runner.temp}}/bun-webkit-macos-amd64-debug
- uses: actions/download-artifact@v3
with:
name: bun-webkit-macos-amd64-lto
path: ${{runner.temp}}/bun-webkit-macos-amd64-lto
- uses: actions/download-artifact@v3
with:
name: bun-webkit-linux-amd64-lto
path: ${{runner.temp}}/bun-webkit-linux-amd64-lto
- uses: actions/download-artifact@v3
with:
name: bun-webkit-linux-arm64-lto
path: ${{runner.temp}}/bun-webkit-linux-arm64-lto
- name: Rename files
run: |
mv ${{runner.temp}}/bun-webkit-linux-amd64/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-linux-amd64.tar.gz
mv ${{runner.temp}}/bun-webkit-linux-arm64/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-linux-arm64.tar.gz
mv ${{runner.temp}}/bun-webkit-macos-arm64/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-macos-arm64.tar.gz
mv ${{runner.temp}}/bun-webkit-macos-amd64/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-macos-amd64.tar.gz
mv ${{runner.temp}}/bun-webkit-linux-amd64-debug/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-linux-amd64-debug.tar.gz
mv ${{runner.temp}}/bun-webkit-linux-arm64-debug/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-linux-arm64-debug.tar.gz
mv ${{runner.temp}}/bun-webkit-macos-arm64-debug/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-macos-arm64-debug.tar.gz
mv ${{runner.temp}}/bun-webkit-macos-amd64-debug/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-macos-amd64-debug.tar.gz
mv ${{runner.temp}}/bun-webkit-macos-arm64-lto/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-macos-arm64-lto.tar.gz
mv ${{runner.temp}}/bun-webkit-macos-amd64-lto/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-macos-amd64-lto.tar.gz
mv ${{runner.temp}}/bun-webkit-linux-arm64-lto/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-linux-arm64-lto.tar.gz
mv ${{runner.temp}}/bun-webkit-linux-amd64-lto/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-linux-amd64-lto.tar.gz
- name: Release
uses: softprops/action-gh-release@v1
id: release
with:
prerelease: true
generate_release_notes: true
tag_name: "autobuild-${{github.sha}}"
files: |
${{runner.temp}}/bun-webkit-linux-amd64-debug.tar.gz
${{runner.temp}}/bun-webkit-linux-arm64-debug.tar.gz
${{runner.temp}}/bun-webkit-macos-arm64-debug.tar.gz
${{runner.temp}}/bun-webkit-macos-amd64-debug.tar.gz
${{runner.temp}}/bun-webkit-linux-amd64.tar.gz
${{runner.temp}}/bun-webkit-linux-arm64.tar.gz
${{runner.temp}}/bun-webkit-macos-arm64.tar.gz
${{runner.temp}}/bun-webkit-macos-amd64.tar.gz
${{runner.temp}}/bun-webkit-linux-amd64-lto.tar.gz
${{runner.temp}}/bun-webkit-linux-arm64-lto.tar.gz
${{runner.temp}}/bun-webkit-macos-arm64-lto.tar.gz
${{runner.temp}}/bun-webkit-macos-amd64-lto.tar.gz
- name: Canary
uses: softprops/action-gh-release@v1
with:
prerelease: true
generate_release_notes: true
tag_name: "canary"
files: |
${{runner.temp}}/bun-webkit-linux-amd64.tar.gz
${{runner.temp}}/bun-webkit-linux-arm64.tar.gz
${{runner.temp}}/bun-webkit-macos-arm64.tar.gz
${{runner.temp}}/bun-webkit-macos-amd64.tar.gz
${{runner.temp}}/bun-webkit-linux-amd64-debug.tar.gz
${{runner.temp}}/bun-webkit-linux-arm64-debug.tar.gz
${{runner.temp}}/bun-webkit-macos-arm64-debug.tar.gz
${{runner.temp}}/bun-webkit-macos-amd64-debug.tar.gz
${{runner.temp}}/bun-webkit-linux-amd64-lto.tar.gz
${{runner.temp}}/bun-webkit-linux-arm64-lto.tar.gz
${{runner.temp}}/bun-webkit-macos-arm64-lto.tar.gz
${{runner.temp}}/bun-webkit-macos-amd64-lto.tar.gz
- uses: actions/setup-node@v3
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
- run: |
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-linux-amd64-lto.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-linux-arm64-lto.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-macos-arm64-lto.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-macos-amd64-lto.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-linux-amd64.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-linux-arm64.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-macos-arm64.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-macos-amd64.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit-lto ${{runner.temp}}/bun-webkit ${{runner.temp}}/bun-webkit-debug
mkdir -p ${{runner.temp}}/bun-webkit-lto ${{runner.temp}}/bun-webkit ${{runner.temp}}/bun-webkit-debug
echo '{ "name": "bun-webkit", "version": "0.0.1-${{github.sha}}", "repository": "https://github.com/${{github.repository}}", "optionalDependencies": {"bun-webkit-linux-amd64": "0.0.1-${{github.sha}}", "bun-webkit-linux-arm64": "0.0.1-${{github.sha}}", "bun-webkit-macos-arm64": "0.0.1-${{github.sha}}", "bun-webkit-macos-amd64": "0.0.1-${{github.sha}}"} }' > ${{runner.temp}}/bun-webkit/package.json
echo '{ "name": "bun-webkit-lto", "version": "0.0.1-${{github.sha}}", "repository": "https://github.com/${{github.repository}}", "optionalDependencies": {"bun-webkit-linux-amd64-lto": "0.0.1-${{github.sha}}", "bun-webkit-linux-arm64-lto": "0.0.1-${{github.sha}}", "bun-webkit-macos-arm64-lto": "0.0.1-${{github.sha}}", "bun-webkit-macos-amd64-lto": "0.0.1-${{github.sha}}"} }' > ${{runner.temp}}/bun-webkit-lto/package.json
echo '{ "name": "bun-webkit-debug", "version": "0.0.1-${{github.sha}}", "repository": "https://github.com/${{github.repository}}", "config": {"bun-webkit-linux-amd64-debug": "${{ fromJSON(steps.release.outputs.assets)[0].browser_download_url }}", "bun-webkit-linux-arm64-debug": "${{ fromJSON(steps.release.outputs.assets)[1].browser_download_url }}", "bun-webkit-macos-arm64-debug": "${{ fromJSON(steps.release.outputs.assets)[2].browser_download_url }}", "bun-webkit-macos-amd64-debug": "${{ fromJSON(steps.release.outputs.assets)[3].browser_download_url }}"} }' > ${{runner.temp}}/bun-webkit-debug/package.json
echo "$README_TEXT" > ${{runner.temp}}/bun-webkit/README.md
echo "$README_TEXT" > ${{runner.temp}}/bun-webkit-lto/README.md
echo "$README_TEXT" > ${{runner.temp}}/bun-webkit-debug/README.md
cd ${{runner.temp}}/bun-webkit
npm publish --tag next --access=public
cd ${{runner.temp}}/bun-webkit-lto
npm publish --tag next --access=public
cd ${{runner.temp}}/bun-webkit-debug
npm publish --tag next --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
README_TEXT: |
# WebKit
[Bun](https://bun.sh) is a new all-in-one JavaScript runtime.
This is Bun's WebKit build. The optional dependencies of this package have prebuilt JavaScriptCore/WebKit static libraries.
The goal of this package is to simplify contributing to Bun. Instead of cloning and building WebKit yourself, you can use this package.
This version corresponds to #[${{github.sha}}](https://github.com/${{github.repository}}/commit/${{github.sha}}).