-
Notifications
You must be signed in to change notification settings - Fork 103
424 lines (361 loc) · 13.9 KB
/
build-and-deploy.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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
name: Build and Deploy
on:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
inputs:
isDeploy:
description: "Whether the build should be deployed?"
type: boolean
required: true
default: false
skipBinaries:
description: "Skip building precompiled binaries?"
type: boolean
required: true
default: false
skipJava:
description: "Skip building Java?"
type: boolean
required: true
default: false
skipNodejs:
description: "Skip building Node.js?"
type: boolean
required: true
default: false
skipPython:
description: "Skip building Python?"
type: boolean
required: true
default: false
skipRust:
description: "Skip building Rust?"
type: boolean
required: true
default: false
skipExtensions:
description: "Skip building extensions?"
type: boolean
required: true
default: false
isNightly:
description: "Whether the build is a nightly build?"
type: boolean
required: true
default: false
env:
PIP_BREAK_SYSTEM_PACKAGES: 1
jobs:
get-nightly-version:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Update nightly version
run: |
python3 -m pip install packaging
python3 update-nightly-build-version.py | grep "New Python dev version:" | awk -F'New Python dev version: ' '{print $2}' | sed 's/\.$//' > version.txt
cat version.txt
working-directory: scripts
- name: Upload version
uses: actions/upload-artifact@v4
with:
name: version
path: scripts/version.txt
build-extension:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipExtensions != 'true' }}
uses: ./.github/workflows/build-and-deploy-extension.yml
with:
isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
secrets: inherit
build-java-mac:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipJava != 'true' }}
uses: ./.github/workflows/mac-java-workflow.yml
with:
isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
secrets: inherit
build-java-linux:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipJava != 'true' }}
uses: ./.github/workflows/linux-java-workflow.yml
with:
isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
secrets: inherit
build-java-windows:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipJava != 'true' }}
uses: ./.github/workflows/windows-java-workflow.yml
with:
isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
secrets: inherit
deploy-java:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipJava != 'true' }}
needs: [build-java-mac, build-java-linux, build-java-windows]
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_ACTOR: ${{ github.actor }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_SIGNING_KEY: ${{ secrets.PGP_PRIVATE_KEY }}
GPG_SIGNING_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SKIP_CMAKE_BUILD: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update nightly version
if: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
run: |
python3 -m pip install packaging
python3 update-nightly-build-version.py
working-directory: scripts
- uses: actions/download-artifact@v4
with:
name: java-lib-osx-x86_64
path: tools/java_api/src/main/resources
- uses: actions/download-artifact@v4
with:
name: java-lib-osx-arm64
path: tools/java_api/src/main/resources
- uses: actions/download-artifact@v4
with:
name: java-lib-linux-aarch64
path: tools/java_api/src/main/resources
- uses: actions/download-artifact@v4
with:
name: java-lib-linux-x86_64
path: tools/java_api/src/main/resources
- uses: actions/download-artifact@v4
with:
name: java-lib-win-x86_64
path: tools/java_api/src/main/resources
- name: Create Java JAR
working-directory: tools/java_api
run: |
./gradlew build
- name: Upload Java JAR
uses: actions/upload-artifact@v4
with:
name: kuzu-java-multiplatform-jar
path: tools/java_api/build/libs/kuzu*.jar
- name: Deploy Java JAR
if: ${{ github.event.inputs.isDeploy == 'true' || github.event_name == 'schedule' }}
working-directory: tools/java_api
run: |
./gradlew publish -i
build-nodejs-mac:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipNodejs != 'true' }}
uses: ./.github/workflows/mac-nodejs-workflow.yml
with:
isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
secrets: inherit
build-nodejs-linux:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipNodejs != 'true' }}
uses: ./.github/workflows/linux-nodejs-workflow.yml
with:
isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
secrets: inherit
build-nodejs-windows:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipNodejs != 'true' }}
uses: ./.github/workflows/windows-nodejs-workflow.yml
with:
isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
secrets: inherit
deploy-nodejs:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipNodejs != 'true' }}
needs: [build-nodejs-mac, build-nodejs-linux, build-nodejs-windows]
runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_JS_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Update nightly version
if: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
run: |
pip3 install packaging
python3 update-nightly-build-version.py
working-directory: scripts
- name: Create prebuilt folder
run: mkdir -p tools/nodejs_api/prebuilt
- uses: actions/download-artifact@v4
with:
name: mac-nodejs-module-arm64
path: tools/nodejs_api/prebuilt
- uses: actions/download-artifact@v4
with:
name: mac-nodejs-module-x86_64
path: tools/nodejs_api/prebuilt
- uses: actions/download-artifact@v4
with:
name: linux-nodejs-module-x86_64
path: tools/nodejs_api/prebuilt
- uses: actions/download-artifact@v4
with:
name: linux-nodejs-module-aarch64
path: tools/nodejs_api/prebuilt
- uses: actions/download-artifact@v4
with:
name: windows-nodejs-module
path: tools/nodejs_api/prebuilt
- uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
- name: Package Node.js API with prebuilt binaries
run: node package
working-directory: tools/nodejs_api
- name: Show tarball contents
run: tar -tvf kuzu-source.tar.gz
working-directory: tools/nodejs_api
- name: Upload tarball
uses: actions/upload-artifact@v4
with:
name: kuzu-deploy-nodejs
path: tools/nodejs_api/kuzu-source.tar.gz
- name: Deploy to npm.js dry run
if: ${{ github.event_name != 'schedule' && github.event.inputs.isDeploy != 'true' }}
run: npm publish kuzu-source.tar.gz --access public --dry-run
working-directory: tools/nodejs_api
- name: Deploy nightly to npm.js
if: ${{ github.event_name == 'schedule' || (github.event.inputs.isDeploy == 'true' && github.event.inputs.isNightly == 'true') }}
run: npm publish kuzu-source.tar.gz --access public --tag next
working-directory: tools/nodejs_api
- name: Deploy to npm.js
if: ${{ github.event.inputs.isDeploy == 'true' && github.event.inputs.isNightly != 'true' }}
run: npm publish kuzu-source.tar.gz --access public --tag latest
working-directory: tools/nodejs_api
build-wheel-mac:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipPython != 'true' }}
uses: ./.github/workflows/mac-wheel-workflow.yml
with:
isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
secrets: inherit
build-wheel-linux:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipPython != 'true' }}
uses: ./.github/workflows/linux-wheel-workflow.yml
with:
isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
secrets: inherit
build-wheel-windows:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipPython != 'true' }}
uses: ./.github/workflows/windows-wheel-workflow.yml
with:
isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
secrets: inherit
package-python-sdist:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipPython != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update nightly version
if: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
run: |
pip3 install packaging
python3 update-nightly-build-version.py
working-directory: scripts
- name: Package Python sdist
run: python package_tar.py
working-directory: scripts/pip-package
- name: Upload tarball
uses: actions/upload-artifact@v4
with:
name: python-sdist
path: scripts/pip-package/*.tar.gz
deploy-python:
permissions:
id-token: write
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipPython != 'true' }}
needs:
[
build-wheel-mac,
build-wheel-linux,
build-wheel-windows,
package-python-sdist,
]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: macos-wheels-arm64
path: dist
- uses: actions/download-artifact@v4
with:
name: macos-wheels-x86_64
path: dist
- uses: actions/download-artifact@v4
with:
name: linux-wheels-x86_64
path: dist
- uses: actions/download-artifact@v4
with:
name: linux-wheels-aarch64
path: dist
- uses: actions/download-artifact@v4
with:
name: windows-wheels
path: dist
- uses: actions/download-artifact@v4
with:
name: python-sdist
path: dist
- name: List wheels
run: ls -l
working-directory: dist
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: kuzu-deploy-wheels
path: dist/*
- name: Deploy to PyPI test
if: ${{ github.event_name != 'schedule' && github.event.inputs.isDeploy != 'true' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Deploy to PyPI
if: ${{ github.event_name == 'schedule' || github.event.inputs.isDeploy == 'true' }}
uses: pypa/gh-action-pypi-publish@release/v1
deploy-rust:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipRust != 'true' }}
runs-on: kuzu-self-hosted-testing
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Update nightly version
if: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
run: |
pip3 install packaging
python3 update-nightly-build-version.py
working-directory: scripts
- name: Update Cargo.toml version
run: python3 update_version.py
working-directory: tools/rust_api
- name: Deploy crate to Crates.io
run: cargo publish --allow-dirty
if: ${{ github.event.inputs.isDeploy == 'true' }}
working-directory: tools/rust_api
- name: Test publishing crate
run: cargo publish --dry-run --allow-dirty
if: ${{ github.event.inputs.isDeploy != 'true' }}
working-directory: tools/rust_api
- name: Upload crate
uses: actions/upload-artifact@v4
with:
name: kuzu-deploy-crate
path: tools/rust_api/target/package/*.crate
build-precompiled-bin-mac:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipBinaries != 'true' }}
uses: ./.github/workflows/mac-precompiled-bin-workflow.yml
with:
isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
secrets: inherit
build-precompiled-bin-linux:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipBinaries != 'true' }}
uses: ./.github/workflows/linux-precompiled-bin-workflow.yml
with:
isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
secrets: inherit
build-precompiled-bin-windows:
if: ${{ github.event_name == 'schedule' || github.event.inputs.skipBinaries != 'true' }}
uses: ./.github/workflows/windows-precompiled-bin-workflow.yml
with:
isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }}
secrets: inherit