-
Notifications
You must be signed in to change notification settings - Fork 664
313 lines (305 loc) · 11.3 KB
/
build-steps.yml
File metadata and controls
313 lines (305 loc) · 11.3 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
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
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO
##########################################################################
# Common steps for all CI workflows
##########################################################################
name: CI Steps
on:
workflow_call:
# This inputs receive values via the "with:" section in ci_workflow.yml
inputs:
build:
type: string
runner:
type: string
container:
type: string
container_volumes:
type: string
default: '[]'
cc_compiler:
type: string
cxx_compiler:
type: string
cxx_std:
type: string
build_type:
type: string
depcmds:
type: string
extra_artifacts:
type: string
fmt_ver:
type: string
fmt_commit:
type: string
gcc_action_ver:
type: string
llvm_action_ver:
type: string
opencolorio_ver:
type: string
openexr_ver:
type: string
pybind11_ver:
type: string
python_action_ver:
type: string
python_ver:
type: string
setenvs:
type: string
simd:
type: string
skip_build:
type: string
skip_tests:
type: string
abi_check:
type: string
benchmark:
type: string
build_docs:
type: string
clang_format:
type: string
generator:
type: string
ctest_args:
type: string
ctest_test_timeout:
type: string
coverage:
type: string
sonar:
type: string
old_node:
type: string
default: 0
nametag:
type: string
required_deps:
type: string
optional_deps:
type: string
build_local_deps:
type: string
secrets:
PASSED_GITHUB_TOKEN:
required: false
PASSED_SONAR_TOKEN:
required: false
permissions: read-all
jobs:
steps:
name: "${{inputs.cxx_compiler}} c++${{inputs.cxx_std}} py${{inputs.python_ver}}"
runs-on: ${{ inputs.runner }}
container:
image: ${{ inputs.container }}
volumes: ${{ fromJson( inputs.container_volumes ) }}
options: -v /:/host/root ${{ (contains(inputs.runner, 'gpu') && '-e NVIDIA_DRIVER_CAPABILITIES=compute,graphics,utility --gpus all') || '-e A=x' }}
# Extra options:
# - Ensure the GPU runners have OptiX is visible in the container.
# - Mount the native filesystem under /host/root
env:
CXX: ${{inputs.cxx_compiler}}
CC: ${{inputs.cc_compiler}}
CMAKE_BUILD_TYPE: ${{inputs.build_type}}
CMAKE_CXX_STANDARD: ${{inputs.cxx_std}}
CMAKE_GENERATOR: ${{inputs.generator}}
CTEST_ARGS: ${{inputs.ctest_args}}
CTEST_TEST_TIMEOUT: ${{inputs.ctest_test_timeout}}
USE_SIMD: ${{inputs.simd}}
fmt_BUILD_VERSION: ${{inputs.fmt_ver}}
fmt_GIT_COMMIT: ${{inputs.fmt_commit}}
OPENCOLORIO_VERSION: ${{inputs.opencolorio_ver}}
OPENEXR_VERSION: ${{inputs.openexr_ver}}
PYBIND11_VERSION: ${{inputs.pybind11_ver}}
PYTHON_VERSION: ${{inputs.python_ver}}
ABI_CHECK: ${{inputs.abi_check}}
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
# For CI, sometimes we want to require all dependencies to be present,
# except for a select few listed explicitly. This ensures that we don't
# accidentally have a situation in which we think we are building
# against and testing an optional dependency, but in fact are not.
OpenImageIO_REQUIRED_DEPS: ${{inputs.required_deps}}
OpenImageIO_OPTIONAL_DEPS: ${{inputs.optional_deps}}
OpenImageIO_BUILD_LOCAL_DEPS: ${{inputs.build_local_deps}}
SETENVS: ${{inputs.setenvs}}
DEPCMDS: ${{inputs.depcmds}}
steps:
- name: install nodejs20glibc2.17
if: inputs.old_node == '1'
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 repo
if: inputs.old_node != '1'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Checkout repo-OLD
if: inputs.old_node == '1'
# Must use an old checkout action for old containers
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Build setup
shell: bash
run: |
eval "$SETENVS"
src/build-scripts/ci-startup.bash
- name: Prepare ccache timestamp
id: ccache_cache_keys
shell: bash
run: echo "date=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" >> $GITHUB_OUTPUT
- name: ccache-restore
if: inputs.old_node != '1'
id: ccache-restore
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: ${{inputs.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
restore-keys: ${{inputs.nametag}}
- name: ccache-restore-OLD
if: inputs.old_node == '1'
id: ccache-restore-old
# Must use an old cache restore action for old containers
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ env.CCACHE_DIR }}
# path: ./ccache
key: ${{inputs.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
restore-keys: ${{inputs.nametag}}
- name: Install gcc
if: inputs.gcc_action_ver != ''
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y
sudo apt-get install -y g++-${{inputs.gcc_action_ver}}
- name: Install python
if: inputs.python_action_ver != ''
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ inputs.python_action_ver }}
- name: Install LLVM and Clang
if: inputs.llvm_action_ver != ''
uses: KyleMayes/install-llvm-action@ebc0426251bc40c7cd31162802432c68818ab8f0 # v2.0.9
with:
version: ${{ inputs.llvm_action_ver }}
- name: Dependencies
shell: bash
run: |
eval "$DEPCMDS"
if [[ "$RUNNER_OS" == "Linux" ]]; then
src/build-scripts/gh-installdeps.bash
elif [[ "$RUNNER_OS" == "macOS" ]]; then
src/build-scripts/install_homebrew_deps.bash
elif [[ "$RUNNER_OS" == "Windows" ]]; then
src/build-scripts/gh-win-installdeps.bash
fi
- name: Install sonar-scanner and build-wrapper
if: inputs.sonar == '1'
uses: sonarsource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9 # v7.0.0
- name: Build
if: inputs.skip_build != '1'
shell: bash
run: src/build-scripts/ci-build.bash
- name: Check out ABI standard
if: inputs.abi_check != ''
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{inputs.abi_check}}
path: abi_standard
- name: Build ABI standard
if: inputs.abi_check != ''
shell: bash
run: |
mkdir -p abi_standard/build
pushd abi_standard
src/build-scripts/ci-build.bash
popd
- name: ccache-save
if: inputs.old_node != '1'
id: ccache-save
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: ${{inputs.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
- name: ccache-save-OLD
if: inputs.old_node == '1'
id: ccache-save-old
# Must use an old cache action for old containers
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ env.CCACHE_DIR }}
key: ${{inputs.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
- name: Testsuite
if: inputs.skip_tests != '1'
shell: bash
run: src/build-scripts/ci-test.bash
- name: Benchmarks
if: inputs.benchmark == '1'
shell: bash
run: src/build-scripts/ci-benchmark.bash
- name: clang-format
if: inputs.clang_format == '1'
shell: bash
run: src/build-scripts/run-clang-format.bash
- name: Code coverage
if: inputs.coverage == '1'
run: src/build-scripts/ci-coverage.bash
- name: Sonar-scanner
if: inputs.sonar == '1'
env:
GITHUB_TOKEN: ${{ secrets.PASSED_GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.PASSED_SONAR_TOKEN }}
run: |
which sonar-scanner
ls -l /__w/OpenImageIO/OpenImageIO/bw_output
echo "BUILD_OUTPUT_DIR is ${BUILD_WRAPPER_OUT_DIR}"
find . -name "*.gcov" -print
# sonar-scanner --define sonar.cfamily.compile-commands="${BUILD_WRAPPER_OUT_DIR}/compile_commands.json"
time sonar-scanner --define sonar.host.url="${SONAR_SERVER_URL}" --define sonar.cfamily.compile-commands="$BUILD_WRAPPER_OUT_DIR/compile_commands.json" --define sonar.cfamily.gcov.reportsPath="_coverage" --define sonar.cfamily.threads="$PARALLEL"
# Consult https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-cli/ for more information and options
- name: Check ABI
if: inputs.abi_check != ''
shell: bash
run: |
src/build-scripts/ci-abicheck.bash ./build abi_standard/build libOpenImageIO libOpenImageIO_Util
- name: Build Docs
if: inputs.build_docs == '1'
shell: bash
run: |
cd src/doc
time make doxygen
time make sphinx
- name: Upload testsuite debugging artifacts
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: ${{ inputs.old_node != '1' && (failure() || inputs.build_docs == '1' || inputs.benchmark == '1' || inputs.abi_check != '') }}
with:
name: oiio-${{github.job}}-${{inputs.nametag}}
path: |
build/cmake-save
build/compat_reports
build/sphinx
build/benchmarks
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
${{ inputs.extra_artifacts }}
- name: Upload testsuite debugging artifacts-OLD
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
if: ${{ inputs.old_node == '1' && (failure() || inputs.build_docs == '1' || inputs.benchmark == '1' || inputs.abi_check != '') }}
with:
name: oiio-${{github.job}}-${{inputs.nametag}}
path: |
build/cmake-save
build/compat_reports
build/sphinx
build/benchmarks
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
!build/testsuite/j2kp4files_v1_5
${{ inputs.extra_artifacts }}