1111 # Run unconditionally once weekly
1212 # - cron: "0 0 * * 0"
1313 push :
14- # Run on pushes only to master or if the branch name contains "analysis"
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+ - ' !**.properties'
28+ - ' !docs/**'
29+ # Run analysis on PRs only if the branch name indicates that the purpose of
30+ # the PR is related to the Sonar analysis. We don't run on every PR because
31+ # the analysis run is very expensive and just isn't usually necessary.
32+ pull_request :
1533 branches :
16- - master
1734 - ' *analysis*'
1835 - ' *sonar*'
1936 # Allow manual kicking off of the workflow from github.com
2037 workflow_dispatch :
21- # Uncomment the following line if we want to run analysis on all PRs:
22- # pull_request:
2338
2439permissions : read-all
2540
@@ -36,108 +51,57 @@ jobs:
3651 # Exclude runs on forks, since only the main org has the SonarCloud
3752 # account credentials.
3853 if : github.repository == 'AcademySoftwareFoundation/OpenImageIO'
54+ uses : ./.github/workflows/build-steps.yml
55+ # Must let the called steps workflow inherit necessary secrets
56+ secrets :
57+ PASSED_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
58+ PASSED_SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
59+ with :
60+ nametag : ${{ matrix.nametag || 'unnamed!' }}
61+ runner : ${{ matrix.runner || 'ubuntu-latest' }}
62+ container : ${{ matrix.container }}
63+ cc_compiler : ${{ matrix.cc_compiler }}
64+ cxx_compiler : ${{ matrix.cxx_compiler }}
65+ cxx_std : ${{ matrix.cxx_std || '17' }}
66+ build_type : ${{ matrix.build_type || 'Release' }}
67+ depcmds : ${{ matrix.depcmds }}
68+ extra_artifacts : ${{ matrix.extra_artifacts }}
69+ fmt_ver : ${{ matrix.fmt_ver }}
70+ opencolorio_ver : ${{ matrix.opencolorio_ver }}
71+ openexr_ver : ${{ matrix.openexr_ver }}
72+ pybind11_ver : ${{ matrix.pybind11_ver }}
73+ python_ver : ${{ matrix.python_ver }}
74+ setenvs : ${{ matrix.setenvs }}
75+ simd : ${{ matrix.simd }}
76+ skip_build : ${{ matrix.skip_build }}
77+ skip_tests : ${{ matrix.skip_tests }}
78+ abi_check : ${{ matrix.abi_check }}
79+ build_docs : ${{ matrix.build_docs }}
80+ generator : ${{ matrix.generator }}
81+ ctest_args : ${{ matrix.ctest_args }}
82+ ctest_test_timeout : ${{ matrix.ctest_test_timeout }}
83+ coverage : ${{ matrix.coverage || '0' }}
84+ sonar : ${{ matrix.sonar || '0' }}
3985 strategy :
4086 fail-fast : false
4187 matrix :
4288 include :
43- - desc : sonar gcc9 /C++14 py39 boost1.76 exr3.1 ocio2.2
89+ - desc : sonar gcc11 /C++17 py310 exr3.2 ocio2.3
4490 nametag : static-analysis-sonar
4591 os : ubuntu-latest
46- container : aswf/ci-osl:2023-clang15
47- vfxyear : 2023
92+ container : aswf/ci-osl:2024-clang17
4893 cxx_std : 17
49- python_ver : " 3.10 "
94+ python_ver : " 3.11 "
5095 simd : " avx2,f16c"
5196 fmt_ver : 10.1.1
52- pybind11_ver : v2.10 .0
97+ pybind11_ver : v2.12 .0
5398 coverage : 1
5499 # skip_tests: 1
55100 sonar : 1
56101 setenvs : export SONAR_SERVER_URL="https://sonarcloud.io"
57102 BUILD_WRAPPER_OUT_DIR=/__w/OpenImageIO/OpenImageIO/bw_output
58103 OIIO_CMAKE_BUILD_WRAPPER="build-wrapper-linux-x86-64 --out-dir /__w/OpenImageIO/OpenImageIO/bw_output"
59- CMAKE_BUILD_TYPE =Debug
104+ OIIO_CMAKE_BUILD_TYPE =Debug
60105 CMAKE_UNITY_BUILD=OFF
61106 CODECOV=1
62107 CTEST_TEST_TIMEOUT=1200
63- OIIO_CMAKE_FLAGS="-DOIIO_TEX_IMPLEMENT_VARYINGREF=OFF"
64-
65- runs-on : ${{ matrix.os }}
66- container :
67- image : ${{ matrix.container }}
68- env :
69- CXX : ${{matrix.cxx_compiler}}
70- CC : ${{matrix.cc_compiler}}
71- CMAKE_CXX_STANDARD : ${{matrix.cxx_std}}
72- USE_SIMD : ${{matrix.simd}}
73- FMT_VERSION : ${{matrix.fmt_ver}}
74- OPENEXR_VERSION : ${{matrix.openexr_ver}}
75- PYBIND11_VERSION : ${{matrix.pybind11_ver}}
76- PYTHON_VERSION : ${{matrix.python_ver}}
77- # DEBUG_CI: 1
78- steps :
79- # We would like to use harden-runner, but it flags too many false
80- # positives, every time we download a dependency. We should use it only
81- # on CI runs where we are producing artifacts that users might rely on.
82- # - name: Harden Runner
83- # uses: step-security/harden-runner@248ae51c2e8cc9622ecf50685c8bf7150c6e8813 # v1.4.3
84- # with:
85- # egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
86- - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
87- with :
88- fetch-depth : ' 0'
89- - name : Prepare ccache timestamp
90- id : ccache_cache_keys
91- run : echo "date=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" >> $GITHUB_OUTPUT
92- - name : ccache
93- id : ccache
94- uses : actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
95- with :
96- path : /tmp/ccache
97- key : ${{github.job}}-${{matrix.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
98- restore-keys : ${{github.job}}-
99- - name : Build setup
100- run : |
101- ${{matrix.setenvs}}
102- src/build-scripts/ci-startup.bash
103- - name : Dependencies
104- run : |
105- ${{matrix.depcmds}}
106- src/build-scripts/gh-installdeps.bash
107- - name : Install sonar-scanner and build-wrapper
108- if : matrix.sonar == '1'
109- uses : sonarsource/sonarcloud-github-c-cpp@e4882e1621ad2fb48dddfa48287411bed34789b1 # v2.0.2
110- - name : Build
111- run : src/build-scripts/ci-build.bash
112- - name : Testsuite
113- if : matrix.skip_tests != '1'
114- run : src/build-scripts/ci-test.bash
115- - name : Code coverage
116- if : matrix.coverage == '1'
117- run : src/build-scripts/ci-coverage.bash
118- - name : Sonar-scanner
119- if : matrix.sonar == 1
120- env :
121- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
122- SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
123- run : |
124- which sonar-scanner
125- ls -l /__w/OpenImageIO/OpenImageIO/bw_output
126- echo "BUILD_OUTPUT_DIR is " "${{ env.BUILD_WRAPPER_OUT_DIR }}"
127- find . -name "*.gcov" -print
128- # sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
129- 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"
130- # Consult https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-cli/ for more information and options
131-
132- # - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
133- # if: failure()
134- # with:
135- # name: oiio-${{github.job}}-${{matrix.nametag}}
136- # path: |
137- # build/cmake-save
138- # build/testsuite/*/*.*
139- # !build/testsuite/oiio-images
140- # !build/testsuite/openexr-images
141- # !build/testsuite/fits-images
142- # !build/testsuite/j2kp4files_v1_5
143-
0 commit comments