Skip to content

Commit 6f55fde

Browse files
committed
ci: Analysis workflow overhaul, use shared steps, fix
Signed-off-by: Larry Gritz <[email protected]>
1 parent 675e313 commit 6f55fde

File tree

1 file changed

+52
-76
lines changed

1 file changed

+52
-76
lines changed

.github/workflows/analysis.yml

Lines changed: 52 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,27 @@ on:
1111
# Run unconditionally once weekly
1212
# - cron: "0 0 * * 0"
1313
push:
14+
# Run on pushes only to main or if the branch name contains "analysis"
1415
branches:
1516
- main
1617
- '*analysis*'
17-
paths-ignore:
18-
- '**.md'
19-
- '**.rst'
20-
- '**.tex'
18+
- '*sonar*'
19+
paths:
20+
- '**'
21+
- '!**.md'
22+
- '!**.rst'
23+
- '!**/ci.yml'
24+
- '!**/docs.yml'
25+
- '!**/scorecard.yml'
26+
- '!**.properties'
27+
- '!docs/**'
28+
# Run analysis on PRs only if the branch name indicates that the purpose of
29+
# the PR is related to the Sonar analysis. We don't run on every PR because
30+
# the analysis run is very expensive and just isn't usually necessary.
31+
pull_request:
32+
branches:
33+
- '*analysis*'
34+
- '*sonar*'
2135
# Allow manual kicking off of the workflow from github.com
2236
workflow_dispatch:
2337

@@ -31,19 +45,47 @@ concurrency:
3145

3246
jobs:
3347

34-
aswf:
35-
name: "SonarCloud Analysis"
48+
sonar-analysis:
3649
if: |
3750
github.repository == 'AcademySoftwareFoundation/OpenShadingLanguage'
51+
name: "${{matrix.desc}}"
52+
uses: ./.github/workflows/build-steps.yml
53+
with:
54+
nametag: ${{ matrix.nametag || 'unnamed!' }}
55+
runner: ${{ matrix.runner || 'ubuntu-latest' }}
56+
container: ${{ matrix.container }}
57+
cc_compiler: ${{ matrix.cc_compiler || 'gcc' }}
58+
cxx_compiler: ${{ matrix.cxx_compiler || 'g++' }}
59+
cxx_std: ${{ matrix.cxx_std || '17' }}
60+
build_type: ${{ matrix.build_type || 'Release' }}
61+
depcmds: ${{ matrix.depcmds }}
62+
extra_artifacts: ${{ matrix.extra_artifacts }}
63+
fmt_ver: ${{ matrix.fmt_ver }}
64+
opencolorio_ver: ${{ matrix.opencolorio_ver }}
65+
openexr_ver: ${{ matrix.openexr_ver }}
66+
openimageio_ver: ${{ matrix.openimageio_ver }}
67+
pybind11_ver: ${{ matrix.pybind11_ver }}
68+
python_ver: ${{ matrix.python_ver }}
69+
setenvs: ${{ matrix.setenvs }}
70+
simd: ${{ matrix.simd }}
71+
batched: ${{ matrix.batched }}
72+
skip_build: ${{ matrix.skip_build }}
73+
skip_tests: ${{ matrix.skip_tests }}
74+
abi_check: ${{ matrix.abi_check }}
75+
build_docs: ${{ matrix.build_docs }}
76+
generator: ${{ matrix.generator }}
77+
ctest_args: ${{ matrix.ctest_args }}
78+
ctest_test_timeout: ${{ matrix.ctest_test_timeout || '800' }}
79+
coverage: ${{ matrix.coverage || 0 }}
80+
sonar: ${{ matrix.sonar || 0 }}
3881
strategy:
3982
fail-fast: false
4083
matrix:
4184
include:
42-
- desc: sonar gcc9/C++17 llvm13 py3.9 exr3.1 oiio3.0 avx2
85+
- desc: sonar VP2024 gcc11/C++17 llvm17 py3.11 oiio-rel avx2
4386
nametag: static-analysis-sonar
44-
os: ubuntu-latest
45-
vfxyear: 2024
46-
vfxsuffix: -clang17
87+
runner: ubuntu-latest
88+
container: aswftesting/ci-osl:2024-clang17
4789
cxx_std: 17
4890
openimageio_ver: release
4991
python_ver: "3.11"
@@ -66,69 +108,3 @@ jobs:
66108
CTEST_TEST_TIMEOUT=1200
67109
CTEST_EXCLUSIONS="broken|noise-reg.regress|noise-gabor-reg.regress"
68110

69-
runs-on: ${{ matrix.os }}
70-
container:
71-
image: aswf/ci-osl:2024-clang17
72-
env:
73-
CXX: ${{matrix.cxx_compiler}}
74-
CC: ${{matrix.cc_compiler}}
75-
CMAKE_CXX_STANDARD: ${{matrix.cxx_std}}
76-
FMT_VERSION: ${{matrix.fmt_ver}}
77-
OPENEXR_VERSION: ${{matrix.openexr_ver}}
78-
OPENIMAGEIO_VERSION: ${{matrix.openimageio_ver}}
79-
PYBIND11_VERSION: ${{matrix.pybind11_ver}}
80-
PYTHON_VERSION: ${{matrix.python_ver}}
81-
USE_BATCHED: ${{matrix.batched}}
82-
USE_SIMD: ${{matrix.simd}}
83-
# DEBUG_CI: 1
84-
steps:
85-
# We would like to use harden-runner, but it flags too many false
86-
# positives, every time we download a dependency. We should use it only
87-
# on CI runs where we are producing artifacts that users might rely on.
88-
# - name: Harden Runner
89-
# uses: step-security/harden-runner@248ae51c2e8cc9622ecf50685c8bf7150c6e8813 # v1.4.3
90-
# with:
91-
# egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
92-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
93-
with:
94-
fetch-depth: '0'
95-
- name: Prepare ccache timestamp
96-
id: ccache_cache_keys
97-
run: echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
98-
- name: ccache
99-
id: ccache
100-
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
101-
with:
102-
path: /tmp/ccache
103-
key: ${{github.job}}-${{matrix.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
104-
restore-keys: ${{github.job}}-
105-
- name: Build setup
106-
run: |
107-
${{matrix.setenvs}}
108-
src/build-scripts/ci-startup.bash
109-
- name: Remove existing OIIO
110-
if: matrix.openimageio_ver != ''
111-
run: |
112-
sudo rm -rf /usr/local/include/OpenImageIO
113-
sudo rm -rf /usr/local/lib*/cmake/OpenImageIO
114-
sudo rm -rf /usr/local/lib*/libOpenImageIO*
115-
sudo rm -rf /usr/local/lib*/python3.9/site-packages/OpenImageIO*
116-
- name: Dependencies
117-
run: |
118-
${{matrix.depcmds}}
119-
src/build-scripts/gh-installdeps.bash
120-
- name: Build
121-
run: src/build-scripts/ci-build.bash
122-
- name: Testsuite
123-
if: matrix.skip_tests != '1'
124-
run: src/build-scripts/ci-test.bash
125-
- name: Code coverage
126-
if: matrix.coverage == '1'
127-
run: src/build-scripts/ci-coverage.bash
128-
- name: Sonar-scanner
129-
if: matrix.sonar == 1
130-
env:
131-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
133-
run: |
134-
sonar-scanner -X --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="build/bw_output" --define sonar.cfamily.gcov.reportsPath="_coverage"

0 commit comments

Comments
 (0)