-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (94 loc) · 3.31 KB
/
Copy pathwasm-demo.yml
File metadata and controls
108 lines (94 loc) · 3.31 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
name: WASM Demo
# Builds the self-contained WebAssembly bank GUI (examples/bank/gui_wasm) and
# publishes it to GitHub Pages under /demo/, alongside the Doxygen docs at the
# site root. Single-threaded Qt-for-WASM ⇒ no SharedArrayBuffer ⇒ no COOP/COEP
# headers ⇒ plain Pages hosting works.
on:
push:
branches:
- master
paths:
- 'examples/bank/**'
- 'include/morph/**'
- '.github/workflows/wasm-demo.yml'
pull_request:
branches:
- master
paths:
- 'examples/bank/**'
- 'include/morph/**'
- '.github/workflows/wasm-demo.yml'
concurrency:
group: wasm-demo-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
env:
QT_VERSION: 6.8.3
EMSDK_VERSION: 3.1.56 # the emscripten Qt 6.8 was built against
jobs:
build-wasm:
name: Build & deploy WASM demo
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install build tools
run: |
sudo apt-get update -q
sudo apt-get install -y ninja-build
# aqtinstall gives a matched host + wasm Qt pair (same cmake glue), so no
# host/target version skew.
- name: Install Qt (host desktop)
uses: jurplel/install-qt-action@v4
with:
version: ${{ env.QT_VERSION }}
host: linux
target: desktop
arch: linux_gcc_64
dir: ${{ runner.temp }}/qt
# Qt 6.7+ ships WebAssembly under host=all_os / target=wasm (not
# linux/desktop). The matching host desktop Qt above provides the tools.
- name: Install Qt (wasm, single-threaded)
uses: jurplel/install-qt-action@v4
with:
version: ${{ env.QT_VERSION }}
host: all_os
target: wasm
arch: wasm_singlethread
dir: ${{ runner.temp }}/qt
- name: Set up emsdk
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ env.EMSDK_VERSION }}
actions-cache-folder: emsdk-cache
- name: Configure
run: |
export EM_CACHE="$PWD/.emcache"
mkdir -p "$EM_CACHE"
HOST=${{ runner.temp }}/qt/Qt/${{ env.QT_VERSION }}/gcc_64
WASM=${{ runner.temp }}/qt/Qt/${{ env.QT_VERSION }}/wasm_singlethread
# The all_os/wasm package extracts its scripts without the exec bit.
chmod +x "$WASM"/bin/* || true
"$WASM/bin/qt-cmake" -S . -B build-wasm -G Ninja \
-DQT_HOST_PATH="$HOST" \
-DMORPH_BUILD_EXAMPLES=ON -DMORPH_BUILD_BANK_EXAMPLE=ON \
-DMORPH_BUILD_BANK_GUI=ON -DMORPH_BUILD_TESTS=OFF
- name: Build
run: |
export EM_CACHE="$PWD/.emcache"
cmake --build build-wasm --target bank_gui_wasm
- name: Stage bundle
run: |
mkdir -p site
BIN=build-wasm/examples/bank/gui_wasm
cp "$BIN"/bank_gui_wasm.js "$BIN"/bank_gui_wasm.wasm "$BIN"/qtloader.js site/
# Serve the Qt loader page as the directory index.
cp "$BIN"/bank_gui_wasm.html site/index.html
- name: Deploy to GitHub Pages (/demo)
if: github.ref == 'refs/heads/master'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: site
target-folder: demo
clean: false # leave the Doxygen docs at the site root untouched