-
-
Notifications
You must be signed in to change notification settings - Fork 29
395 lines (347 loc) · 15.2 KB
/
RaZ.yml
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
name: RaZ
on: [push, pull_request]
jobs:
#########
# Linux #
#########
linux:
name: "Linux (${{ matrix.compiler.c }}, ${{ matrix.build_type }}\
${{ !matrix.use_audio && ', no audio' || '' }}\
${{ !matrix.use_window && ', no window' || '' }})"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler:
- { c: gcc, cpp: g++ }
- { c: clang, cpp: clang++ }
build_type:
- Debug
- Release
use_audio:
- true
use_window:
- true
include:
- { compiler: { c: gcc, cpp: g++ }, build_type: Debug, use_audio: false, use_window: true }
- { compiler: { c: gcc, cpp: g++ }, build_type: Debug, use_audio: true, use_window: false }
steps:
- uses: actions/checkout@v4
# Installing the needed packages:
# - Ninja to build the project
# - GLEW & X11 as graphical dependencies
# - Lcov to output code coverage
# - Doxygen & Dot to generate the documentation
# - OpenAL-soft to handle the audio part
# - Xvfb to launch a headless server (allows GL context initialisation without a screen)
# - Gdb to run the unit tests with the debugger
# - Mesa-utils to get glxinfo
# Running glxinfo through xvfb to recover graphics capabilities
- name: Packages installation
run: |
sudo apt update && sudo apt install -y --no-install-recommends \
ninja-build \
libglew-dev libxi-dev libxcursor-dev libxrandr-dev libxinerama-dev libxxf86vm-dev \
lcov \
doxygen python3-pydot \
libopenal-dev \
xvfb \
gdb \
mesa-utils &&
xvfb-run -a glxinfo -B
# Installing the FBX SDK (in /usr)
# The installation asks for software user agreement (send 'yes'), then afterward if the README file should be opened (send 'n')
#- name: FBX SDK setup
# run: |
# wget http://download.autodesk.com/us/fbx/2019/2019.0/fbx20190_fbxsdk_linux.tar.gz -O ./fbx_sdk.tar.gz &&
# tar xvf ./fbx_sdk.tar.gz &&
# chmod +x ./fbx20190_fbxsdk_linux &&
# printf 'yes\nn' | sudo ./fbx20190_fbxsdk_linux /usr
- name: Build setup
run: cmake -E make_directory ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
- name: Configuration
shell: bash
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
run: |
cmake -GNinja \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_C_COMPILER=${{ matrix.compiler.c }} -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp }} \
-DRAZ_BUILD_EXAMPLES=ON -DRAZ_GEN_DOC=ON \
-DRAZ_USE_AUDIO=${{ matrix.use_audio && 'ON' || 'OFF' }} \
-DRAZ_USE_WINDOW=${{ matrix.use_window && 'ON' || 'OFF' }} \
-DRAZ_USE_IMGUI=${{ matrix.use_window && 'ON' || 'OFF' }} \
-DRAZ_USE_FBX=OFF -DRAZ_BUILD_TESTS=ON ${{ matrix.compiler.c == 'gcc' && '-DRAZ_ENABLE_COVERAGE=ON' || '' }} \
-DSKIP_RENDERER_ERRORS=ON -DENABLE_DEBUG_INFO=ON \
${{ github.workspace }} &&
cmake --build . --target RaZ_PrintDebugInfo --config ${{ matrix.build_type }}
- name: Build
shell: bash
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
run: |
cmake --build . --config ${{ matrix.build_type }} &&
pwd && find .
# Running all tests but rendering ones, using GDB to catch potential segfaults
# TODO: they are only run if windowing is enabled, as mesh loading functions notably depend on it to create mesh renderers, but they should not
- name: Test
if: matrix.use_window
shell: bash
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
run: |
ALSOFT_DRIVERS=null xvfb-run -a --server-args='-screen 0 1280x720x16' \
gdb --batch --return-child-result -x '${{ github.workspace }}/tests/assets/debug/gdb_commands.txt' --args ./tests/RaZ_Tests ~[render]
# Running only rendering tests, using GDB to catch potential segfaults; only done if windowing is enabled, as rendering tests depend on a graphical context
- name: Test (rendering)
if: matrix.use_window
shell: bash
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
run: |
ALSOFT_DRIVERS=null xvfb-run -a --server-args='-screen 0 1280x720x16' \
gdb --batch --return-child-result -x '${{ github.workspace }}/tests/assets/debug/gdb_commands.txt' --args ./tests/RaZ_Tests [render]
# Preparing code coverage; only done with GCC in Debug with all features enabled
- name: Coverage setup
if: matrix.compiler.c == 'gcc' && matrix.build_type == 'Debug' && matrix.use_audio && matrix.use_window
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
run: |
lcov -d ./CMakeFiles/RaZ.dir/src/ -c -o coverage.info &&
lcov -r coverage.info '/usr/*' '${{ github.workspace }}/extern/*' -o coverage.info &&
lcov -l coverage.info
# Processing code coverage; only done with GCC in Debug with all features enabled
- name: Coverage processing
if: matrix.compiler.c == 'gcc' && matrix.build_type == 'Debug' && matrix.use_audio && matrix.use_window
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}/coverage.info
# Installing RaZ in the build directory; default is /usr/local
- name: Install
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
run: sudo cmake --install . --prefix ./ --config ${{ matrix.build_type }}
- name: Upload build
if: matrix.use_audio && matrix.use_window
uses: actions/upload-artifact@v4
with:
name: RaZ-linux-${{ matrix.compiler.c }}-${{ matrix.build_type }}-${{ github.sha }}
path: |
${{ runner.workspace }}/build-${{ matrix.compiler.c }}/include
${{ runner.workspace }}/build-${{ matrix.compiler.c }}/lib
###########
# Windows #
###########
windows:
name: "Windows (${{ matrix.compiler.c }}, ${{ matrix.build_type }}\
${{ !matrix.use_audio && ', no audio' || '' }}\
${{ !matrix.use_window && ', no window' || '' }})"
runs-on: windows-2022
env:
OPENAL_VERSION: 1.23.1
strategy:
fail-fast: false
matrix:
compiler:
- { c: cl, cpp: cl }
build_type:
- Debug
- Release
use_audio:
- true
use_window:
- true
include:
- { compiler: { c: cl, cpp: cl }, build_type: Debug, use_audio: false, use_window: true }
- { compiler: { c: cl, cpp: cl }, build_type: Debug, use_audio: true, use_window: false }
steps:
- uses: actions/checkout@v4
# Caching OpenAL-Soft's installation; this avoids reinstalling it on every build
- name: OpenAL-Soft caching
if: matrix.use_audio
uses: actions/cache@v4
id: openal-soft
with:
path: C:/OpenAL
key: openal-soft-${{ env.OPENAL_VERSION }}
restore-keys: |
openal-soft-${{ env.OPENAL_VERSION }}
# Downloading & installing OpenAL-Soft to handle the audio part; only done when failed to find its cached installation
- name: OpenAL-Soft setup
if: matrix.use_audio && steps.openal-soft.outputs.cache-hit != 'true'
run: |
curl -sSkLO https://github.com/kcat/openal-soft/releases/download/${{ env.OPENAL_VERSION }}/openal-soft-${{ env.OPENAL_VERSION }}-bin.zip &&
7z x openal-soft-${{ env.OPENAL_VERSION }}-bin.zip &&
mv openal-soft-${{ env.OPENAL_VERSION }}-bin C:/OpenAL
- name: Build setup
run: cmake -E make_directory ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
- name: Configuration
shell: bash
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
run: |
cmake -G"Visual Studio 17 2022" -A x64 \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DRAZ_BUILD_EXAMPLES=ON -DRAZ_GEN_DOC=OFF \
-DRAZ_USE_AUDIO=${{ matrix.use_audio && 'ON' || 'OFF' }} \
-DRAZ_USE_WINDOW=${{ matrix.use_window && 'ON' || 'OFF' }} \
-DRAZ_USE_IMGUI=${{ matrix.use_window && 'ON' || 'OFF' }} \
-DRAZ_USE_FBX=OFF -DRAZ_BUILD_TESTS=ON \
-DSKIP_RENDERER_ERRORS=ON -DENABLE_DEBUG_INFO=ON \
$GITHUB_WORKSPACE &&
cmake --build . --target RaZ_PrintDebugInfo --config ${{ matrix.build_type }}
- name: Build
shell: bash
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
run: |
cmake --build . --config ${{ matrix.build_type }} &&
pwd && find .
- name: Install
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
run: cmake --install . --prefix C:/RaZ --config ${{ matrix.build_type }}
- name: Upload build
if: matrix.use_audio && matrix.use_window
uses: actions/upload-artifact@v4
with:
name: RaZ-windows-${{ matrix.compiler.c }}-${{ matrix.build_type }}-${{ github.sha }}
path: |
C:/RaZ
#########
# macOS #
#########
macos:
name: "macOS (${{ matrix.compiler.c }}, ${{ matrix.build_type }}\
${{ !matrix.use_audio && ', no audio' || '' }}\
${{ !matrix.use_window && ', no window' || '' }})"
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
compiler:
- { c: clang, cpp: clang++ }
build_type:
- Debug
- Release
use_audio:
- true
use_window:
- true
include:
- { compiler: { c: clang, cpp: clang++ }, build_type: Debug, use_audio: false, use_window: true }
- { compiler: { c: clang, cpp: clang++ }, build_type: Debug, use_audio: true, use_window: false }
steps:
- uses: actions/checkout@v4
# Installing the needed packages:
# - Ninja to build the project
# - OpenAL-soft to handle the audio part
- name: Packages installation
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install \
ninja \
openal-soft
- name: Build setup
run: cmake -E make_directory ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
- name: Configuration
shell: bash
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
run: |
cmake -GNinja \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_C_COMPILER=${{ matrix.compiler.c }} -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp }} \
-DRAZ_BUILD_EXAMPLES=ON -DRAZ_GEN_DOC=OFF \
-DRAZ_USE_AUDIO=${{ matrix.use_audio && 'ON' || 'OFF' }} \
-DRAZ_USE_WINDOW=${{ matrix.use_window && 'ON' || 'OFF' }} \
-DRAZ_USE_IMGUI=${{ matrix.use_window && 'ON' || 'OFF' }} \
-DRAZ_USE_FBX=OFF -DRAZ_BUILD_TESTS=ON \
-DSKIP_RENDERER_ERRORS=ON -DENABLE_DEBUG_INFO=ON \
$GITHUB_WORKSPACE &&
cmake --build . --target RaZ_PrintDebugInfo --config ${{ matrix.build_type }}
- name: Build
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
shell: bash
run: |
cmake --build . --config ${{ matrix.build_type }} &&
pwd && find .
# Installing RaZ in the build directory; default is /usr/local
- name: Install
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
run: sudo cmake --install . --prefix ./ --config ${{ matrix.build_type }}
- name: Upload build
if: matrix.use_audio && matrix.use_window
uses: actions/upload-artifact@v4
with:
name: RaZ-macos-${{ matrix.compiler.c }}-${{ matrix.build_type }}-${{ github.sha }}
path: |
${{ runner.workspace }}/build-${{ matrix.compiler.c }}/include
${{ runner.workspace }}/build-${{ matrix.compiler.c }}/lib
##############
# Emscripten #
##############
emscripten:
name: "Emscripten (${{ matrix.compiler.c }}, ${{ matrix.build_type }}\
${{ !matrix.use_audio && ', no audio' || '' }})"
runs-on: ubuntu-latest
env:
EMSCRIPTEN_VERSION: 3.1.0 # The 'latest' version may fail to build
strategy:
fail-fast: false
matrix:
compiler:
- { c: emcc, cpp: em++ }
build_type:
- Debug
- Release
use_audio:
- true
include:
- { compiler: { c: emcc, cpp: em++ }, build_type: Debug, use_audio: false }
steps:
- uses: actions/checkout@v4
# Installing the needed packages:
# - Ninja to build the project
# - GL & X11 as needed graphical dependencies
# - OpenAL-soft to handle the audio part
- name: Packages installation
run: |
sudo apt update && sudo apt install -y --no-install-recommends \
ninja-build \
libglew-dev libxi-dev libxcursor-dev libxrandr-dev libxinerama-dev libxxf86vm-dev \
libopenal-dev
#- name: FBX SDK setup
# run: |
# wget http://download.autodesk.com/us/fbx/2019/2019.0/fbx20190_fbxsdk_linux.tar.gz -O ./fbx_sdk.tar.gz &&
# tar xvf ./fbx_sdk.tar.gz &&
# chmod +x ./fbx20190_fbxsdk_linux &&
# printf 'yes\nn' | ./fbx20190_fbxsdk_linux /usr
# Caching Emscripten's installation; this avoids reinstalling it on every build
- name: Emscripten caching
uses: actions/cache@v4
id: emsdk
with:
path: ~/emsdk
key: emsdk-${{ env.EMSCRIPTEN_VERSION }}
restore-keys: |
emsdk-${{ env.EMSCRIPTEN_VERSION }}
# Downloading & installing Emscripten; only done when failed to find its cached installation
- name: Emscripten setup
if: steps.emsdk.outputs.cache-hit != 'true'
shell: bash
run: |
git clone --depth 1 https://github.com/emscripten-core/emsdk.git ~/emsdk &&
~/emsdk/emsdk install ${{ env.EMSCRIPTEN_VERSION }} && ~/emsdk/emsdk activate ${{ env.EMSCRIPTEN_VERSION }}
- name: Build setup
shell: bash
run: cmake -E make_directory ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
- name: Configuration
shell: bash
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
run: |
source ~/emsdk/emsdk_env.sh &&
emcmake cmake -GNinja \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DRAZ_BUILD_EXAMPLES=ON -DRAZ_GEN_DOC=OFF \
-DRAZ_USE_AUDIO=${{ matrix.use_audio && 'ON' || 'OFF' }} \
-DRAZ_USE_FBX=OFF -DRAZ_BUILD_TESTS=ON ${{ matrix.build_type == 'Debug' && '-DRAZ_EMSCRIPTEN_DEBUG_FAST_LINK=ON' || '' }} \
-DSKIP_RENDERER_ERRORS=ON -DENABLE_DEBUG_INFO=ON \
$GITHUB_WORKSPACE &&
cmake --build . --target RaZ_PrintDebugInfo --config ${{ matrix.build_type }}
- name: Build
shell: bash
working-directory: ${{ runner.workspace }}/build-${{ matrix.compiler.c }}
run: |
cmake --build . --config ${{ matrix.build_type }} &&
pwd && find .