@@ -88,6 +88,135 @@ jobs:
88
88
token : ${{ secrets.CODECOV_TOKEN }}
89
89
verbose : true
90
90
91
+ build-wasm :
92
+ name : Ubuntu 22.04 (wasm_32) Qt 6
93
+ needs : [clang_format, license_check, rust_format_check, markdown_lint, shellcheck]
94
+ runs-on : ubuntu-22.04
95
+ env :
96
+ SCCACHE_CACHE_SIZE : 600M
97
+ steps :
98
+ - name : " Checkout repository"
99
+ uses : actions/checkout@v4
100
+ - name : Setup toolchain
101
+ run : |
102
+ rustup component add clippy rustfmt
103
+ rustup target add wasm32-unknown-emscripten
104
+ - name : " Rust tools cache"
105
+ uses : actions/cache@v4
106
+ id : rust-tools-cache
107
+ with :
108
+ path : |
109
+ ~/.cargo/bin/sccache
110
+ ~/.cargo/bin/mdbook
111
+ ~/.cargo/bin/mdbook-linkcheck
112
+ key : ubuntu-22.04_sccache-0.7.6_mdbook-0.4.36_mdbook-linkcheck-0.7.7
113
+ - name : " Build Rust tools"
114
+ if : steps.rust-tools-cache.outputs.cache-hit != 'true'
115
+ # Do not build with storage backends enabled, we only need local
116
+ run : |
117
+ cargo install --no-default-features sccache
118
+ cargo install mdbook mdbook-linkcheck
119
+ # We want our compiler cache to always update to the newest state.
120
+ # The best way for us to achieve this is to **always** update the cache after every landed commit.
121
+ # That way it will closely follow our development.
122
+ # And if a PR diverges a lot with its cache that's not a big deal, as it will be merged eventually.
123
+ #
124
+ # This is a workaround for the fact that GH doesn't support updating existing caches.
125
+ # See: https://github.com/azu/github-actions-overwrite-cache-example
126
+ #
127
+ # Ideally we'd like to use this:
128
+ # - name: "Compiler cache"
129
+ # uses: actions/cache@v4
130
+ # with:
131
+ # update: true <------- THIS DOESN'T EXIST YET
132
+ # path: /home/runner/.cache/sccache
133
+ # key: "Ubuntu 22.04 (wasm_32) Qt6_compiler_cache"
134
+ - name : " Restore Compiler Cache"
135
+ id : compiler-cache-restore
136
+ uses : actions/cache/restore@v4
137
+ with :
138
+ path : /home/runner/.cache/sccache
139
+ key : " Ubuntu 22.04 (wasm_32) Qt6_compiler_cache"
140
+ - name : " emsdk cache"
141
+ uses : actions/cache@v4
142
+ id : emsdk-cache
143
+ with :
144
+ path : ./emsdk
145
+ key : emsdk_2.0.14
146
+ - name : " Setup emsdk"
147
+ if : steps.emsdk-cache.outputs.cache-hit != 'true'
148
+ run : |
149
+ git clone https://github.com/emscripten-core/emsdk
150
+ ./emsdk/emsdk install 2.0.14
151
+ ./emsdk/emsdk activate 2.0.14
152
+ - name : " Install Dependencies"
153
+ run : sudo apt-get update && sudo apt-get install -y ninja-build clang-format-12
154
+ - name : Install Qt GCC
155
+ uses : jurplel/install-qt-action@v3
156
+ with :
157
+ aqtversion : ' ==3.1.*'
158
+ version : ' 6.2.4'
159
+ host : ' linux'
160
+ target : ' desktop'
161
+ arch : ' gcc_64'
162
+ cache : true
163
+ - name : Install Qt WASM
164
+ uses : jurplel/install-qt-action@v3
165
+ with :
166
+ aqtversion : ' ==3.1.*'
167
+ version : ' 6.2.4'
168
+ host : ' linux'
169
+ target : ' desktop'
170
+ arch : ' wasm_32'
171
+ tools : ' tools_cmake'
172
+ cache : true
173
+ - name : " Configure"
174
+ # FIXME: ninja is not being found?
175
+ env :
176
+ RUSTC_WRAPPER : sccache
177
+ run : |
178
+ source ./emsdk/emsdk_env.sh
179
+ /home/runner/work/cxx-qt/Qt/6.2.4/wasm_32/bin/qt-cmake -DQT_HOST_PATH=/home/runner/work/cxx-qt/Qt/6.2.4/gcc_64 -DBUILD_WASM=ON -Bbuild .
180
+ - name : " Build"
181
+ env :
182
+ RUSTC_WRAPPER : sccache
183
+ run : cmake --build build --parallel 4
184
+ - name : Test output files exist
185
+ run : |
186
+ test -f ./build/examples/qml_minimal/example_qml_minimal.html
187
+ test -f ./build/examples/qml_minimal/example_qml_minimal.js
188
+ test -f ./build/examples/qml_minimal/libqml_minimal.a
189
+ test -x ./build/examples/qml_minimal/example_qml_minimal.wasm
190
+ test -f ./build/examples/qml_minimal/qtloader.js
191
+ test -f ./build/examples/qml_features/example_qml_features.html
192
+ test -f ./build/examples/qml_features/example_qml_features.js
193
+ test -f ./build/examples/qml_features/libqml_features.a
194
+ test -x ./build/examples/qml_features/example_qml_features.wasm
195
+ test -f ./build/examples/qml_features/qtloader.js
196
+ - name : " Print compiler cache statistics"
197
+ run : sccache --show-stats
198
+ # This is a workaround for the fact that GH doesn't support updating existing caches.
199
+ # See: https://github.com/azu/github-actions-overwrite-cache-example
200
+ - name : " Delete previous compiler cache"
201
+ # Updating th cache doesn't work from forks
202
+ # So update it once it's merged into the repo
203
+ if : ${{ steps.compiler-cache-restore.outputs.cache-hit && github.event_name == 'push' }}
204
+ working-directory : /home/runner/cxx-qt
205
+ continue-on-error : true
206
+ run : |
207
+ gh extension install actions/gh-actions-cache
208
+ gh actions-cache delete "Ubuntu 22.04 (wasm_32) Qt6_compiler_cache" --confirm
209
+ env :
210
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
211
+ - name : " Save Compiler Cache"
212
+ # Updating th cache doesn't work from forks
213
+ # So update it once it's merged into the repo
214
+ if : ${{ github.event_name == 'push' }}
215
+ uses : actions/cache/save@v4
216
+ with :
217
+ path : /home/runner/.cache/sccache
218
+ key : " Ubuntu 22.04 (wasm_32) Qt6_compiler_cache"
219
+
91
220
build :
92
221
# Run after pre checks
93
222
needs : [clang_format, license_check, rust_format_check, markdown_lint, shellcheck]
0 commit comments