From af252a1227220dbcb7809b89e8eb9371b7779d3b Mon Sep 17 00:00:00 2001 From: Larry Gritz Date: Fri, 27 Dec 2024 13:28:51 -0800 Subject: [PATCH] ci: fixups of analysis workflow (#4572) * Fix missing secrets that accidentally disabled the analysis workflow a few commits back. After splitting into reusable steps, we needed the main analysis workflow to let the steps workflow inherit secrets. * Run analysis on TOT dev branches. * For analysis, only build OIIO as debug, not dependencies. --------- Signed-off-by: Larry Gritz --- .github/workflows/analysis.yml | 18 +++++++++++++----- sonar-project.properties | 2 +- src/build-scripts/ci-build.bash | 3 ++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index 04aeaa9dc5..7d853071ad 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -14,20 +14,26 @@ on: # Run on pushes only to main or if the branch name contains "analysis" branches: - main + - dev-3.0 - '*analysis*' - '*sonar*' paths: - '**' - '!**.md' - '!**.rst' - - '!**/analysis.yml' + - '!**/ci.yml' - '!**/docs.yml' - '!**.properties' - '!docs/**' + # Run analysis on PRs only if the branch name indicates that the purpose of + # the PR is related to the Sonar analysis. We don't run on every PR because + # the analysis run is very expensive and just isn't usually necessary. + pull_request: + branches: + - '*analysis*' + - '*sonar*' # Allow manual kicking off of the workflow from github.com workflow_dispatch: - # Uncomment the following line if we want to run analysis on all PRs: - # pull_request: permissions: read-all @@ -45,6 +51,8 @@ jobs: # account credentials. if: github.repository == 'AcademySoftwareFoundation/OpenImageIO' uses: ./.github/workflows/build-steps.yml + # Must let the called steps workflow inherit our secrets + secrets: inherit with: nametag: ${{ matrix.nametag || 'unnamed!' }} runner: ${{ matrix.runner || 'ubuntu-latest' }} @@ -75,7 +83,7 @@ jobs: fail-fast: false matrix: include: - - desc: sonar gcc9/C++14 py39 exr3.1 ocio2.2 + - desc: sonar gcc11/C++17 py310 exr3.2 ocio2.3 nametag: static-analysis-sonar os: ubuntu-latest container: aswf/ci-osl:2024-clang17 @@ -90,7 +98,7 @@ jobs: setenvs: export SONAR_SERVER_URL="https://sonarcloud.io" BUILD_WRAPPER_OUT_DIR=/__w/OpenImageIO/OpenImageIO/bw_output OIIO_CMAKE_BUILD_WRAPPER="build-wrapper-linux-x86-64 --out-dir /__w/OpenImageIO/OpenImageIO/bw_output" - CMAKE_BUILD_TYPE=Debug + OIIO_CMAKE_BUILD_TYPE=Debug CMAKE_UNITY_BUILD=OFF CODECOV=1 CTEST_TEST_TIMEOUT=1200 diff --git a/sonar-project.properties b/sonar-project.properties index 43ffa2466b..88eabf0592 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,7 +6,7 @@ sonar.host.url=https://sonarcloud.io # Required metadata sonar.organization=academysoftwarefoundation sonar.projectName=OpenImageIO -sonar.projectVersion=2.6 +sonar.projectVersion=3.1 sonar.projectKey=AcademySoftwareFoundation_OpenImageIO # Project links diff --git a/src/build-scripts/ci-build.bash b/src/build-scripts/ci-build.bash index fa5857abaf..92fd5195c1 100755 --- a/src/build-scripts/ci-build.bash +++ b/src/build-scripts/ci-build.bash @@ -12,6 +12,7 @@ OIIO_CMAKE_FLAGS="$MY_CMAKE_FLAGS $OIIO_CMAKE_FLAGS" export OIIO_SRC_DIR=${OIIO_SRC_DIR:=$PWD} export OIIO_BUILD_DIR=${OIIO_BUILD_DIR:=${OIIO_SRC_DIR}/build} export OIIO_INSTALL_DIR=${OIIO_INSTALL_DIR:=${OIIO_SRC_DIR}/dist} +export OIIO_CMAKE_BUILD_TYPE=${OIIO_CMAKE_BUILD_TYPE:=${CMAKE_BUILD_TYPE:=Release}} if [[ "$USE_SIMD" != "" ]] ; then OIIO_CMAKE_FLAGS="$OIIO_CMAKE_FLAGS -DUSE_SIMD=$USE_SIMD" @@ -32,7 +33,7 @@ fi # pushd $OIIO_BUILD_DIR cmake -S $OIIO_SRC_DIR -B $OIIO_BUILD_DIR -G "$CMAKE_GENERATOR" \ - -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \ + -DCMAKE_BUILD_TYPE="${OIIO_CMAKE_BUILD_TYPE}" \ -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \ -DCMAKE_INSTALL_PREFIX="$OpenImageIO_ROOT" \ -DPYTHON_VERSION="$PYTHON_VERSION" \