forked from slint-ui/slint
-
Notifications
You must be signed in to change notification settings - Fork 0
376 lines (350 loc) · 13.2 KB
/
nightly_snapshot.yaml
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
# Copyright © SixtyFPS GmbH <[email protected]>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.0 OR LicenseRef-Slint-commercial
# Build various demo binaries, c++ packages and documentation and publish them on the website
name: Nightly snapshot
on:
workflow_dispatch:
inputs:
private:
type: boolean
default: true
required: false
description: "Private build? True means artifacts are only built. False means the artefacts are published (docs, vscode extension) to the web/marketplace"
release:
type: boolean
default: false
required: false
description: "Release? Enable options for building binaries for a release (i.e. don't have a -nightly suffix for the extension)"
schedule:
- cron: '0 4 * * *'
jobs:
slint-viewer-binary:
uses: ./.github/workflows/slint_tool_binary.yaml
with:
program: "viewer"
slint-lsp-binary:
uses: ./.github/workflows/slint_tool_binary.yaml
with:
program: "lsp"
docs:
uses: ./.github/workflows/build_docs.yaml
wasm_demo:
uses: ./.github/workflows/wasm_demos.yaml
with:
rustflags: "--cfg=web_sys_unstable_apis"
wasm:
uses: ./.github/workflows/wasm_editor_and_interpreter.yaml
with:
rustflags: "--cfg=web_sys_unstable_apis"
cpp_package:
uses: ./.github/workflows/cpp_package.yaml
build_vscode_lsp_linux_windows:
env:
SLINT_NO_QT: 1
strategy:
matrix:
include:
- os: ubuntu-20.04
toolchain: x86_64-unknown-linux-gnu
binary_built: slint-lsp
artifact_name: slint-lsp-x86_64-unknown-linux-gnu
- os: windows-2022
toolchain: x86_64-pc-windows-gnu
binary_built: slint-lsp.exe
artifact_name: slint-lsp-x86_64-pc-windows-gnu.exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust
with:
target: ${{ matrix.toolchain }}
- uses: ./.github/actions/install-linux-dependencies
- name: Build LSP
run: cargo build --target ${{ matrix.toolchain }} --release -p slint-lsp
- name: Create artifact directory
run: |
mkdir bin
cp target/${{ matrix.toolchain }}/release/${{ matrix.binary_built }} bin/${{ matrix.artifact_name }}
- name: "Upload LSP Artifact"
uses: actions/upload-artifact@v3
with:
name: vscode-lsp-binary-${{ matrix.toolchain }}
path: |
bin
build_vscode_lsp_macos_x86_64:
env:
SLINT_NO_QT: 1
runs-on: macos-11
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust
with:
target: x86_64-apple-darwin
- name: Install cargo-bundle
run: cargo install cargo-bundle
- name: Build Main LSP Bundle
working-directory: tools/lsp
run: cargo bundle --release
- name: Create artifact directory
run: |
mkdir bin
cp -a target/release/bundle/osx/Slint\ Live\ Preview.app bin
- name: "Upload LSP Artifact"
uses: actions/upload-artifact@v3
with:
name: vscode-lsp-binary-x86_64-apple-darwin
path: |
bin
build_vscode_lsp_macos_aarch64:
env:
SLINT_NO_QT: 1
runs-on: macos-11
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust
with:
target: aarch64-apple-darwin
- name: Build AArch64 LSP
run: cargo build --target aarch64-apple-darwin --release -p slint-lsp
- name: Create artifact directory
run: |
mkdir bin
cp -a target/aarch64-apple-darwin/release/slint-lsp bin/slint-lsp-aarch64-apple-darwin
- name: "Upload LSP Artifact"
uses: actions/upload-artifact@v3
with:
name: vscode-lsp-binary-aarch64-apple-darwin
path: |
bin
build_vscode_lsp_macos_bundle:
needs: [build_vscode_lsp_macos_x86_64, build_vscode_lsp_macos_aarch64]
runs-on: macos-11
steps:
- uses: actions/download-artifact@v3
with:
name: vscode-lsp-binary-x86_64-apple-darwin
- uses: actions/download-artifact@v3
with:
name: vscode-lsp-binary-aarch64-apple-darwin
path: bin
- name: Add macOS AArch64 binary to bundle
run: |
lipo -create -output tmp Slint\ Live\ Preview.app/Contents/MacOS/slint-lsp bin/slint-lsp-aarch64-apple-darwin
mv tmp Slint\ Live\ Preview.app/Contents/MacOS/slint-lsp
rm -rf bin
- name: "Upload LSP macOS bundle Artifact"
uses: actions/upload-artifact@v3
with:
name: vscode-lsp-binary-darwin
path: .
build_vscode_cross_linux_lsp:
env:
SLINT_NO_QT: 1
strategy:
matrix:
target:
- armv7-unknown-linux-gnueabihf
- aarch64-unknown-linux-gnu
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust
with:
target: ${{ matrix.target }}
- uses: baptiste0928/cargo-install@v2
with:
crate: cross
- name: Build LSP
run: cross build --target ${{ matrix.target }} --release -p slint-lsp
- name: Create artifact directory
run: |
mkdir bin
cp target/${{ matrix.target }}/release/slint-lsp bin/slint-lsp-${{ matrix.target }}
- name: "Upload LSP Artifact"
uses: actions/upload-artifact@v3
with:
name: vscode-lsp-binary-${{ matrix.target }}
path: |
bin
build_vscode_extension:
needs: [build_vscode_lsp_linux_windows, build_vscode_lsp_macos_bundle, build_vscode_cross_linux_lsp]
runs-on: macos-11
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: vscode-lsp-binary-x86_64-unknown-linux-gnu
path: editors/vscode/bin
- uses: actions/download-artifact@v3
with:
name: vscode-lsp-binary-x86_64-pc-windows-gnu
path: editors/vscode/bin
- uses: actions/download-artifact@v3
with:
name: vscode-lsp-binary-darwin
path: editors/vscode/bin
- uses: actions/download-artifact@v3
with:
name: vscode-lsp-binary-armv7-unknown-linux-gnueabihf
path: editors/vscode/bin
- uses: actions/download-artifact@v3
with:
name: vscode-lsp-binary-aarch64-unknown-linux-gnu
path: editors/vscode/bin
- name: Fix permissions
run: chmod 755 editors/vscode/bin/* editors/vscode/bin/*.app/Contents/MacOS/*
- uses: ./.github/actions/install-nodejs
- name: "Prepare meta-data files for nightly package"
env:
RELEASE_INPUT: ${{ github.event.inputs.release }}
working-directory: editors/vscode
run: |
if [ "$RELEASE_INPUT" != "true" ]; then
../../scripts/prepare_vscode_nightly.sh
fi
- name: "npm install"
working-directory: editors/vscode
run: npm install
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build package and optionally publish to Visual Studio Marketplace
id: publishToVSCM
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets.VSCODE_MARKETPLACE_PAT }}
registryUrl: https://marketplace.visualstudio.com
dryRun: ${{ github.event.inputs.private == 'true' || github.ref != 'refs/heads/master' }}
packagePath: editors/vscode
- name: Publish to Open VSX Registry
continue-on-error: true
if: ${{ github.event.inputs.private != 'true' && github.ref == 'refs/heads/master' }}
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets.OPENVSX_PAT }}
extensionFile: ${{ steps.publishToVSCM.outputs.vsixPath }}
packagePath: ''
- name: "Upload extension artifact"
uses: actions/upload-artifact@v3
with:
name: slint-vscode.zip
path: |
${{ steps.publishToVSCM.outputs.vsixPath }}
publish_tree_sitter:
if: github.event.inputs.private != 'true'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: tree-sitter-slint
path: editors/tree-sitter-slint
publish_artifacts:
if: github.event.inputs.private != 'true'
needs: [docs, wasm_demo, wasm]
runs-on: ubuntu-20.04
steps:
- uses: actions/download-artifact@v3
with:
name: docs
- uses: actions/download-artifact@v3
with:
name: slintpad
path: slintpad
- uses: actions/download-artifact@v3
with:
name: wasm
- uses: actions/download-artifact@v3
with:
name: wasm_demo
- name: Publish Docs and Demos
run: |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "${GITHUB_ACTOR}"
ssh-agent sh -c 'echo "${{ secrets.WWW_PUBLISH_SSH_KEY }}" | ssh-add - && git clone [email protected]:slint-ui/www.git --depth 1'
cd www
target_branch=${GITHUB_REF##*/}
rm -rf snapshots/$target_branch/demos
mkdir -p snapshots/$target_branch/demos
for demo_subdir in gallery, printerdemo,rust printerdemo_old,rust todo,rust slide_puzzle, memory, imagefilter, plotter, opengl_underlay, carousel,rust energy-monitor,; do
IFS=',' read demo subdir <<< "${demo_subdir}"
mkdir -p snapshots/$target_branch/demos/$demo
cp -a ../$demo/$subdir/{pkg,index.html} snapshots/$target_branch/demos/$demo/
done
git add snapshots/$target_branch/demos
git add -u snapshots/$target_branch/demos
rm -rf snapshots/$target_branch/wasm-interpreter
mkdir -p snapshots/$target_branch/wasm-interpreter
cp -a ../api/wasm-interpreter/pkg/* ./snapshots/$target_branch/wasm-interpreter/
git add snapshots/$target_branch/wasm-interpreter
git add -u snapshots/$target_branch/wasm-interpreter
rm -rf snapshots/$target_branch/editor
mkdir -p snapshots/$target_branch/editor
cp -a ../slintpad/* snapshots/$target_branch/editor/
git add snapshots/$target_branch/editor
git add -u snapshots/$target_branch/editor
rm -rf snapshots/$target_branch/docs
mkdir -p snapshots/$target_branch/docs
cp -a ../docs/site/* snapshots/$target_branch/docs
mkdir -p snapshots/$target_branch/docs/cpp
cp -a ../target/cppdocs/html/* snapshots/$target_branch/docs/cpp/
mkdir -p snapshots/$target_branch/docs/rust
cp -a ../target/doc/* snapshots/$target_branch/docs/rust/
# Fix up link to Slint language documentation
sed -i "s!https://slint.dev/releases/.*/docs/!../../!" snapshots/$target_branch/docs/rust/slint/*.html
for lang in rust cpp node; do
mkdir -p snapshots/$target_branch/docs/tutorial/$lang
cp -a ../docs/tutorial/$lang/book/html/* snapshots/$target_branch/docs/tutorial/$lang
done
mkdir -p snapshots/$target_branch/docs/node
cp -a ../api/node/docs/* snapshots/$target_branch/docs/node/
mkdir -p snapshots/$target_branch/docs/slint
cp -a ../target/slintdocs/html/* snapshots/$target_branch/docs/slint/
git add snapshots/$target_branch/docs
git add -u snapshots/$target_branch/docs
git commit --message "Update $NAME from $GITHUB_REPOSITORY" --message "Pull web demos and C++/Rust reference docs from commit $GITHUB_SHA ($GITHUB_REF)"
ssh-agent sh -c 'echo "${{ secrets.WWW_PUBLISH_SSH_KEY }}" | ssh-add - && git push origin master'
prepare_release:
if: github.event.inputs.private != 'true'
needs: [cpp_package, slint-viewer-binary, slint-lsp-binary]
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/download-artifact@v3
with:
name: cpp_bin
- uses: actions/download-artifact@v3
with:
name: slint-viewer-linux
- uses: actions/download-artifact@v3
with:
name: slint-viewer-windows
- uses: actions/download-artifact@v3
with:
name: slint-lsp-linux
- uses: actions/download-artifact@v3
with:
name: slint-lsp-windows
- name: Extract files
run: |
mkdir artifacts
mv Slint-cpp-*-win64.exe artifacts/
mv Slint-cpp-*-Linux-x86_64.tar.gz artifacts/
mv slint-viewer-linux.tar.gz artifacts/
mv slint-lsp-linux.tar.gz artifacts/
- uses: montudor/action-zip@v1
with:
args: zip -r artifacts/slint-viewer-windows.zip slint-viewer
- uses: montudor/action-zip@v1
with:
args: zip -r artifacts/slint-lsp-windows.zip slint-lsp
- uses: ncipollo/release-action@v1
if: github.event.inputs.release == 'true'
with:
draft: true
artifacts: "artifacts/*"
body: "[ChangeLog](https://github.com/slint-ui/slint/blob/master/CHANGELOG.md)"
name: "Draft Release"
tag: "change_me"
commit: ${{ github.sha }}