Skip to content

Commit 53b0294

Browse files
committed
Revert "Remove all GitHub Actions workflow files"
This reverts commit 0ea3dff.
1 parent 1640275 commit 53b0294

8 files changed

Lines changed: 1853 additions & 0 deletions

File tree

.github/workflows/analysis.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Copyright Contributors to the OpenImageIO project.
2+
# SPDX-License-Identifier: Apache-2.0
3+
# https://github.com/AcademySoftwareFoundation/OpenImageIO
4+
5+
name: Analysis
6+
7+
on:
8+
schedule:
9+
# Run nightly while we're still working our way through the warnings
10+
- cron: "0 8 * * *"
11+
# Run unconditionally once weekly
12+
# - cron: "0 0 * * 0"
13+
push:
14+
# Run on pushes only to main or if the branch name contains "analysis"
15+
branches:
16+
- main
17+
- dev-3.0
18+
- '*analysis*'
19+
- '*sonar*'
20+
paths:
21+
- '**'
22+
- '!**.md'
23+
- '!**.rst'
24+
- '!**/ci.yml'
25+
- '!**/docs.yml'
26+
- '!**/scorecard.yml'
27+
- '!**/wheel.yml'
28+
- '!**.properties'
29+
- '!docs/**'
30+
# Run analysis on PRs only if the branch name indicates that the purpose of
31+
# the PR is related to the Sonar analysis. We don't run on every PR because
32+
# the analysis run is very expensive and just isn't usually necessary.
33+
pull_request:
34+
branches:
35+
- '*analysis*'
36+
- '*sonar*'
37+
# Allow manual kicking off of the workflow from github.com
38+
workflow_dispatch:
39+
40+
permissions: read-all
41+
42+
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
43+
concurrency:
44+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
45+
cancel-in-progress: true
46+
47+
48+
jobs:
49+
50+
aswf:
51+
name: "SonarCloud Analysis"
52+
# Exclude runs on forks, since only the main org has the SonarCloud
53+
# account credentials.
54+
if: github.repository == 'AcademySoftwareFoundation/OpenImageIO'
55+
uses: ./.github/workflows/build-steps.yml
56+
# Must let the called steps workflow inherit necessary secrets
57+
secrets:
58+
PASSED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
PASSED_SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
60+
with:
61+
nametag: ${{ matrix.nametag || 'unnamed!' }}
62+
runner: ${{ matrix.runner || 'ubuntu-latest' }}
63+
container: ${{ matrix.container }}
64+
cc_compiler: ${{ matrix.cc_compiler }}
65+
cxx_compiler: ${{ matrix.cxx_compiler }}
66+
cxx_std: ${{ matrix.cxx_std || '17' }}
67+
build_type: ${{ matrix.build_type || 'Release' }}
68+
depcmds: ${{ matrix.depcmds }}
69+
extra_artifacts: ${{ matrix.extra_artifacts }}
70+
fmt_ver: ${{ matrix.fmt_ver }}
71+
opencolorio_ver: ${{ matrix.opencolorio_ver }}
72+
openexr_ver: ${{ matrix.openexr_ver }}
73+
pybind11_ver: ${{ matrix.pybind11_ver }}
74+
python_ver: ${{ matrix.python_ver }}
75+
setenvs: ${{ matrix.setenvs }}
76+
simd: ${{ matrix.simd }}
77+
skip_build: ${{ matrix.skip_build }}
78+
skip_tests: ${{ matrix.skip_tests }}
79+
abi_check: ${{ matrix.abi_check }}
80+
build_docs: ${{ matrix.build_docs }}
81+
generator: ${{ matrix.generator }}
82+
ctest_args: ${{ matrix.ctest_args }}
83+
ctest_test_timeout: ${{ matrix.ctest_test_timeout }}
84+
coverage: ${{ matrix.coverage || '0' }}
85+
sonar: ${{ matrix.sonar || '0' }}
86+
strategy:
87+
fail-fast: false
88+
matrix:
89+
include:
90+
- desc: sonar gcc11/C++17 py311 exr3.2 ocio2.3
91+
nametag: static-analysis-sonar
92+
os: ubuntu-latest
93+
container: aswf/ci-oiio:2024.2
94+
cxx_std: 17
95+
python_ver: "3.11"
96+
simd: "avx2,f16c"
97+
opencolorio_ver: v2.3.2
98+
fmt_ver: 10.1.1
99+
pybind11_ver: v2.12.0
100+
coverage: 1
101+
# skip_tests: 1
102+
sonar: 1
103+
setenvs: export SONAR_SERVER_URL="https://sonarcloud.io"
104+
BUILD_WRAPPER_OUT_DIR=/__w/OpenImageIO/OpenImageIO/bw_output
105+
OIIO_CMAKE_BUILD_WRAPPER="build-wrapper-linux-x86-64 --out-dir /__w/OpenImageIO/OpenImageIO/bw_output"
106+
OIIO_CMAKE_BUILD_TYPE=Debug
107+
CMAKE_UNITY_BUILD=OFF
108+
CODECOV=1
109+
CTEST_TEST_TIMEOUT=1200

