-
Notifications
You must be signed in to change notification settings - Fork 123
445 lines (405 loc) · 16.1 KB
/
build.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
name: Build OpenFX libs and examples
permissions:
id-token: write
contents: write
actions: write
on:
push:
pull_request:
workflow_dispatch:
release:
types:
- published
jobs:
build:
name: '${{ matrix.name_prefix }} <config=${{ matrix.buildtype }}>'
# Avoid duplicated checks when a pull_request is opened from a local branch.
if: |
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
runs-on: ${{ matrix.os }}
container:
image: ${{ matrix.container }}
volumes: ${{ matrix.need_node20_vol && fromJSON('["/node20217:/node20217:rw,rshared", "/node20217:/__e/node20:ro,rshared"]') || fromJSON('[]') }}
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: 'true'
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
strategy:
fail-fast: false
matrix:
include:
- name_prefix: Linux CentOS 7 VFX CY2021
release_prefix: linux-vfx2021
ostype: linux
aswfdockerbuild: true
os: ubuntu-latest
container: aswf/ci-base:2021
vfx-cy: 2021
need_node20_vol: true
has_cmake_presets: false
buildtype: Release
conan_version: 2.1.0
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
cuda: false
opencl: true
- name_prefix: Linux CentOS 7 VFX CY2022
release_prefix: linux-vfx2022
ostype: linux
aswfdockerbuild: true
os: ubuntu-latest
container: aswf/ci-base:2022
vfx-cy: 2022
need_node20_vol: true
has_cmake_presets: false
buildtype: Release
conan_version: 2.1.0
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
cuda: false
opencl: true
- name_prefix: Linux Rocky 8 VFX CY2023
release_prefix: linux-vfx2023
ostype: linux
aswfdockerbuild: true
os: ubuntu-latest
container: aswf/ci-base:2023
vfx-cy: 2023
has_cmake_presets: false
buildtype: Release
conan_version: 2.1.0
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
cuda: false
opencl: true
- name_prefix: Linux Rocky 8 VFX CY2023 No OpenGL
release_prefix: linux-vfx2023-no-ogl
ostype: linux
aswfdockerbuild: true
os: ubuntu-latest
container: aswf/ci-base:2023
vfx-cy: 2023
has_cmake_presets: false
buildtype: Release
conan_version: 2.1.0
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
opengl: false
- name_prefix: Linux Ubuntu
release_prefix: linux-ubuntu
ostype: linux
aswfdockerbuild: false
os: ubuntu-latest
has_cmake_presets: true
buildtype: Release
conan_version: 2.1.0
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
cuda: true
opencl: true
- name_prefix: MacOS
release_prefix: mac
ostype: mac
os: macos-latest
has_cmake_presets: true
buildtype: Release
conan_version: 2.1.0
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
cuda: false
opencl: true
- name_prefix: Windows
release_prefix: windows
ostype: windows
os: windows-latest
has_cmake_presets: true
buildtype: Release
conan_version: 2.1.0
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
cuda: true
opencl: true
- name_prefix: Windows no CUDA
release_prefix: windows-no-cuda
ostype: windows
os: windows-latest
has_cmake_presets: true
buildtype: Release
conan_version: 2.0.16
cxx-standard: 17
cxx-compiler: clang++
cc-compiler: clang
compiler-desc: Clang
cuda: false
opencl: false
defaults:
run:
shell: bash
steps:
- name: install nodejs20glibc2.17
if: matrix.need_node20_vol == true
run: |
curl --silent https://unofficial-builds.nodejs.org/download/release/v20.18.1/node-v20.18.1-linux-x64-glibc-217.tar.xz | \
tar -xJ --strip-components 1 -C /node20217 -f -
- name: Checkout code
uses: actions/checkout@v4
with:
clean: true
fetch-depth: 0
- name: setup env vars
run: |
git config --global --add safe.directory $PWD # needed for checkout v3, doesn't hurt anyway
BUILDTYPE_LC=$(echo '${{ matrix.buildtype }}'|tr [:upper:] [:lower:])
echo "BUILDTYPE_LC=$BUILDTYPE_LC" >> $GITHUB_ENV
echo "OSNAME=$(echo '${{ matrix.os }}'|sed 's/-.*//')" >> $GITHUB_ENV
echo "GIT_COMMIT_ID=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "CONAN_PRESET=conan-$BUILDTYPE_LC" >> $GITHUB_ENV
echo "BUILD_DIR=build/${{ matrix.buildtype }}" >> $GITHUB_ENV
- name: Set RELEASE_NAME
# this looks like "linux-vfx2022-1.5[-no-opengl]"; used in filenames
run: |
RELEASE_PREFIX=${{ matrix.release_prefix }}
OPENGL_BUILD=${{ env.OPENGL_BUILD }}
if [ "${{ github.ref_type }}" == "tag" ]; then
REF_SUFFIX=$(echo "${{ github.ref_name }}" | sed 's/OFX_Release_//')
else
REF_SUFFIX=$(echo ${{ github.sha }} | cut -c1-8)
fi
echo "RELEASE_NAME=${RELEASE_PREFIX}-${REF_SUFFIX}${OPENGL_BUILD}" >> $GITHUB_ENV
- name: Set up python 3.11
uses: actions/setup-python@v5
if: matrix.ostype == 'mac'
with:
python-version: '3.11'
# Q: should we use uv everywhere?
# Unfortunately astral-sh/setup-uv action doesn't work on CentOS 7, its GLIBC is too old.
- name: Set up uv manually
if: matrix.release_prefix == 'linux-vfx2021'
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
source ~/.local/bin/env
echo After sourcing uv env: "$PATH"
uv python install --preview 3.11
# Python is in $(uv python dir)/cpython-*/bin
# uv also installs a symlink in $HOME/.local/bin but because
# that is only a symlink, it causes problems with pip and venv.
# As a workaround, prepend the actual bin dir to $PATH.
uv_python_dir="$(uv python dir)"
uv_cpython_name="$(/bin/ls -1 $uv_python_dir)"
uv_python_path="$uv_python_dir/$uv_cpython_name/bin"
PATH="$uv_python_path":$PATH
# Prepend to path for future steps (note: don't use $GITHUB_ENV here)
echo "$uv_python_path" >> $GITHUB_PATH
- name: Check python, uv paths
run: |
echo $PATH
echo -n 'which python: ' && which python
echo -n 'which python3: ' && which python3
echo -n 'python version: ' && python --version
echo -n 'python3 version: ' && python3 --version
echo -n 'which uv: ' && (which uv || echo "No python uv; continuing")
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
with:
version: ${{ matrix.conan_version }}
- name: Set up conan
run: |
which conan
conan --version
conan profile detect
- name: Install system dependencies if needed
uses: ConorMacBride/install-package@v1
if: ${{ matrix.aswfdockerbuild == false }}
with:
apt: libgl-dev libgl1-mesa-dev
- name: Install gh cli if needed
if: ${{ matrix.aswfdockerbuild == true }}
run: |
if command -v dnf; then
dnf -y install 'dnf-command(config-manager)'
dnf -y config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
dnf -y install gh --repo gh-cli
else
# older CentOS
wget https://github.com/cli/cli/releases/download/v2.63.2/gh_2.63.2_linux_amd64.rpm
yum install -y gh_2.63.2_linux_amd64.rpm
rm gh_2.63.2_linux_amd64.rpm
fi
gh --version
- name: Setup MSVC
if: startsWith(matrix.os, 'windows')
uses: ilammy/[email protected] # use cl, not msbuild
# We use cl.exe because it can find CUDA without the CUDA visual studio integration,
# which is extremely slow to install (see Jimver/cuda-toolkit below)
# See comments at https://github.com/Jimver/cuda-toolkit/issues/253
- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@v4
- name: Install CUDA Toolkit
uses: Jimver/[email protected]
id: cuda-toolkit-linux
if: matrix.ostype == 'linux' && matrix.cuda == true
with:
cuda: '12.6.2'
method: 'network'
sub-packages: '["nvcc", "cudart"]'
linux-local-args: '["--toolkit"]'
- name: Install CUDA Toolkit
uses: Jimver/[email protected]
id: cuda-toolkit-win
if: matrix.ostype == 'windows' && matrix.cuda == true
with:
# Need CUDA >= 12.4 to support recent VS2022 (17.10 and later, MSVC 19.40)
cuda: '12.4.1'
method: 'network'
sub-packages: '["nvcc", "cudart"]'
# - name: Install system dependencies (CentOS)
# run: |
# rpm install libglvnd-devel
- name: Install dependencies
run: |
[[ "${{ matrix.opengl }}" != false && "${{ matrix.opencl }}" = true ]] && USE_OPENCL="-o use_opencl=True"
conan install -s build_type=${{ matrix.buildtype }} -pr:b=default --build=missing . -c tools.cmake.cmaketoolchain:generator=Ninja $USE_OPENCL
- name: Configure project with cmake
run: |
CMAKE_DEFINES=(-DBUILD_EXAMPLE_PLUGINS=TRUE \
-DPLUGIN_INSTALLDIR=$(pwd)/build/Install)
if [[ "${{ matrix.opengl }}" != false ]] ; then
echo "OPENGL_BUILD=" >> $GITHUB_ENV
CMAKE_DEFINES+=(-DOFX_SUPPORTS_OPENGLRENDER=TRUE)
[[ "${{ matrix.opencl }}" = true ]] && CMAKE_DEFINES+=(-DOFX_SUPPORTS_OPENCLRENDER=TRUE)
[[ "${{ matrix.cuda }}" = true ]] && CMAKE_DEFINES+=(-DOFX_SUPPORTS_CUDARENDER=TRUE)
else
echo "OPENGL_BUILD=-no-ogl" >> $GITHUB_ENV
fi
CMAKE_GENERATOR=(-G Ninja)
if [[ ${{ matrix.has_cmake_presets }} = true ]]; then
# Sets up to build in e.g. build/Release
cmake --preset $CONAN_PRESET ${CMAKE_GENERATOR[@]} ${CMAKE_DEFINES[@]} .
else
# VFX ref platforms 2022 & earlier have only cmake 3.19.
# Older cmake (<3.23) does not support presets, so invoke with explicit args.
cmake -S . -B $BUILD_DIR -G "Unix Makefiles" \
-DCMAKE_TOOLCHAIN_FILE=$(pwd)/$BUILD_DIR/generators/conan_toolchain.cmake \
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW \
-DCMAKE_BUILD_TYPE=Release \
${CMAKE_DEFINES[@]}
fi
- name: Build with cmake
run: |
if [[ ${{ matrix.ostype }} = windows ]]; then
cmake --build $BUILD_DIR --target install --config Release --parallel
else
cmake --build $BUILD_DIR --target install --parallel
fi
- name: Install with cmake
run: |
if [[ ${{ matrix.ostype }} = windows ]]; then
cmake --install $BUILD_DIR --config Release
else
cmake --install $BUILD_DIR
fi
# This isn't used for release; just checks that makefiles still work.
- name: Build old stuff with make
run: |
if [[ ${{ matrix.ostype }} = windows ]]; then
echo No Windows nmake build yet
else
(cd Examples; make -j)
# should build Support/Plugins too, but those need work
fi
############################################################
# Installation: produce release artifacts
############################################################
- name: Copy includes and libs into release folder for installation
# Dir structure:
# Install/OpenFX
# lib
# *.a or *.lib
# include/
# openfx/*.h
# Support/*.h
# HostSupport/*.h
# so e.g `#include <openfx/Support/foo.h>` works with `-I.../OpenFX/include`
run: |
mkdir -p Install/OpenFX/include/openfx
tar -C include \
--exclude='*.png' --exclude='*.doxy' --exclude='*.dtd' \
--exclude='DocSrc' \
-cf - . \
| tar -xf - -C Install/OpenFX/include/openfx
mkdir -p Install/OpenFX/include/openfx/Support
tar -C Support/include/ --exclude='*.png' --exclude='*.doxy' --exclude='*.dtd' \
--exclude='DocSrc' \
-cf - . \
| tar -xf - -C Install/OpenFX/include/openfx/Support/
mkdir -p Install/OpenFX/include/openfx/HostSupport
tar -C HostSupport/include/ --exclude='*.png' --exclude='*.doxy' --exclude='*.dtd' \
--exclude='DocSrc' \
-cf - . \
| tar -xf - -C Install/OpenFX/include/openfx/HostSupport/
mkdir -p Install/OpenFX/lib
find build -name 'lib*' -type f -exec cp {} Install/OpenFX/lib/ \;
# Artifacts for build & release:
# - Header files, doc, and support libs, for use when developing hosts & plugins
# - Built/installed example plugins, for testing in a host
# Create and sign headers/libs tarball
- name: Create headers/libs tarball
run: |
tar -czf openfx-$RELEASE_NAME.tar.gz -C Install OpenFX
- name: Sign header/libs tarball with Sigstore
uses: sigstore/gh-action-sigstore-python@f514d46b907ebcd5bedc05145c03b69c1edd8b46 # v3.0.0
# if: github.event_name == 'release'
with:
inputs: openfx-${{ env.RELEASE_NAME }}.tar.gz
upload-signing-artifacts: false
release-signing-artifacts: false
- name: Upload header/libs tarball and signatures
uses: actions/upload-artifact@v4
with:
name: "openfx-${{ env.RELEASE_NAME }}"
path: |
openfx-${{ env.RELEASE_NAME }}.tar.gz
openfx-${{ env.RELEASE_NAME }}.tar.gz.sigstore.json
# Now the same, for the plugins
- name: Create built/installed plugins tarball
run: |
tar -czf openfx_plugins-$RELEASE_NAME.tar.gz -C build/Install .
- name: Sign plugins tarball with Sigstore
uses: sigstore/gh-action-sigstore-python@f514d46b907ebcd5bedc05145c03b69c1edd8b46 # v3.0.0
with:
inputs: openfx_plugins-${{ env.RELEASE_NAME }}.tar.gz
upload-signing-artifacts: false
release-signing-artifacts: false
- name: Upload plugins tarball and signatures
uses: actions/upload-artifact@v4
with:
name: "openfx_plugins-${{ env.RELEASE_NAME }}"
path: |
openfx_plugins-${{ env.RELEASE_NAME }}.tar.gz
openfx_plugins-${{ env.RELEASE_NAME }}.tar.gz.sigstore.json
- name: Upload artifacts to release
if: github.event_name == 'release'
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
run: |
gh release upload ${TAG} \
openfx-${{ env.RELEASE_NAME }}.tar.gz \
openfx-${{ env.RELEASE_NAME }}.tar.gz.sigstore.json \
openfx_plugins-${{ env.RELEASE_NAME }}.tar.gz \
openfx_plugins-${{ env.RELEASE_NAME }}.tar.gz.sigstore.json