Skip to content

Commit 6a37840

Browse files
lgritzscott-wilson
authored andcommitted
ci: refactor using a single steps workflow (AcademySoftwareFoundation#4545)
The logic for the GHA steps was repeated across multiple workflows and platforms. Consolidate it all into a common "ci-steps" workflow, and have all the other workflows reference that when possible. This should hopefully make maintenance of the CI scripts easier in the future, with less redundancy of the step logic. The only major place where we deviate is that we have a separeately specified set of steps for the "old" VFX Platform 2021 and 2022 based tests (because we need to specify different container arguments to it). --------- Signed-off-by: Larry Gritz <[email protected]> Signed-off-by: Scott Wilson <[email protected]>
1 parent 8b2e201 commit 6a37840

File tree

6 files changed

+474
-541
lines changed

6 files changed

+474
-541
lines changed

.github/workflows/analysis.yml

Lines changed: 38 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ on:
1616
- main
1717
- '*analysis*'
1818
- '*sonar*'
19-
paths-ignore:
20-
- '**.md'
21-
- '**.rst'
22-
- 'docs/**'
19+
paths:
20+
- '**'
21+
- '!**.md'
22+
- '!**.rst'
23+
- '!**/analysis.yml'
24+
- '!**/docs.yml'
25+
- '!**.properties'
26+
- '!docs/**'
2327
# Allow manual kicking off of the workflow from github.com
2428
workflow_dispatch:
2529
# Uncomment the following line if we want to run analysis on all PRs:
@@ -40,20 +44,46 @@ jobs:
4044
# Exclude runs on forks, since only the main org has the SonarCloud
4145
# account credentials.
4246
if: github.repository == 'AcademySoftwareFoundation/OpenImageIO'
47+
uses: ./.github/workflows/build-steps.yml
48+
with:
49+
nametag: ${{ matrix.nametag || 'unnamed!' }}
50+
runner: ${{ matrix.runner || 'ubuntu-latest' }}
51+
container: ${{ matrix.container }}
52+
cc_compiler: ${{ matrix.cc_compiler }}
53+
cxx_compiler: ${{ matrix.cxx_compiler }}
54+
cxx_std: ${{ matrix.cxx_std || '17' }}
55+
build_type: ${{ matrix.build_type || 'Release' }}
56+
depcmds: ${{ matrix.depcmds }}
57+
extra_artifacts: ${{ matrix.extra_artifacts }}
58+
fmt_ver: ${{ matrix.fmt_ver }}
59+
opencolorio_ver: ${{ matrix.opencolorio_ver }}
60+
openexr_ver: ${{ matrix.openexr_ver }}
61+
pybind11_ver: ${{ matrix.pybind11_ver }}
62+
python_ver: ${{ matrix.python_ver }}
63+
setenvs: ${{ matrix.setenvs }}
64+
simd: ${{ matrix.simd }}
65+
skip_build: ${{ matrix.skip_build }}
66+
skip_tests: ${{ matrix.skip_tests }}
67+
abi_check: ${{ matrix.abi_check }}
68+
build_docs: ${{ matrix.build_docs }}
69+
generator: ${{ matrix.generator }}
70+
ctest_args: ${{ matrix.ctest_args }}
71+
ctest_test_timeout: ${{ matrix.ctest_test_timeout }}
72+
coverage: ${{ matrix.coverage || '0' }}
73+
sonar: ${{ matrix.sonar || '0' }}
4374
strategy:
4475
fail-fast: false
4576
matrix:
4677
include:
4778
- desc: sonar gcc9/C++14 py39 exr3.1 ocio2.2
4879
nametag: static-analysis-sonar
4980
os: ubuntu-latest
50-
container: aswf/ci-osl:2023-clang15
51-
vfxyear: 2023
81+
container: aswf/ci-osl:2024-clang17
5282
cxx_std: 17
53-
python_ver: "3.10"
83+
python_ver: "3.11"
5484
simd: "avx2,f16c"
5585
fmt_ver: 10.1.1
56-
pybind11_ver: v2.10.0
86+
pybind11_ver: v2.12.0
5787
coverage: 1
5888
# skip_tests: 1
5989
sonar: 1
@@ -64,83 +94,3 @@ jobs:
6494
CMAKE_UNITY_BUILD=OFF
6595
CODECOV=1
6696
CTEST_TEST_TIMEOUT=1200
67-
68-
runs-on: ${{ matrix.os }}
69-
container:
70-
image: ${{ matrix.container }}
71-
env:
72-
CXX: ${{matrix.cxx_compiler}}
73-
CC: ${{matrix.cc_compiler}}
74-
CMAKE_CXX_STANDARD: ${{matrix.cxx_std}}
75-
USE_SIMD: ${{matrix.simd}}
76-
FMT_VERSION: ${{matrix.fmt_ver}}
77-
OPENEXR_VERSION: ${{matrix.openexr_ver}}
78-
PYBIND11_VERSION: ${{matrix.pybind11_ver}}
79-
PYTHON_VERSION: ${{matrix.python_ver}}
80-
# DEBUG_CI: 1
81-
steps:
82-
# We would like to use harden-runner, but it flags too many false
83-
# positives, every time we download a dependency. We should use it only
84-
# on CI runs where we are producing artifacts that users might rely on.
85-
# - name: Harden Runner
86-
# uses: step-security/harden-runner@248ae51c2e8cc9622ecf50685c8bf7150c6e8813 # v1.4.3
87-
# with:
88-
# egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
89-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
90-
with:
91-
fetch-depth: '0'
92-
- name: Prepare ccache timestamp
93-
id: ccache_cache_keys
94-
run: echo "date=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" >> $GITHUB_OUTPUT
95-
- name: ccache
96-
id: ccache
97-
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
98-
with:
99-
path: /tmp/ccache
100-
key: ${{github.job}}-${{matrix.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
101-
restore-keys: ${{github.job}}-
102-
- name: Build setup
103-
run: |
104-
${{matrix.setenvs}}
105-
src/build-scripts/ci-startup.bash
106-
- name: Dependencies
107-
run: |
108-
${{matrix.depcmds}}
109-
src/build-scripts/gh-installdeps.bash
110-
- name: Install sonar-scanner and build-wrapper
111-
if: matrix.sonar == '1'
112-
uses: sonarsource/sonarcloud-github-c-cpp@e4882e1621ad2fb48dddfa48287411bed34789b1 # v2.0.2
113-
- name: Build
114-
run: src/build-scripts/ci-build.bash
115-
- name: Testsuite
116-
if: matrix.skip_tests != '1'
117-
run: src/build-scripts/ci-test.bash
118-
- name: Code coverage
119-
if: matrix.coverage == '1'
120-
run: src/build-scripts/ci-coverage.bash
121-
- name: Sonar-scanner
122-
if: matrix.sonar == 1
123-
env:
124-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
126-
run: |
127-
which sonar-scanner
128-
ls -l /__w/OpenImageIO/OpenImageIO/bw_output
129-
echo "BUILD_OUTPUT_DIR is " "${{ env.BUILD_WRAPPER_OUT_DIR }}"
130-
find . -name "*.gcov" -print
131-
# sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
132-
time sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="$BUILD_WRAPPER_OUT_DIR" --define sonar.cfamily.gcov.reportsPath="_coverage" --define sonar.cfamily.threads="$PARALLEL"
133-
# Consult https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-cli/ for more information and options
134-
135-
# - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
136-
# if: failure()
137-
# with:
138-
# name: oiio-${{github.job}}-${{matrix.nametag}}
139-
# path: |
140-
# build/cmake-save
141-
# build/testsuite/*/*.*
142-
# !build/testsuite/oiio-images
143-
# !build/testsuite/openexr-images
144-
# !build/testsuite/fits-images
145-
# !build/testsuite/j2kp4files_v1_5
146-

.github/workflows/build-steps.yml

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# Copyright Contributors to the OpenImageIO project.
2+
# SPDX-License-Identifier: Apache-2.0
3+
# https://github.com/AcademySoftwareFoundation/OpenImageIO
4+
5+
##########################################################################
6+
# Common steps for all CI workflows
7+
##########################################################################
8+
9+
name: CI Steps
10+
11+
on:
12+
workflow_call:
13+
# This inputs receive values via the "with:" section in ci_workflow.yml
14+
inputs:
15+
build:
16+
type: string
17+
runner:
18+
type: string
19+
container:
20+
type: string
21+
cc_compiler:
22+
type: string
23+
cxx_compiler:
24+
type: string
25+
cxx_std:
26+
type: string
27+
build_type:
28+
type: string
29+
depcmds:
30+
type: string
31+
extra_artifacts:
32+
type: string
33+
fmt_ver:
34+
type: string
35+
opencolorio_ver:
36+
type: string
37+
openexr_ver:
38+
type: string
39+
pybind11_ver:
40+
type: string
41+
python_ver:
42+
type: string
43+
setenvs:
44+
type: string
45+
simd:
46+
type: string
47+
skip_build:
48+
type: string
49+
skip_tests:
50+
type: string
51+
abi_check:
52+
type: string
53+
build_docs:
54+
type: string
55+
generator:
56+
type: string
57+
ctest_args:
58+
type: string
59+
ctest_test_timeout:
60+
type: string
61+
coverage:
62+
type: string
63+
sonar:
64+
type: string
65+
nametag:
66+
type: string
67+
68+
permissions: read-all
69+
70+
71+
jobs:
72+
73+
steps:
74+
name: "${{inputs.cxx_compiler}} c++${{inputs.cxx_std}} py${{inputs.python_ver}}"
75+
runs-on: ${{ inputs.runner }}
76+
container:
77+
image: ${{ inputs.container }}
78+
79+
env:
80+
CXX: ${{inputs.cxx_compiler}}
81+
CC: ${{inputs.cc_compiler}}
82+
CMAKE_BUILD_TYPE: ${{inputs.build_type}}
83+
CMAKE_CXX_STANDARD: ${{inputs.cxx_std}}
84+
CMAKE_GENERATOR: ${{inputs.generator}}
85+
CTEST_ARGS: ${{inputs.ctest_args}}
86+
CTEST_TEST_TIMEOUT: ${{inputs.ctest_test_timeout}}
87+
USE_SIMD: ${{inputs.simd}}
88+
FMT_VERSION: ${{inputs.fmt_ver}}
89+
OPENCOLORIO_VERSION: ${{inputs.opencolorio_ver}}
90+
OPENEXR_VERSION: ${{inputs.openexr_ver}}
91+
PYBIND11_VERSION: ${{inputs.pybind11_ver}}
92+
PYTHON_VERSION: ${{inputs.python_ver}}
93+
ABI_CHECK: ${{inputs.abi_check}}
94+
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
95+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
96+
97+
steps:
98+
# - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
99+
# # Note: can't upgrade to actions/checkout 4.0 because it needs newer
100+
# # glibc than these containers have.
101+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
102+
with:
103+
fetch-depth: '0'
104+
- name: Prepare ccache timestamp
105+
id: ccache_cache_keys
106+
shell: bash
107+
run: echo "date=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" >> $GITHUB_OUTPUT
108+
- name: ccache
109+
id: ccache
110+
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
111+
# Note: can't upgrade to actions/cache 4.0 because it needs newer
112+
# glibc than these containers have.
113+
with:
114+
path: ./ccache
115+
key: ${{github.job}}-${{inputs.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
116+
restore-keys: ${{github.job}}-
117+
save-always: true
118+
- name: Setup Nuget.exe (Windows only)
119+
if: runner.os == 'Windows'
120+
uses: nuget/setup-nuget@a21f25cd3998bf370fde17e3f1b4c12c175172f9 # v2.0.0
121+
- name: Build setup
122+
shell: bash
123+
run: |
124+
${{inputs.setenvs}}
125+
src/build-scripts/ci-startup.bash
126+
- name: Dependencies
127+
shell: bash
128+
run: |
129+
${{inputs.depcmds}}
130+
if [[ "$RUNNER_OS" == "Linux" ]]; then
131+
src/build-scripts/gh-installdeps.bash
132+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
133+
src/build-scripts/install_homebrew_deps.bash
134+
elif [[ "$RUNNER_OS" == "Windows" ]]; then
135+
src/build-scripts/gh-win-installdeps.bash
136+
fi
137+
- name: Install sonar-scanner and build-wrapper
138+
if: inputs.sonar == '1'
139+
uses: sonarsource/sonarcloud-github-c-cpp@e4882e1621ad2fb48dddfa48287411bed34789b1 # v2.0.2
140+
- name: Build
141+
if: inputs.skip_build != '1'
142+
shell: bash
143+
run: src/build-scripts/ci-build.bash
144+
- name: Testsuite
145+
if: inputs.skip_tests != '1'
146+
shell: bash
147+
run: src/build-scripts/ci-test.bash
148+
- name: Code coverage
149+
if: inputs.coverage == '1'
150+
run: src/build-scripts/ci-coverage.bash
151+
- name: Sonar-scanner
152+
if: inputs.sonar == 1
153+
env:
154+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
155+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
156+
run: |
157+
which sonar-scanner
158+
ls -l /__w/OpenImageIO/OpenImageIO/bw_output
159+
echo "BUILD_OUTPUT_DIR is " "${{ env.BUILD_WRAPPER_OUT_DIR }}"
160+
find . -name "*.gcov" -print
161+
# sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
162+
time sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="$BUILD_WRAPPER_OUT_DIR" --define sonar.cfamily.gcov.reportsPath="_coverage" --define sonar.cfamily.threads="$PARALLEL"
163+
# Consult https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-cli/ for more information and options
164+
- name: Check out ABI standard
165+
if: inputs.abi_check != ''
166+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
167+
with:
168+
ref: ${{inputs.abi_check}}
169+
path: abi_standard
170+
- name: Build ABI standard
171+
if: inputs.abi_check != ''
172+
shell: bash
173+
run: |
174+
mkdir -p abi_standard/build
175+
pushd abi_standard
176+
src/build-scripts/ci-build.bash
177+
popd
178+
- name: Check ABI
179+
if: inputs.abi_check != ''
180+
shell: bash
181+
run: |
182+
src/build-scripts/ci-abicheck.bash ./build abi_standard/build libOpenImageIO libOpenImageIO_Util
183+
- name: Build Docs
184+
if: inputs.build_docs == '1'
185+
shell: bash
186+
run: |
187+
cd src/doc
188+
time make doxygen
189+
time make sphinx
190+
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
191+
# Note: versions of upload-artifact >= 4.0 can't run on the ASWF
192+
# containers because they need a newer glibc than they have.
193+
if: ${{ failure() || inputs.build_docs == '1'}}
194+
with:
195+
name: oiio-${{github.job}}-${{inputs.nametag}}
196+
path: |
197+
build/cmake-save
198+
build/compat_reports
199+
build/sphinx
200+
build/testsuite/*/*.*
201+
!build/testsuite/oiio-images
202+
!build/testsuite/openexr-images
203+
!build/testsuite/fits-images
204+
!build/testsuite/j2kp4files_v1_5
205+
${{ inputs.extra_artifacts }}

0 commit comments

Comments
 (0)