-
Notifications
You must be signed in to change notification settings - Fork 543
91 lines (88 loc) · 4.11 KB
/
wasm_demos.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
# Copyright © SixtyFPS GmbH <info@slint.dev>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
name: Build wasm demos
on:
workflow_dispatch:
workflow_call:
inputs:
rustflags:
type: string
description: extra rustflags
build_artifacts:
type: boolean
required: true
description: True if we should build all demos and produce artefacts
jobs:
wasm_demo:
env:
CARGO_PROFILE_RELEASE_OPT_LEVEL: s
CARGO_INCREMENTAL: false
RUSTFLAGS: ${{ github.event.inputs.rustflags || inputs.rustflags }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-rust
with:
target: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Printerdemo WASM build
run: |
sed -i "s/#wasm# //" Cargo.toml
wasm-pack build --release --target web
working-directory: examples/printerdemo/rust
- name: Gallery WASM build
if: ${{ inputs.build_artifacts }}
run: |
sed -i "s/#wasm# //" Cargo.toml
export SLINT_STYLE=fluent && wasm-pack build --release --out-dir pkg/fluent --target web
export SLINT_STYLE=material && wasm-pack build --release --out-dir pkg/material --target web
export SLINT_STYLE=cupertino && wasm-pack build --release --out-dir pkg/cupertino --target web
export SLINT_STYLE=cosmic && wasm-pack build --release --out-dir pkg/cosmic --target web
working-directory: examples/gallery
- name: Remaining wasm demos
if: ${{ inputs.build_artifacts }}
run: |
for demo in examples/printerdemo/rust examples/printerdemo_old/rust examples/todo/rust examples/todo-mvc/rust examples/carousel/rust examples/slide_puzzle examples/memory examples/imagefilter/rust examples/plotter examples/opengl_underlay; do
pushd $demo
sed -i "s/#wasm# //" Cargo.toml
wasm-pack build --release --target web
popd
done
- name: Energy Monitor example WASM build
if: ${{ inputs.build_artifacts }}
run: |
sed -i "s/#wasm# //" Cargo.toml
wasm-pack build --release --target web --no-default-features --features slint/default,chrono
working-directory: examples/energy-monitor
- name: Weather Demo example WASM build
run: |
sed -i "s/#wasm# //" Cargo.toml
wasm-pack build --release --target web --no-default-features --features slint/default,chrono
working-directory: examples/weather-demo
- name: "Upload Demo Artifacts"
if: ${{ inputs.build_artifacts }}
uses: actions/upload-artifact@v4
with:
name: wasm_demo
path: |
examples/gallery/
examples/printerdemo/rust/
examples/printerdemo_old/rust/
examples/todo/
examples/todo-mvc/rust/
examples/carousel/rust/
examples/memory/
examples/slide_puzzle/
examples/imagefilter/rust
examples/plotter/
examples/opengl_underlay/
examples/energy-monitor/
examples/weather-demo/
!/**/.gitignore
- name: Clean cache # Otherwise the cache is much too big
run: |
du -hs target
rm -rf target/*/incremental
rm -rf target/*/*/*slint*
du -hs target