-
Notifications
You must be signed in to change notification settings - Fork 22
639 lines (569 loc) · 25 KB
/
Draft-Release.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
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
# Perform thorough builds, and potentially create a draft CI workflow.
name: Draft Release
on:
# Trigger on pushes to matching tags.
push:
tags:
- 'v*.*.*'
# Or on pull_requests which mutate this CI workflow, using pr rather than push:branch to ensure that the merged state will be OK, as that is what is important here.
pull_request:
paths:
- ".github/workflows/Draft-Release.yml"
# Or trigger on manual dispatch. This will not produce a release, but will perform the thorough build.
workflow_dispatch:
defaults:
run:
# Default to using bash regardless of OS unless otherwise specified.
shell: bash
# @todo - add a job/step which validates the version is of the correct format (for pre releases) and that the git tag matches the CMake/header version(s)
# Several jobs with some dependencies between them.
# + Thorough Ubuntu builds
# + Oldest and newest cuda, lots of arch, vis off, tests on
# + Thorough Windows builds
# + Oldest and newest cuda, lots of arch, vis off, tests on
# + Wheel producing manylinux builds
# + CUDA 11.2 and 12.0, py 3.8-3.12, vis on/off, py only.
# + Wheel producing Windows builds
# + CUDA 11.2 and 12.0, py 3.8-3.12, vis on/off, py only.
# + Draft github release workflow.
jobs:
build-ubuntu:
runs-on: ${{ matrix.cudacxx.os }}
strategy:
fail-fast: false
# Multiplicative build matrix
# optional exclude: can be partial, include: must be specific
matrix:
# CUDA_ARCH values are reduced compared to wheels due to CI memory issues while compiling the test suite.
cudacxx:
- cuda: "12.0"
cuda_arch: "50-real;90-real;90-virtual;"
hostcxx: gcc-11
os: ubuntu-22.04
- cuda: "11.8"
cuda_arch: "35-real;90-real;90-virtual"
hostcxx: gcc-9
os: ubuntu-20.04
- cuda: "11.2"
cuda_arch: "35-real;80-real;80-virtual"
hostcxx: gcc-8
os: ubuntu-20.04
python:
- "3.8"
config:
- name: "Release"
config: "Release"
SEATBELTS: "ON"
VISUALISATION:
- "OFF"
# Name the job based on matrix/env options
name: "build-ubuntu (${{ matrix.cudacxx.cuda }}, ${{matrix.python}}, ${{ matrix.VISUALISATION }}, ${{ matrix.config.name }}, ${{ matrix.cudacxx.os }})"
# Define job-wide env constants, and promote matrix elements to env constants for portable steps.
env:
# Define constants
BUILD_DIR: "build"
FLAMEGPU_BUILD_TESTS: "ON"
# Conditional based on matrix via awkward almost ternary
FLAMEGPU_BUILD_PYTHON: ${{ fromJSON('{true:"ON",false:"OFF"}')[matrix.python != ''] }}
# Port matrix options to environment, for more portability.
CUDA: ${{ matrix.cudacxx.cuda }}
CUDA_ARCH: ${{ matrix.cudacxx.cuda_arch }}
HOSTCXX: ${{ matrix.cudacxx.hostcxx }}
OS: ${{ matrix.cudacxx.os }}
CONFIG: ${{ matrix.config.config }}
FLAMEGPU_SEATBELTS: ${{ matrix.config.SEATBELTS }}
PYTHON: ${{ matrix.python}}
VISUALISATION: ${{ matrix.VISUALISATION }}
steps:
- uses: actions/checkout@v3
- name: Install CUDA
if: ${{ startswith(env.OS, 'ubuntu') && env.CUDA != '' }}
env:
cuda: ${{ env.CUDA }}
run: .github/scripts/install_cuda_ubuntu.sh
- name: Install/Select gcc and g++
if: ${{ startsWith(env.HOSTCXX, 'gcc-') }}
run: |
gcc_version=${HOSTCXX//gcc-/}
sudo apt-get install -y gcc-${gcc_version} g++-${gcc_version}
echo "CC=/usr/bin/gcc-${gcc_version}" >> $GITHUB_ENV
echo "CXX=/usr/bin/g++-${gcc_version}" >> $GITHUB_ENV
echo "CUDAHOSTCXX=/usr/bin/g++-${gcc_version}" >> $GITHUB_ENV
- name: Select Python
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON }}
- name: Install python dependencies
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
run: |
sudo apt-get install python3-venv
python3 -m pip install --upgrade wheel build setuptools
- name: Install Visualisation Dependencies
if: ${{ startswith(env.OS, 'ubuntu') && env.VISUALISATION == 'ON' }}
run: |
# Install ubuntu-20.04 packages
if [ "$OS" == 'ubuntu-20.04' ]; then
sudo apt-get install -y libglew-dev libfontconfig1-dev libsdl2-dev libdevil-dev libfreetype-dev
fi
# Install Ubuntu 18.04 packages
if [ "$OS" == 'ubuntu-18.04' ]; then
sudo apt-get install -y libglew-dev libfontconfig1-dev libsdl2-dev libdevil-dev libfreetype6-dev libgl1-mesa-dev
fi
- name: Install Swig >= 4.0.2
run: |
# Remove existing swig install, so CMake finds the correct swig
if [ "$OS" == 'ubuntu-20.04' ]; then
sudo apt-get remove -y swig swig4.0
fi
# Install Ubuntu 18.04 packages
if [ "$OS" == 'ubuntu-18.04' ]; then
sudo apt-get remove -y swig
fi
# Install additional apt-based dependencies required to build swig 4.0.2
sudo apt-get install -y bison
# Create a local directory to build swig in.
mkdir -p swig-from-source && cd swig-from-source
# Install SWIG building from source dependencies
wget https://github.com/swig/swig/archive/refs/tags/v4.0.2.tar.gz
tar -zxf v4.0.2.tar.gz
cd swig-4.0.2/
./autogen.sh
./configure
make
sudo make install
# This pre-emptively patches a bug where ManyLinux didn't generate buildnumber as git dir was owned by diff user
- name: Enable git safe-directory
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Configure cmake
run: >
cmake . -B "${{ env.BUILD_DIR }}"
-DCMAKE_BUILD_TYPE="${{ env.CONFIG }}"
-Werror=dev
-DCMAKE_WARN_DEPRECATED="OFF"
-DFLAMEGPU_WARNINGS_AS_ERRORS="ON"
-DCMAKE_CUDA_ARCHITECTURES="${{ env.CUDA_ARCH }}"
-DFLAMEGPU_BUILD_TESTS="${{ env.FLAMEGPU_BUILD_TESTS }}"
-DFLAMEGPU_BUILD_PYTHON="${{ env.FLAMEGPU_BUILD_PYTHON }}"
-DPYTHON3_EXACT_VERSION="${{ env.PYTHON }}"
-DFLAMEGPU_VISUALISATION="${{ env.VISUALISATION }}"
-DFLAMEGPU_ENABLE_NVTX="ON"
- name: Build static library
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --target flamegpu --verbose -j `nproc`
- name: Build python wheel
if: ${{ env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --target pyflamegpu --verbose -j `nproc`
- name: Build tests
if: ${{ env.FLAMEGPU_BUILD_TESTS == 'ON' }}
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --target tests --verbose -j `nproc`
- name: Build all remaining targets
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --target all --verbose -j `nproc`
# Thorough Windows builds
build-windows:
runs-on: ${{ matrix.cudacxx.os }}
strategy:
fail-fast: false
# Multiplicative build matrix
# optional exclude: can be partial, include: must be specific
matrix:
# CUDA_ARCH values are reduced compared to wheels due to CI memory issues while compiling the test suite.
cudacxx:
- cuda: "12.0.0"
cuda_arch: "50-real;90-real;90-virtual"
hostcxx: "Visual Studio 17 2022"
os: windows-2022
- cuda: "11.8.0"
cuda_arch: "35-real;90-real;90-virtual"
hostcxx: "Visual Studio 16 2019"
os: windows-2019
- cuda: "11.2.2"
cuda_arch: "35-real;80-real;80-virtual"
hostcxx: "Visual Studio 16 2019"
os: windows-2019
python:
- "3.8"
config:
- name: "Release"
config: "Release"
SEATBELTS: "ON"
VISUALISATION:
- "OFF"
# Name the job based on matrix/env options
name: "build-windows (${{ matrix.cudacxx.cuda }}, ${{matrix.python}}, ${{ matrix.VISUALISATION }}, ${{ matrix.config.name }}, ${{ matrix.cudacxx.os }})"
# Define job-wide env constants, and promote matrix elements to env constants for portable steps.
env:
# Define constants
BUILD_DIR: "build"
FLAMEGPU_BUILD_TESTS: "ON"
# Conditional based on matrix via awkward almost ternary
FLAMEGPU_BUILD_PYTHON: ${{ fromJSON('{true:"ON",false:"OFF"}')[matrix.python != ''] }}
# Port matrix options to environment, for more portability.
CUDA: ${{ matrix.cudacxx.cuda }}
CUDA_ARCH: ${{ matrix.cudacxx.cuda_arch }}
HOSTCXX: ${{ matrix.cudacxx.hostcxx }}
OS: ${{ matrix.cudacxx.os }}
CONFIG: ${{ matrix.config.config }}
FLAMEGPU_SEATBELTS: ${{ matrix.config.SEATBELTS }}
PYTHON: ${{ matrix.python}}
VISUALISATION: ${{ matrix.VISUALISATION }}
steps:
- uses: actions/checkout@v3
- name: Install CUDA (Windows)
if: ${{ runner.os == 'Windows' && env.CUDA != '' }}
shell: powershell
env:
cuda: ${{ env.CUDA }}
visual_studio: ${{ env.HOSTCXX }}
run: .github\scripts\install_cuda_windows.ps1
- name: Select Python
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON }}
- name: Install python dependencies
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
run: |
python3 -m pip install --upgrade wheel build setuptools
- name: Add custom problem matchers for annotations
run: echo "::add-matcher::.github/problem-matchers.json"
# This pre-emptively patches a bug where ManyLinux didn't generate buildnumber as git dir was owned by diff user
- name: Enable git safe-directory
run: git config --global --add safe.directory $GITHUB_WORKSPACE
# Must pass -G -A for windows, and -DPython3_ROOT_DIR/-DPYTHON3_EXECUTABLE as a github action workaround
- name: Configure cmake
run: >
cmake . -B "${{ env.BUILD_DIR }}"
-G "${{ env.HOSTCXX }}" -A x64
-Werror=dev
-DCMAKE_WARN_DEPRECATED="OFF"
-DFLAMEGPU_WARNINGS_AS_ERRORS="ON"
-DCMAKE_CUDA_ARCHITECTURES="${{ env.CUDA_ARCH }}"
-DFLAMEGPU_BUILD_TESTS="${{ env.FLAMEGPU_BUILD_TESTS }}"
-DFLAMEGPU_BUILD_PYTHON="${{ env.FLAMEGPU_BUILD_PYTHON }}"
-DPython3_ROOT_DIR="$(dirname $(which python))"
-DPython3_EXECUTABLE="$(which python)"
-DFLAMEGPU_VISUALISATION="${{ env.VISUALISATION }}"
-DFLAMEGPU_ENABLE_NVTX="ON"
- name: Build static library
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --config ${{ env.CONFIG }} --target flamegpu --verbose -j `nproc`
- name: Build python wheel
if: ${{ env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --config ${{ env.CONFIG }} --target pyflamegpu --verbose -j `nproc`
- name: Build tests
if: ${{ env.FLAMEGPU_BUILD_TESTS == 'ON' }}
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --config ${{ env.CONFIG }} --target tests --verbose -j `nproc`
- name: Build all remaining targets
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --config ${{ env.CONFIG }} --target ALL_BUILD --verbose -j `nproc`
# Manylinux2014 Wheel builds, using the manylinux2014 container
wheel-manylinux2014:
runs-on: ${{ matrix.cudacxx.os }}
# Run steps inside a manylinux container.
container: quay.io/pypa/manylinux2014_x86_64
strategy:
fail-fast: false
# Multiplicative build matrix
# optional exclude: can be partial, include: must be specific
matrix:
cudacxx:
- cuda: "12.0"
cuda_arch: "50-real;60-real;70-real;80-real;90-real;90-virtual"
hostcxx: devtoolset-10
os: ubuntu-20.04
- cuda: "11.2"
cuda_arch: "35-real;50-real;60-real;70-real;80-real;80-virtual"
hostcxx: devtoolset-9
os: ubuntu-20.04
python:
- "3.12"
- "3.11"
- "3.10"
- "3.9"
- "3.8"
config:
- name: "Release"
config: "Release"
SEATBELTS: "ON"
VISUALISATION:
- "ON"
- "OFF"
# Name the job based on matrix/env options
name: "wheel-manylinux2014 (${{ matrix.cudacxx.cuda }}, ${{matrix.python}}, ${{ matrix.VISUALISATION }}, ${{ matrix.config.name }}, ${{ matrix.cudacxx.os }})"
env:
# Control if the wheel should be repaired. This will fail until .so's are addressed
AUDITWHEEL_REPAIR: "OFF"
MANYLINUX: "manylinux2014"
ARCH: "x86_64"
# Control if static GLEW should be built and used or not.
USE_STATIC_GLEW: "ON"
# Compute the wheelhouse name which should be unique within the matrix. This must be unique per build matrix/job combination
ARTIFACT_NAME: wheel-manylinux2014-${{ matrix.cudacxx.cuda }}-${{matrix.python}}-${{ matrix.VISUALISATION }}-${{ matrix.config.name }}-${{ matrix.cudacxx.os }}
# Define constants
BUILD_DIR: "build"
FLAMEGPU_BUILD_TESTS: "OFF"
# Conditional based on matrix via awkward almost ternary
FLAMEGPU_BUILD_PYTHON: ${{ fromJSON('{true:"ON",false:"OFF"}')[matrix.python != ''] }}
# Port matrix options to environment, for more portability.
CUDA: ${{ matrix.cudacxx.cuda }}
CUDA_ARCH: ${{ matrix.cudacxx.cuda_arch }}
HOSTCXX: ${{ matrix.cudacxx.hostcxx }}
OS: ${{ matrix.cudacxx.os }}
CONFIG: ${{ matrix.config.config }}
FLAMEGPU_SEATBELTS: ${{ matrix.config.SEATBELTS }}
PYTHON: ${{ matrix.python}}
VISUALISATION: ${{ matrix.VISUALISATION }}
steps:
- uses: actions/checkout@v3
# Downgrade the devtoolset in the image based on the build matrix, using:
# gcc-10 for CUDA >= 11.2. Unclear if devtoolset-10 will upgrade to unpatched 11.3 which breaks CUDA builds that use <chrono>.
# gcc-9 for CUDA >= 11.0
# these are not the officially supported toolset on centos by cuda, but it's what works.
- name: Install RHEL devtoolset (CentOS)
if: ${{ startsWith(env.HOSTCXX, 'devtoolset-') }}
run: |
# Install devtoolset-X
yum install -y ${{ env.HOSTCXX }}
# Enable the toolset via source not scl enable which doesn't get on with multi-step GHA
source /opt/rh/${{ env.HOSTCXX }}/enable
# Export the new environment / compilers for subsequent steps.
echo "PATH=${PATH}" >> $GITHUB_ENV
echo "CC=$(which gcc)" >> $GITHUB_ENV
echo "CXX=$(which g++)" >> $GITHUB_ENV
echo "CUDAHOSTCXX=$(which g++)" >> $GITHUB_ENV
- name: Install CUDA (CentOS)
if: ${{ env.CUDA != '' }}
env:
cuda: ${{ env.CUDA }}
run: .github/scripts/install_cuda_centos.sh
- name: Install Visualisation Dependencies (CentOS)
if: ${{ env.VISUALISATION == 'ON' }}
run: |
yum install -y glew-devel fontconfig-devel SDL2-devel freetype-devel
# Build/Install DevIL from source.
yum install -y freeglut-devel
git clone --depth 1 https://github.com/DentonW/DevIL.git
cd DevIL/DevIL
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=${{ env.CONFIG }} -Wno-error=dev
make -j `nproc`
make install
- name: Build and install GLEW including static GLEW
if: ${{ env.VISUALISATION == 'ON' && env.USE_STATIC_GLEW == 'ON' }}
env:
GLEW_VERSION: "2.2.0"
run: |
yum install -y wget
wget https://github.com/nigels-com/glew/releases/download/glew-${{ env.GLEW_VERSION }}/glew-${{ env.GLEW_VERSION }}.tgz
tar -zxf glew-${{ env.GLEW_VERSION }}.tgz
cd glew-${{ env.GLEW_VERSION }}
make
make install
# This patches a bug where ManyLinux doesn't generate buildnumber as git dir is owned by diff user
- name: Enable git safe-directory
run: git config --global --add safe.directory $GITHUB_WORKSPACE
# Unlike other builds manylinux, uses static glew as it has been built and installed.
- name: Configure cmake
run: >
cmake . -B "${{ env.BUILD_DIR }}"
-DCMAKE_BUILD_TYPE="${{ env.CONFIG }}"
-Werror=dev
-DCMAKE_WARN_DEPRECATED="OFF"
-DFLAMEGPU_WARNINGS_AS_ERRORS="ON"
-DCMAKE_CUDA_ARCHITECTURES="${{ env.CUDA_ARCH }}"
-DFLAMEGPU_BUILD_TESTS="${{ env.FLAMEGPU_BUILD_TESTS }}"
-DFLAMEGPU_BUILD_PYTHON="${{ env.FLAMEGPU_BUILD_PYTHON }}"
-DPYTHON3_EXACT_VERSION="${{ env.PYTHON }}"
-DFLAMEGPU_VISUALISATION="${{ env.VISUALISATION }}"
-DFLAMEGPU_ENABLE_NVTX="ON"
-DGLEW_USE_STATIC_LIBS="${{ env.USE_STATIC_GLEW }}"
-DOpenGL_GL_PREFERENCE:STRING=LEGACY
- name: Build python wheel
if: ${{ env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --target pyflamegpu --verbose -j `nproc`
# Run audithweel show for information, but do not repair.
- name: Run auditwheel show
working-directory: ${{ env.BUILD_DIR }}
run: auditwheel show lib/${{ env.CONFIG }}/python/dist/*whl
# Ideally we should use auditwheel repair to check/enforce conformity
# But we cannot due to cuda shared object (libcuda.so.1) dependencies which we cannot/shouldnot/wil not package into the wheel.
- name: Run auditwheel repair
if: ${{ env.AUDITWHEEL_REPAIR == 'ON' }}
working-directory: ${{ env.BUILD_DIR }}
run: auditwheel repair --plat ${{ env.MANYLINUX }}_${{ env.ARCH }} lib/${{ env.CONFIG }}/python/dist/*whl -w lib/${{ env.CONFIG }}/python/dist
# Upload wheel artifacts to the job on GHA, with a short retention
# Use a unique name per job matrix run, to avoid a risk of corruption according to the docs (although it should work with unique filenames)
- name: Upload Wheel Artifacts
if: ${{ env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.BUILD_DIR }}/lib/${{ env.CONFIG }}/python/dist/*.whl
if-no-files-found: error
retention-days: 7
# Windows Wheel builds
wheel-windows:
runs-on: ${{ matrix.cudacxx.os }}
strategy:
fail-fast: false
# Multiplicative build matrix
# optional exclude: can be partial, include: must be specific
matrix:
cudacxx:
- cuda: "12.0.0"
cuda_arch: "50-real;60-real;70-real;80-real;90-real;90-virtual"
hostcxx: "Visual Studio 16 2019"
os: windows-2019
- cuda: "11.2.2"
cuda_arch: "35-real;50-real;60-real;70-real;80-real;80-virtual"
hostcxx: "Visual Studio 16 2019"
os: windows-2019
python:
- "3.12"
- "3.11"
- "3.10"
- "3.9"
- "3.8"
config:
- name: "Release"
config: "Release"
SEATBELTS: "ON"
VISUALISATION:
- "ON"
- "OFF"
# Name the job based on matrix/env options
name: "wheel-windows (${{ matrix.cudacxx.cuda }}, ${{matrix.python}}, ${{ matrix.VISUALISATION }}, ${{ matrix.config.name }}, ${{ matrix.cudacxx.os }})"
# Define job-wide env constants, and promote matrix elements to env constants for portable steps.
env:
# Compute the wheelhouse name which should be unique within the matrix. This must be unique per build matrix/job combination
ARTIFACT_NAME: wheel-windows-${{ matrix.cudacxx.cuda }}-${{matrix.python}}-${{ matrix.VISUALISATION }}-${{ matrix.config.name }}-${{ matrix.cudacxx.os }}
# Define constants
BUILD_DIR: "build"
FLAMEGPU_BUILD_TESTS: "OFF"
# Conditional based on matrix via awkward almost ternary
FLAMEGPU_BUILD_PYTHON: ${{ fromJSON('{true:"ON",false:"OFF"}')[matrix.python != ''] }}
# Port matrix options to environment, for more portability.
CUDA: ${{ matrix.cudacxx.cuda }}
CUDA_ARCH: ${{ matrix.cudacxx.cuda_arch }}
HOSTCXX: ${{ matrix.cudacxx.hostcxx }}
OS: ${{ matrix.cudacxx.os }}
CONFIG: ${{ matrix.config.config }}
FLAMEGPU_SEATBELTS: ${{ matrix.config.SEATBELTS }}
PYTHON: ${{ matrix.python}}
VISUALISATION: ${{ matrix.VISUALISATION }}
steps:
- uses: actions/checkout@v3
- name: Install CUDA (Windows)
if: ${{ runner.os == 'Windows' && env.CUDA != '' }}
shell: powershell
env:
cuda: ${{ env.CUDA }}
visual_studio: ${{ env.HOSTCXX }}
run: .github\scripts\install_cuda_windows.ps1
- name: Select Python
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON }}
- name: Install python dependencies
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
run: |
python3 -m pip install --upgrade wheel build setuptools
- name: Add custom problem matchers for annotations
run: echo "::add-matcher::.github/problem-matchers.json"
# This pre-emptively patches a bug where ManyLinux didn't generate buildnumber as git dir was owned by diff user
- name: Enable git safe-directory
run: git config --global --add safe.directory $GITHUB_WORKSPACE
# Must pass -G -A for windows, and -DPython3_ROOT_DIR/-DPYTHON3_EXECUTABLE as a github action workaround
- name: Configure cmake
run: >
cmake . -B "${{ env.BUILD_DIR }}"
-G "${{ env.HOSTCXX }}" -A x64
-Werror=dev
-DCMAKE_WARN_DEPRECATED="OFF"
-DFLAMEGPU_WARNINGS_AS_ERRORS="ON"
-DCMAKE_CUDA_ARCHITECTURES="${{ env.CUDA_ARCH }}"
-DFLAMEGPU_BUILD_TESTS="${{ env.FLAMEGPU_BUILD_TESTS }}"
-DFLAMEGPU_BUILD_PYTHON="${{ env.FLAMEGPU_BUILD_PYTHON }}"
-DPython3_ROOT_DIR="$(dirname $(which python))"
-DPython3_EXECUTABLE="$(which python)"
-DFLAMEGPU_VISUALISATION="${{ env.VISUALISATION }}"
-DFLAMEGPU_ENABLE_NVTX="ON"
- name: Build python wheel
if: ${{ env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --config ${{ env.CONFIG }} --target pyflamegpu --verbose -j `nproc`
# Upload wheel artifacts to the job on GHA, with a short retention
# Use a unique name per job matrix run, to avoid a risk of corruption according to the docs (although it should work with unique filenames)
- name: Upload Wheel Artifacts
if: ${{env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.BUILD_DIR }}/lib/${{ env.CONFIG }}/python/dist/*.whl
if-no-files-found: error
retention-days: 7
# Create a draft release, if all other jobs are successful and if the workflow was triggered by a version tag push event.
create-draft-release:
needs:
- build-ubuntu
- build-windows
- wheel-manylinux2014
- wheel-windows
if: ${{ success() && startsWith(github.ref, 'refs/tags/v') && github.event_name != 'workflow_dispatch' && github.event_name != 'pull_request' }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
# Download python wheels from previous jobs.
- name: Download Wheel Artifacts
id: download
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Find Wheel Artifacts
id: find_wheels
run: |
# Find files, storing in the files variable
pattern="${{ steps.download.outputs.download-path }}/*/*.whl"
files=""
for f in ${pattern}; do
# @future - Set human readable display label
label="$(basename ${f})"
files="${files} \"${f}#${label}\""
done
echo "files: ${files}"
# Set the list of files as the output for this step
echo "files=${files}" >> "$GITHUB_OUTPUT"
# Extract information from the tag which is required for the draft github release
- name: Process Tag
id: tag
run: |
ref=${{ github.ref }}
tag=${ref/refs\/tags\//}
version=${tag/v/}
prerelease_label=$(echo ${tag} | cut -d- -f2)
prerelease_label_len=$(echo ${prerelease_label} | wc -c)
prerelease_flag=$([[ -z "${prerelease_label_len}" ]] && echo "" || echo "--prerelease")
# set step outputs
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "prerelease_flag=${prerelease_flag}" >> "$GITHUB_OUTPUT"
# Use the gh cli tool to create a draft release
# @future - use --notes "notes string" or --notes-file file
- name: Create Draft Release
id: create_release
run: gh release create --draft ${{ env.PRERELEASE_FLAG}} --title "${{ env.TITLE }}" ${{ env.TAG }} ${{ env.FILES }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRERELEASE_FLAG: "${{ steps.tag.outputs.prerelease_flag }}"
TAG: "${{ steps.tag.outputs.tag }}"
TITLE: "FLAME GPU ${{ steps.tag.outputs.version }}"
FILES: ${{ steps.find_wheels.outputs.files }}