.github/workflows/build-steps.yml

Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
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+
container_volumes:
22+
type: string
23+
default: '[]'
24+
cc_compiler:
25+
type: string
26+
cxx_compiler:
27+
type: string
28+
cxx_std:
29+
type: string
30+
build_type:
31+
type: string
32+
depcmds:
33+
type: string
34+
extra_artifacts:
35+
type: string
36+
fmt_ver:
37+
type: string
38+
opencolorio_ver:
39+
type: string
40+
openexr_ver:
41+
type: string
42+
pybind11_ver:
43+
type: string
44+
python_ver:
45+
type: string
46+
setenvs:
47+
type: string
48+
simd:
49+
type: string
50+
skip_build:
51+
type: string
52+
skip_tests:
53+
type: string
54+
abi_check:
55+
type: string
56+
benchmark:
57+
type: string
58+
build_docs:
59+
type: string
60+
clang_format:
61+
type: string
62+
generator:
63+
type: string
64+
ctest_args:
65+
type: string
66+
ctest_test_timeout:
67+
type: string
68+
coverage:
69+
type: string
70+
sonar:
71+
type: string
72+
old_node:
73+
type: string
74+
default: 0
75+
nametag:
76+
type: string
77+
required_deps:
78+
type: string
79+
optional_deps:
80+
type: string
81+
secrets:
82+
PASSED_GITHUB_TOKEN:
83+
required: false
84+
PASSED_SONAR_TOKEN:
85+
required: false
86+
87+
permissions: read-all
88+
89+
90+
jobs:
91+
92+
steps:
93+
name: "${{inputs.cxx_compiler}} c++${{inputs.cxx_std}} py${{inputs.python_ver}}"
94+
runs-on: ${{ inputs.runner }}
95+
container:
96+
image: ${{ inputs.container }}
97+
volumes: ${{ fromJson( inputs.container_volumes ) }}
98+
options: -v /:/host/root ${{ (contains(inputs.runner, 'gpu') && '-e NVIDIA_DRIVER_CAPABILITIES=compute,graphics,utility --gpus all') || '-e A=x' }}
99+
# Extra options:
100+
# - Ensure the GPU runners have OptiX is visible in the container.
101+
# - Mount the native filesystem under /host/root
102+
env:
103+
CXX: ${{inputs.cxx_compiler}}
104+
CC: ${{inputs.cc_compiler}}
105+
CMAKE_BUILD_TYPE: ${{inputs.build_type}}
106+
CMAKE_CXX_STANDARD: ${{inputs.cxx_std}}
107+
CMAKE_GENERATOR: ${{inputs.generator}}
108+
CTEST_ARGS: ${{inputs.ctest_args}}
109+
CTEST_TEST_TIMEOUT: ${{inputs.ctest_test_timeout}}
110+
USE_SIMD: ${{inputs.simd}}
111+
fmt_BUILD_VERSION: ${{inputs.fmt_ver}}
112+
OPENCOLORIO_VERSION: ${{inputs.opencolorio_ver}}
113+
OPENEXR_VERSION: ${{inputs.openexr_ver}}
114+
PYBIND11_VERSION: ${{inputs.pybind11_ver}}
115+
PYTHON_VERSION: ${{inputs.python_ver}}
116+
ABI_CHECK: ${{inputs.abi_check}}
117+
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
118+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
119+
# For CI, sometimes we want to require all dependencies to be present,
120+
# except for a select few listed explicitly. This ensures that we don't
121+
# accidentally have a situation in which we think we are building
122+
# against and testing an optional dependency, but in fact are not.
123+
OpenImageIO_REQUIRED_DEPS: ${{inputs.required_deps}}
124+
OpenImageIO_OPTIONAL_DEPS: ${{inputs.optional_deps}}
125+
126+
steps:
127+
- name: install nodejs20glibc2.17
128+
if: inputs.old_node == '1'
129+
run: |
130+
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 -
131+
- name: Checkout repo
132+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
133+
- name: Build setup
134+
shell: bash
135+
run: |
136+
${{inputs.setenvs}}
137+
src/build-scripts/ci-startup.bash
138+
- name: Prepare ccache timestamp
139+
id: ccache_cache_keys
140+
shell: bash
141+
run: echo "date=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" >> $GITHUB_OUTPUT
142+
- name: ccache-restore
143+
id: ccache-restore
144+
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
145+
with:
146+
path: ${{ env.CCACHE_DIR }}
147+
# path: ./ccache
148+
key: ${{inputs.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
149+
restore-keys: ${{inputs.nametag}}
150+
- name: Dependencies
151+
shell: bash
152+
run: |
153+
${{inputs.depcmds}}
154+
if [[ "$RUNNER_OS" == "Linux" ]]; then
155+
src/build-scripts/gh-installdeps.bash
156+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
157+
src/build-scripts/install_homebrew_deps.bash
158+
elif [[ "$RUNNER_OS" == "Windows" ]]; then
159+
src/build-scripts/gh-win-installdeps.bash
160+
fi
161+
- name: Install sonar-scanner and build-wrapper
162+
if: inputs.sonar == '1'
163+
uses: sonarsource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602 # v6.0.0
164+
- name: Build
165+
if: inputs.skip_build != '1'
166+
shell: bash
167+
run: src/build-scripts/ci-build.bash
168+
- name: Check out ABI standard
169+
if: inputs.abi_check != ''
170+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
171+
with:
172+
ref: ${{inputs.abi_check}}
173+
path: abi_standard
174+
- name: Build ABI standard
175+
if: inputs.abi_check != ''
176+
shell: bash
177+
run: |
178+
mkdir -p abi_standard/build
179+
pushd abi_standard
180+
src/build-scripts/ci-build.bash
181+
popd
182+
- name: ccache-save
183+
id: ccache-save
184+
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
185+
with:
186+
path: ${{ env.CCACHE_DIR }}
187+
key: ${{inputs.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
188+
- name: Testsuite
189+
if: inputs.skip_tests != '1'
190+
shell: bash
191+
run: src/build-scripts/ci-test.bash
192+
- name: Benchmarks
193+
if: inputs.benchmark == '1'
194+
shell: bash
195+
run: src/build-scripts/ci-benchmark.bash
196+
- name: clang-format
197+
if: inputs.clang_format == '1'
198+
shell: bash
199+
run: src/build-scripts/run-clang-format.bash
200+
- name: Code coverage
201+
if: inputs.coverage == '1'
202+
run: src/build-scripts/ci-coverage.bash
203+
- name: Sonar-scanner
204+
if: inputs.sonar == '1'
205+
env:
206+
GITHUB_TOKEN: ${{ secrets.PASSED_GITHUB_TOKEN }}
207+
SONAR_TOKEN: ${{ secrets.PASSED_SONAR_TOKEN }}
208+
run: |
209+
which sonar-scanner
210+
ls -l /__w/OpenImageIO/OpenImageIO/bw_output
211+
echo "BUILD_OUTPUT_DIR is " "${{ env.BUILD_WRAPPER_OUT_DIR }}"
212+
find . -name "*.gcov" -print
213+
# sonar-scanner --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
214+
time sonar-scanner --define sonar.host.url="${{ env.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"
215+
# Consult https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-cli/ for more information and options
216+
- name: Check ABI
217+
if: inputs.abi_check != ''
218+
shell: bash
219+
run: |
220+
src/build-scripts/ci-abicheck.bash ./build abi_standard/build libOpenImageIO libOpenImageIO_Util
221+
- name: Build Docs
222+
if: inputs.build_docs == '1'
223+
shell: bash
224+
run: |
225+
cd src/doc
226+
time make doxygen
227+
time make sphinx
228+
- name: Upload testsuite debugging artifacts
229+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
230+
if: ${{ failure() || inputs.build_docs == '1' || inputs.benchmark == '1' || inputs.abi_check != '' }}
231+
with:
232+
name: oiio-${{github.job}}-${{inputs.nametag}}
233+
path: |
234+
build/cmake-save
235+
build/compat_reports
236+
build/sphinx
237+
build/benchmarks
238+
build/testsuite/*/*.*
239+
!build/testsuite/oiio-images
240+
!build/testsuite/openexr-images
241+
!build/testsuite/fits-images
242+
!build/testsuite/j2kp4files_v1_5
243+
${{ inputs.extra_artifacts }}

0 commit comments

Comments
 (0)