Repository navigation
231 lines (210 loc) · 9.78 KB
/
Copy pathbuild-linux.yml
File metadata and controls
231 lines (210 loc) · 9.78 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
name: Build Linux
on:
workflow_call:
inputs:
cc:
required: true
type: string
cxx:
required: true
type: string
js-engine:
required: true
type: string
graphics-api:
required: false
type: string
default: OpenGL
enable-sanitizers:
required: false
type: boolean
default: false
env:
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1:symbolize=1
ASAN_OPTIONS: abort_on_error=1
# Absorb transient npm registry / CDN flakes during `npm install` in Apps/CMakeLists.txt.
# npm's default fetch-retries is 2; bump to 5 (npm's own exponential backoff handles spacing).
npm_config_fetch_retries: '5'
jobs:
build:
runs-on: ubuntu-latest
# Ubuntu_Clang_JSC (build + full validation run) takes ~28-29 minutes, so 30 caused spurious cancellations.
timeout-minutes: 180
env:
CC: ${{ inputs.cc }}
CXX: ${{ inputs.cxx }}
steps:
- uses: actions/checkout@v5
- name: Free disk space
if: inputs.js-engine == 'Hermes'
shell: pwsh
run: ./.github/scripts/free-disk-space.ps1
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y libjavascriptcoregtk-4.1-dev libgl1-mesa-dev libcurl4-openssl-dev libwayland-dev clang ninja-build ccache
if [ "${{ inputs.graphics-api }}" = "Vulkan" ]; then
sudo apt-get install -y libvulkan-dev mesa-vulkan-drivers xvfb xauth
fi
# Compiler cache. PRs only restore (they can read the cache saved by master pushes);
# only master pushes save, so PR runs don't churn the repository cache quota.
- name: Restore ccache
id: ccache
uses: actions/cache/restore@v5
with:
path: ${{ github.workspace }}/.ccache
key: ccache-${{ inputs.cc }}-${{ inputs.js-engine }}-${{ inputs.graphics-api }}-${{ inputs.enable-sanitizers }}-${{ github.sha }}
restore-keys: |
ccache-${{ inputs.cc }}-${{ inputs.js-engine }}-${{ inputs.graphics-api }}-${{ inputs.enable-sanitizers }}-
- name: Build X11
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_MAXSIZE: 500M
run: |
ccache --zero-stats
cmake -G Ninja -B build/Linux \
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D JAVASCRIPTCORE_LIBRARY=/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-4.1.so \
-D NAPI_JAVASCRIPT_ENGINE=${{ inputs.js-engine }} \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D BX_CONFIG_DEBUG=ON \
-D BABYLON_NATIVE_BGFX_TRACE=OFF \
-D GRAPHICS_API=${{ inputs.graphics-api }} \
-D OpenGL_GL_PREFERENCE=GLVND \
-D BABYLON_DEBUG_TRACE=ON \
-D BABYLON_NATIVE_PLUGIN_NATIVEDRACO=ON \
-D BABYLON_NATIVE_PLUGIN_NATIVEMESHOPT=ON \
${{ inputs.js-engine == 'Hermes' && '-D HERMES_UNICODE_LITE=ON -D HERMES_ALLOW_BOOST_CONTEXT=0' || '' }} \
-D ENABLE_SANITIZERS=${{ inputs.enable-sanitizers && 'ON' || 'OFF' }} .
ninja -C build/Linux
ccache --show-stats
- name: Save ccache
if: ${{ github.event_name == 'push' && success() }}
uses: actions/cache/save@v5
with:
path: ${{ github.workspace }}/.ccache
key: ${{ steps.ccache.outputs.cache-primary-key }}
- name: Enable Core Dump
run: sudo sysctl -w kernel.core_pattern=core.%p
- name: Select Vulkan software renderer
if: ${{ inputs.graphics-api == 'Vulkan' }}
run: |
VK_ICD_FILENAMES=$(find /usr/share/vulkan/icd.d -maxdepth 1 -name 'lvp_icd*.json' -print -quit)
test -n "$VK_ICD_FILENAMES"
echo "VK_ICD_FILENAMES=$VK_ICD_FILENAMES" >> "$GITHUB_ENV"
# Visual validation runs only on JavaScriptCore so results don't depend on
# engine-specific quirks of Hermes/QuickJS; the other engines still run
# UnitTests and ModuleLoadTest. Win32 applies the same rule with V8.
# Clang and GCC render the same Mesa software output, so only Clang runs it.
# --test-timeout fails a stuck test (or a native hang, via the watchdog) in
# minutes instead of letting it run into the job timeout. Sanitizer builds
# keep the default timeouts since instrumented decodes run much slower.
- name: Validation Tests
if: ${{ inputs.graphics-api != 'Vulkan' && inputs.js-engine == 'JavaScriptCore' && inputs.cc == 'clang' }}
run: |
cd build/Linux/Apps/Playground
ulimit -c unlimited
xvfb-run ./Playground ${{ !inputs.enable-sanitizers && '--test-timeout=120' || '' }} app:///Scripts/validation_native.js
# The full Vulkan suite currently has broad reference-image differences and
# crashes in Glow layer and LODs: https://github.com/BabylonJS/BabylonNative/issues/1878
- name: Vulkan Validation Tests
if: ${{ inputs.graphics-api == 'Vulkan' && inputs.js-engine == 'JavaScriptCore' }}
timeout-minutes: 5
run: |
cd build/Linux/Apps/Playground
ulimit -c unlimited
printf '%s\n' \
'globalThis._playgroundOptions = { saveResults: false, testIndices: [48, 53] };' \
> Scripts/vulkan_ci_options.js
set -o pipefail
xvfb-run --auto-servernum ./Playground \
app:///Scripts/vulkan_ci_options.js \
app:///Scripts/validation_native.js | tee vulkan-validation.log
test "$(grep -c '^Running ' vulkan-validation.log)" -eq 2
grep -Fx 'Running Capsule' vulkan-validation.log
grep -Fx 'Running Multi camera rendering' vulkan-validation.log
grep -Fx 'Run complete. ran=2 passed=2 failed=0 missingRef=0 skipped=0' vulkan-validation.log
- name: Unit Tests
run: |
cd build/Linux/Apps/UnitTests
ulimit -c unlimited
if [ "${{ inputs.graphics-api }}" = "Vulkan" ]; then
xvfb-run --auto-servernum ./UnitTests \
--gtest_output=xml:vulkan-unit-test-results.xml
else
xvfb-run ./UnitTests
fi
- name: Verify Vulkan Unit Test Results
if: ${{ inputs.graphics-api == 'Vulkan' }}
run: |
cd build/Linux/Apps/UnitTests
# Require both boundary tests, independent of unrelated additions to the suite.
python3 - <<'PY'
import xml.etree.ElementTree as ET
report = ET.parse("vulkan-unit-test-results.xml").getroot()
cases = report.findall(".//testcase")
expected = {
"ShaderCompilation.VulkanAcceptsSixteenSamplers",
"ShaderCompilation.VulkanRejectsMoreThanSixteenSamplers",
}
completed = {
f"{case.get('classname')}.{case.get('name')}"
for case in cases
if case.get("status") == "run" and case.get("result") == "completed"
and case.find("failure") is None and case.find("skipped") is None
}
if not expected.issubset(completed):
raise SystemExit("Both Vulkan sampler boundary tests must run and pass")
PY
- name: Module Load Test
if: ${{ !inputs.enable-sanitizers }}
run: |
cd build/Linux/Apps/ModuleLoadTest
ulimit -c unlimited
xvfb-run --auto-servernum ./ModuleLoadTest
- name: JsRuntimeHost Unit Tests
working-directory: build/Linux/Dependencies/JsRuntimeHost/Tests/UnitTests
run: |
ulimit -c unlimited
xvfb-run --auto-servernum ./JsRuntimeHostUnitTests
- name: UrlLib Unit Tests
working-directory: build/Linux/Dependencies/UrlLib/Tests
run: ./UrlLibTests
- name: Upload Vulkan Test Results
if: ${{ always() && inputs.graphics-api == 'Vulkan' }}
uses: actions/upload-artifact@v6
with:
name: ${{ inputs.cc }}-${{ inputs.js-engine }}-${{ inputs.graphics-api }}${{ inputs.enable-sanitizers && '-sanitizer' || '' }}-test-results
path: |
build/Linux/Apps/Playground/vulkan-validation.log
build/Linux/Apps/UnitTests/vulkan-unit-test-results.xml
- name: Upload Rendered Pictures
if: ${{ always() && inputs.js-engine == 'JavaScriptCore' }}
uses: actions/upload-artifact@v6
with:
name: ${{ inputs.cc }}-${{ inputs.js-engine }}-${{ inputs.graphics-api }}${{ inputs.enable-sanitizers && '-sanitizer' || '' }}-rendered-pictures
path: build/Linux/Apps/Playground/Results
- name: Upload Error Pictures
if: ${{ failure() && inputs.js-engine == 'JavaScriptCore' }}
uses: actions/upload-artifact@v6
with:
name: ${{ inputs.cc }}-${{ inputs.js-engine }}-${{ inputs.graphics-api }}${{ inputs.enable-sanitizers && '-sanitizer' || '' }}-error-pictures
path: build/Linux/Apps/Playground/Errors
- name: Upload Core Dumps
if: ${{ failure() }}
uses: actions/upload-artifact@v6
with:
name: ${{ inputs.cc }}-${{ inputs.js-engine }}-${{ inputs.graphics-api }}${{ inputs.enable-sanitizers && '-sanitizer' || '' }}-core-dumps
path: |
build/Linux/Apps/Playground/Playground
build/Linux/Apps/Playground/core.*
build/Linux/Apps/UnitTests/UnitTests
build/Linux/Apps/UnitTests/core.*
build/Linux/Apps/ModuleLoadTest/ModuleLoadTest
build/Linux/Apps/ModuleLoadTest/core.*
build/Linux/Dependencies/JsRuntimeHost/Tests/UnitTests/JsRuntimeHostUnitTests
build/Linux/Dependencies/JsRuntimeHost/Tests/UnitTests/core.*
build/Linux/Dependencies/UrlLib/Tests/UrlLibTests
build/Linux/Dependencies/UrlLib/Tests/core.*