-
Notifications
You must be signed in to change notification settings - Fork 120
212 lines (187 loc) · 7.49 KB
/
Copy pathwasm_build.yml
File metadata and controls
212 lines (187 loc) · 7.49 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
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
name: wasm_build
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
###########################################################
pre_job:
###########################################################
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
# All of these options are optional, so you can remove them if you are happy with the defaults
concurrent_skipping: 'same_content'
do_not_skip: '["pull_request", "workflow_dispatch"]'
###########################################################
wasm_build:
###########################################################
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
target: [linux, darwin, windows]
architecture: [ 64 ]
cmake_preset: [ Release ]
include:
- target: linux
runner: ubuntu-latest
- target: darwin
runner: macos-latest
- target: windows
runner: windows-latest
- target: windows
architecture: 64
architecture_string: x64
steps:
- name: "SCM Checkout"
uses: actions/checkout@v4
- name: "Exclude workspace from Windows Defender"
if: runner.os == 'Windows'
shell: pwsh
continue-on-error: true
# Defender real-time scan of freshly-written .obj/.exe/.dll slows the build
# and can momentarily lock a just-linked exe (the "Access is denied" deploy
# race). Exclude the workspace + toolchain writers and try to disable RTP;
# the status dump records whether the runner image actually honored it
# (managed Defender / Tamper Protection may silently no-op).
# continue-on-error: a managed-Defender runner must not fail the job.
run: |
Add-MpPreference -ExclusionPath "${{ github.workspace }}" -ErrorAction SilentlyContinue
foreach ($p in 'daslang.exe','daslang_static.exe','test_aot.exe','cl.exe','link.exe','lld-link.exe','mt.exe','vctip.exe','mspdbsrv.exe','vcpkg.exe') {
Add-MpPreference -ExclusionProcess $p -ErrorAction SilentlyContinue
}
Set-MpPreference -DisableRealtimeMonitoring $true -ErrorAction SilentlyContinue
Get-MpComputerStatus | Select-Object RealTimeProtectionEnabled, IsTamperProtected
Get-MpPreference | Select-Object -ExpandProperty ExclusionPath
- uses: lukka/get-cmake@latest
- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: "Install: Required Dev Packages"
run: |
set -eux
git clone https://github.com/emscripten-core/emsdk.git
case "${{ matrix.target }}${{ matrix.architecture }}" in
linux64)
echo "MARCH=64" >> $GITHUB_ENV
sudo apt-get update -y
sudo apt-get install --no-install-recommends -y \
libatomic-ops-dev \
libglu1-mesa-dev \
freeglut3-dev \
mesa-common-dev \
libglfw3-dev \
libfreetype6-dev \
libudev-dev \
libopenal-dev \
libvorbis-dev \
libflac-dev \
libclang-dev \
libx11-dev \
libxrandr-dev \
libxcursor-dev \
libxinerama-dev \
libxi-dev
./emsdk/emsdk install latest
./emsdk/emsdk activate latest
source "/home/runner/work/daScript/daScript/emsdk/emsdk_env.sh"
;;
windows*)
./emsdk/emsdk install latest
./emsdk/emsdk activate latest
./emsdk/emsdk_env.bat
;;
*)
# macOS stock bison is 2.3; install Homebrew bison 3.x and shadow
# the system one on PATH so any FIND_FLEX_AND_BISON pickup is sane.
if [[ "$(uname -m)" == "arm64" ]]; then
brew install bison
echo 'export PATH="/opt/homebrew/opt/bison/bin:$PATH"' >> ~/.bash_profile
export PATH="/opt/homebrew/opt/bison/bin:$PATH"
else
brew install bison
echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile
export PATH="/usr/local/opt/bison/bin:$PATH"
fi
./emsdk/emsdk install latest
./emsdk/emsdk activate latest
source "/Users/runner/work/daScript/daScript/emsdk/emsdk_env.sh"
;;
esac
- name: "Build: daslang web"
run: |
set -eux
cd web
rm -r -f cmake_temp
mkdir cmake_temp
cd cmake_temp
cmake -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake_preset }} -DDAS_FLEX_BISON_DISABLED=ON -G Ninja -DCMAKE_TOOLCHAIN_FILE=../emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake ../
ninja
- name: "Test: hello world via Node.js"
run: |
set -eux
# Use emsdk-bundled Node (deterministic version that supports the
# --experimental-wasm-exnref flag). System Node may be older or use
# a different spelling for the EH proposal flag.
source ./emsdk/emsdk_env.sh
cd web
# Modern wasm EH proposal (try_table / exnref) is gated in Node 22.
# Default-on in Node 24+. Force-enable for forward compat with current LTS.
"$EMSDK_NODE" --experimental-wasm-exnref test/dastest_wasm.js ../ ./output
###########################################################
wasm_cross:
###########################################################
# Cross-compile utility mains to wasm32 via dasLLVM and execute under
# wasmtime. Smoke-tests the runtime-linked cross-compile pipeline
# end-to-end (see modules/dasLLVM/README.md "Cross-compilation").
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- name: "SCM Checkout"
uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: Setup Emscripten
uses: emscripten-core/setup-emsdk@v11
with:
# 5.0.7 ships clang commit 7b58716d that crashes in
# TextDiagnostic::emitSnippetAndCaret on utils/dasFormatter/ds_parser.cpp
# (std::length_error during diagnostic snippet rendering). 5.0.3 works.
version: '5.0.3'
- name: Setup Wasmtime
uses: bytecodealliance/actions/wasmtime/setup@v1
with:
version: "44.0.1"
- name: "Install: graphics dev libs"
run: |
set -eux
sudo apt-get update -y
# OpenGL + GLFW headers needed by dasGlfw (enabled by default in host
# cmake). Same set as extended_checks.yml.
sudo apt-get install --no-install-recommends -y \
mesa-common-dev libglu1-mesa-dev libgl1-mesa-dev libglfw3-dev \
libx11-dev libxrandr-dev libxcursor-dev libxinerama-dev libxi-dev
- name: "Build + run cross-compiled wasm examples"
run: |
set -eux
cd web
mkdir -p cmake_temp && cd cmake_temp
emcmake cmake -DCMAKE_BUILD_TYPE=Release -DDAS_FLEX_BISON_DISABLED=ON -G Ninja ..
ninja run_wasm_examples