From 5446c1d17f2cd43840c750188fbd6f2aca94f909 Mon Sep 17 00:00:00 2001 From: Larry Gritz Date: Wed, 15 Jan 2025 10:41:01 -0800 Subject: [PATCH] ci: break out reusable build steps (#1919) Modeled after what we recently did for OIIO. Now the new build-steps.yml contains all the logic for the sequence of how to build and test for any configuration, and the main ci.yml has the specifications of all the different testing configurations. The different platforms share the same build steps, so there's a lot less needless repetition (and opportunity for divergence and mistakes). Also add MacOS 15 to the CI suite. --------- Signed-off-by: Larry Gritz --- .github/workflows/build-steps.yml | 215 +++++++++++ .github/workflows/ci.yml | 353 +++++-------------- src/build-scripts/ci-startup.bash | 18 +- src/build-scripts/gh-installdeps.bash | 2 +- src/build-scripts/install_homebrew_deps.bash | 5 + 5 files changed, 329 insertions(+), 264 deletions(-) create mode 100644 .github/workflows/build-steps.yml diff --git a/.github/workflows/build-steps.yml b/.github/workflows/build-steps.yml new file mode 100644 index 000000000..7e31f61c1 --- /dev/null +++ b/.github/workflows/build-steps.yml @@ -0,0 +1,215 @@ +# Copyright Contributors to the Open Shading Language project. +# SPDX-License-Identifier: BSD-3-Clause +# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage + +########################################################################## +# Common steps for all CI workflows +########################################################################## + +name: CI Steps + +on: + workflow_call: + # This inputs receive values via the "with:" section in ci_workflow.yml + inputs: + build: + type: string + runner: + type: string + container: + type: string + cc_compiler: + type: string + cxx_compiler: + type: string + cxx_std: + type: string + batched: + type: string + build_type: + type: string + depcmds: + type: string + extra_artifacts: + type: string + fmt_ver: + type: string + opencolorio_ver: + type: string + openexr_ver: + type: string + openimageio_ver: + type: string + pybind11_ver: + type: string + python_ver: + type: string + setenvs: + type: string + simd: + type: string + skip_build: + type: string + skip_tests: + type: string + abi_check: + type: string + build_docs: + type: string + generator: + type: string + ctest_args: + type: string + ctest_test_timeout: + type: string + coverage: + type: string + sonar: + type: string + nametag: + type: string + secrets: + PASSED_GITHUB_TOKEN: + required: false + PASSED_SONAR_TOKEN: + required: false + +permissions: read-all + + +jobs: + + steps: + name: "${{inputs.cxx_compiler}} c++${{inputs.cxx_std}} py${{inputs.python_ver}}" + runs-on: ${{ inputs.runner }} + container: + image: ${{ inputs.container }} + + env: + CXX: ${{inputs.cxx_compiler}} + CC: ${{inputs.cc_compiler}} + CMAKE_BUILD_TYPE: ${{inputs.build_type}} + CMAKE_CXX_STANDARD: ${{inputs.cxx_std}} + CMAKE_GENERATOR: ${{inputs.generator}} + CTEST_ARGS: ${{inputs.ctest_args}} + CTEST_TEST_TIMEOUT: ${{inputs.ctest_test_timeout}} + USE_SIMD: ${{inputs.simd}} + FMT_VERSION: ${{inputs.fmt_ver}} + OPENCOLORIO_VERSION: ${{inputs.opencolorio_ver}} + OPENEXR_VERSION: ${{inputs.openexr_ver}} + OPENIMAGEIO_VERSION: ${{inputs.openimageio_ver}} + PYBIND11_VERSION: ${{inputs.pybind11_ver}} + PYTHON_VERSION: ${{inputs.python_ver}} + USE_BATCHED: ${{inputs.batched}} + ABI_CHECK: ${{inputs.abi_check}} + ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: '0' + - name: Prepare ccache timestamp + id: ccache_cache_keys + shell: bash + run: echo "date=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" >> $GITHUB_OUTPUT + - name: ccache + id: ccache + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: ./ccache + key: ${{github.job}}-${{inputs.nametag}}-${{steps.ccache_cache_keys.outputs.date}} + restore-keys: ${{github.job}}- + - name: Setup Nuget.exe (Windows only) + if: runner.os == 'Windows' + uses: nuget/setup-nuget@a21f25cd3998bf370fde17e3f1b4c12c175172f9 # v2.0.0 + - name: Build setup + shell: bash + run: | + ${{inputs.setenvs}} + src/build-scripts/ci-startup.bash + - name: Dependencies + shell: bash + run: | + ${{inputs.depcmds}} + if [[ "$RUNNER_OS" == "Linux" ]]; then + src/build-scripts/gh-installdeps.bash + elif [[ "$RUNNER_OS" == "macOS" ]]; then + src/build-scripts/install_homebrew_deps.bash + if [[ "$OPENIMAGEIO_VERSION" != "" ]] ; then \ + OPENIMAGEIO_CMAKE_FLAGS="-DOIIO_BUILD_TESTS=0 -DUSE_OPENGL=0 -DCMAKE_UNITY_BUILD=ON" ; \ + source src/build-scripts/build_openimageio.bash ; \ + else \ + brew install --display-times -q openimageio ; \ + PYTHONPATH=$PYTHONPATH:/usr/local/lib/python${PYTHON_VERSION}/site-packages ; \ + fi + src/build-scripts/save-env.bash + elif [[ "$RUNNER_OS" == "Windows" ]]; then + src/build-scripts/gh-win-installdeps.bash + fi + - name: Install sonar-scanner and build-wrapper + if: inputs.sonar == '1' + uses: sonarsource/sonarcloud-github-c-cpp@e4882e1621ad2fb48dddfa48287411bed34789b1 # v2.0.2 + - name: Build + if: inputs.skip_build != '1' + shell: bash + run: src/build-scripts/ci-build.bash + - name: Testsuite + if: inputs.skip_tests != '1' + shell: bash + run: src/build-scripts/ci-test.bash + - name: Code coverage + if: inputs.coverage == '1' + run: src/build-scripts/ci-coverage.bash + - name: Sonar-scanner + if: inputs.sonar == 1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + which sonar-scanner + ls -l /__w/OpenShadingLanguage/OpenShadingLanguage/bw_output + echo "BUILD_OUTPUT_DIR is " "${{ env.BUILD_WRAPPER_OUT_DIR }}" + find . -name "*.gcov" -print + # sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" + 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" + # Consult https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-cli/ for more information and options + - name: Check out ABI standard + if: inputs.abi_check != '' + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + ref: ${{inputs.abi_check}} + path: abi_standard + - name: Build ABI standard + if: inputs.abi_check != '' + shell: bash + run: | + mkdir -p abi_standard/build + pushd abi_standard + src/build-scripts/ci-build.bash + popd + - name: Check ABI + if: inputs.abi_check != '' + shell: bash + run: | + src/build-scripts/ci-abicheck.bash ./build abi_standard/build \ + liboslexec liboslcomp liboslquery liboslnoise + - name: Build Docs + if: inputs.build_docs == '1' + shell: bash + run: | + cd src/doc + time make doxygen + time make sphinx + - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 + if: ${{ failure() || inputs.build_docs == '1'}} + with: + name: osl-${{github.job}}-${{inputs.nametag}} + path: | + build/cmake-save + build/compat_reports + build/sphinx + build/*.cmake + build/CMake* + build/testsuite/*/*.* + ${{ inputs.extra_artifacts }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a3dc4c53..00da9a1e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,15 +10,23 @@ name: CI on: push: # Skip jobs when only documentation files are changed - paths-ignore: - - '**.md' - - '**.rst' - - '**.tex' + # Skip jobs when only documentation files are changed + paths: + - '**' + - '!**.md' + - '!**.rst' + - '!**.tex' + - '!**/analysis.yml' + - '!**/docs.yml' + - '!**.properties' + - '!doc/**' pull_request: - paths-ignore: - - '**.md' - - '**.rst' - - '**.tex' + paths: + - '**' + - '!**.md' + - '!**.rst' + - '!**.tex' + - '!doc/**' schedule: # Full nightly build, for the main project repo (not for forks) - cron: "0 6 * * *" @@ -26,7 +34,6 @@ on: workflow_dispatch: # This allows manual triggering of the workflow from the web - permissions: read-all @@ -181,25 +188,6 @@ jobs: - name: Testsuite if: matrix.skip_tests != '1' run: src/build-scripts/ci-test.bash - - name: Check out ABI standard - if: matrix.abi_check != '' - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - ref: ${{matrix.abi_check}} - path: abi_standard - - name: Build ABI standard - if: matrix.abi_check != '' - run: | - mkdir -p abi_standard/build - pushd abi_standard - export LD_LIBRARY_PATH="${PWD}/build/lib:${LD_LIBRARY_PATH}" - src/build-scripts/ci-build.bash - popd - - name: Check ABI - if: matrix.abi_check != '' - run: | - src/build-scripts/ci-abicheck.bash ./build abi_standard/build \ - liboslexec liboslcomp liboslquery liboslnoise - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 if: failure() with: @@ -212,28 +200,56 @@ jobs: build/testsuite/*/*.* - aswf: - name: "VFX${{matrix.vfxyear}} ${{matrix.desc}}" + + linux: + name: "${{matrix.desc}}" + uses: ./.github/workflows/build-steps.yml + with: + nametag: ${{ matrix.nametag || 'unnamed!' }} + runner: ${{ matrix.runner || 'ubuntu-latest' }} + container: ${{ matrix.container }} + cc_compiler: ${{ matrix.cc_compiler || 'gcc' }} + cxx_compiler: ${{ matrix.cxx_compiler || 'g++' }} + cxx_std: ${{ matrix.cxx_std || '17' }} + build_type: ${{ matrix.build_type || 'Release' }} + depcmds: ${{ matrix.depcmds }} + extra_artifacts: ${{ matrix.extra_artifacts }} + fmt_ver: ${{ matrix.fmt_ver }} + opencolorio_ver: ${{ matrix.opencolorio_ver }} + openexr_ver: ${{ matrix.openexr_ver }} + openimageio_ver: ${{ matrix.openimageio_ver }} + pybind11_ver: ${{ matrix.pybind11_ver }} + python_ver: ${{ matrix.python_ver }} + setenvs: ${{ matrix.setenvs }} + simd: ${{ matrix.simd }} + batched: ${{ matrix.batched }} + skip_build: ${{ matrix.skip_build }} + skip_tests: ${{ matrix.skip_tests }} + abi_check: ${{ matrix.abi_check }} + build_docs: ${{ matrix.build_docs }} + generator: ${{ matrix.generator }} + ctest_args: ${{ matrix.ctest_args }} + ctest_test_timeout: ${{ matrix.ctest_test_timeout || '800' }} + coverage: ${{ matrix.coverage || 0 }} + sonar: ${{ matrix.sonar || 0 }} strategy: fail-fast: false matrix: include: - - desc: gcc11/C++17 llvm15 py3.10 oiio-rel avx2 + - desc: VP2023 gcc11/C++17 llvm15 py3.10 oiio-rel avx2 nametag: linux-vfx2023 runner: ubuntu-latest container: aswftesting/ci-osl:2023-clang15 - vfxyear: 2023 cxx_std: 17 openimageio_ver: release python_ver: "3.10" pybind11_ver: v2.9.0 simd: avx2,f16c batched: b8_AVX2 - - desc: GPU Cuda11 gcc11/C++17 llvm15 py3.10 OIIO-main avx2 + - desc: VP2023 GPU Cuda11 gcc11/C++17 llvm15 py3.10 OIIO-main avx2 nametag: linux-optix7-2023 runner: ubuntu-latest container: aswftesting/ci-osl:2023-clang15 - vfxyear: 2023 cxx_std: 17 openimageio_ver: main python_ver: "3.10" @@ -242,11 +258,10 @@ jobs: skip_tests: 1 setenvs: export OSL_CMAKE_FLAGS="-DOSL_USE_OPTIX=1" OPTIX_VERSION=7.0 OPENIMAGEIO_CMAKE_FLAGS=-DBUILD_FMT_VERSION=9.1.0 - - desc: gcc11/C++17 llvm17 py3.11 boost1.82 oiio-rel avx2 + - desc: VP2024 gcc11/C++17 llvm17 py3.11 boost1.82 oiio-rel avx2 nametag: linux-vfx2024 runner: ubuntu-latest container: aswftesting/ci-osl:2024-clang17 - vfxyear: 2024 cxx_std: 17 openimageio_ver: release python_ver: "3.11" @@ -260,7 +275,6 @@ jobs: nametag: sanitizer runner: ubuntu-latest container: aswftesting/ci-osl:2024-clang17 - vfxyear: 2024 cc_compiler: clang cxx_compiler: clang++ cxx_std: 17 @@ -304,7 +318,6 @@ jobs: nametag: linux-vfx2023 runner: ubuntu-latest container: aswftesting/ci-osl:2023-clang15 - vfxyear: 2023 cc_compiler: gcc cxx_compiler: g++ cxx_std: 17 @@ -324,7 +337,6 @@ jobs: nametag: linux-icc runner: ubuntu-latest container: aswftesting/ci-osl:2023-clang15 - vfxyear: 2023 cc_compiler: icc cxx_compiler: icpc cxx_std: 17 @@ -349,7 +361,6 @@ jobs: nametag: linux-icx runner: ubuntu-latest container: aswftesting/ci-osl:2023-clang15 - vfxyear: 2023 cc_compiler: icx cxx_compiler: icpx cxx_std: 17 @@ -363,108 +374,6 @@ jobs: setenvs: export OSL_CMAKE_FLAGS="-DSTOP_ON_WARNING=OFF" USE_OPENVDB=0 OPENCOLORIO_CXX=g++ - runs-on: ${{matrix.runner}} - container: - image: ${{ matrix.container }} - env: - CXX: ${{matrix.cxx_compiler}} - CC: ${{matrix.cc_compiler}} - CMAKE_CXX_STANDARD: ${{matrix.cxx_std}} - FMT_VERSION: ${{matrix.fmt_ver}} - OPENCOLORIO_VERSION: ${{matrix.opencolorio_ver}} - OPENEXR_VERSION: ${{matrix.openexr_ver}} - OPENIMAGEIO_VERSION: ${{matrix.openimageio_ver}} - PYBIND11_VERSION: ${{matrix.pybind11_ver}} - PYTHON_VERSION: ${{matrix.python_ver}} - USE_BATCHED: ${{matrix.batched}} - USE_SIMD: ${{matrix.simd}} - ABI_CHECK: ${{matrix.abi_check}} - ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true - steps: - # We would like to use harden-runner, but it flags too many false - # positives, every time we download a dependency. We should use it only - # on CI runs where we are producing artifacts that users might rely on. - # - name: Harden Runner - # uses: step-security/harden-runner@248ae51c2e8cc9622ecf50685c8bf7150c6e8813 # v1.4.3 - # with: - # egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 - - name: Prepare ccache timestamp - id: ccache_cache_keys - run: echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`" - - name: ccache - id: ccache - uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4 - with: - path: /tmp/ccache - key: ${{github.job}}-${{matrix.nametag}}-${{steps.ccache_cache_keys.outputs.date}} - restore-keys: ${{github.job}}-${{matrix.nametag}}- - - name: Build setup - run: | - ${{matrix.setenvs}} - src/build-scripts/ci-startup.bash - - name: Remove existing OpenEXR - if: matrix.openexr_ver != '' - run: | - sudo rm -rf /usr/local/include/OpenEXR - sudo rm -rf /usr/local/lib*/cmake/OpenEXR - sudo rm -rf /usr/local/lib*/libOpenOpenEXR* - sudo rm -rf /usr/local/lib*/python3.9/site-packages/OpenOpenEXR* - - name: Remove existing OIIO - if: matrix.openimageio_ver != '' - run: | - sudo rm -rf /usr/local/include/OpenImageIO - sudo rm -rf /usr/local/lib*/cmake/OpenImageIO - sudo rm -rf /usr/local/lib*/libOpenImageIO* - sudo rm -rf /usr/local/lib*/python3.9/site-packages/OpenImageIO* - - name: Dependencies - run: | - ${{matrix.depcmds}} - src/build-scripts/gh-installdeps.bash - - name: Build - run: | - src/build-scripts/ci-build.bash - - name: Testsuite - if: matrix.skip_tests != '1' - run: src/build-scripts/ci-test.bash - - name: Check out ABI standard - if: matrix.abi_check != '' - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - ref: ${{matrix.abi_check}} - path: abi_standard - - name: Build ABI standard - if: matrix.abi_check != '' - run: | - mkdir -p abi_standard/build - pushd abi_standard - export LD_LIBRARY_PATH="${PWD}/build/lib:${LD_LIBRARY_PATH}" - src/build-scripts/ci-build.bash - popd - - name: Check ABI - if: matrix.abi_check != '' - run: | - src/build-scripts/ci-abicheck.bash ./build abi_standard/build \ - liboslexec liboslcomp liboslquery liboslnoise - - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 - if: failure() - with: - name: osl-${{github.job}}-${{matrix.nametag}} - path: | - build/cmake-save - build/compat_reports - build/*.cmake - build/CMake* - build/testsuite/*/*.* - - - ubuntu: - name: "Ubuntu ${{matrix.desc}}" - strategy: - fail-fast: false - matrix: - include: - desc: Debug gcc7/C++17 llvm11 py3.8 oiio2.5 exr3.1 sse4 nametag: linux-debug-gcc7-llvm11 runner: ubuntu-20.04 @@ -571,137 +480,69 @@ jobs: USE_PYTHON=0 QT_VERSION=0 - runs-on: ${{matrix.runner}} - env: - CXX: ${{matrix.cxx_compiler}} - CC: ${{matrix.cc_compiler}} - CMAKE_CXX_STANDARD: ${{matrix.cxx_std}} - FMT_VERSION: ${{matrix.fmt_ver}} - OPENCOLORIO_VERSION: ${{matrix.opencolorio_ver}} - OPENEXR_VERSION: ${{matrix.openexr_ver}} - OPENIMAGEIO_VERSION: ${{matrix.openimageio_ver}} - PYBIND11_VERSION: ${{matrix.pybind11_ver}} - PYTHON_VERSION: ${{matrix.python_ver}} - USE_BATCHED: ${{matrix.batched}} - USE_SIMD: ${{matrix.simd}} - steps: - # We would like to use harden-runner, but it flags too many false - # positives, every time we download a dependency. We should use it only - # on CI runs where we are producing artifacts that users might rely on. - # - name: Harden Runner - # uses: step-security/harden-runner@248ae51c2e8cc9622ecf50685c8bf7150c6e8813 # v1.4.3 - # with: - # egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 - - name: Prepare ccache timestamp - id: ccache_cache_keys - run: echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`" - - name: ccache - id: ccache - uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4 - with: - path: /tmp/ccache - key: ${{github.job}}-${{matrix.nametag}}-${{steps.ccache_cache_keys.outputs.date}} - restore-keys: ${{github.job}}-${{matrix.nametag}}- - - name: Build setup - run: | - ${{matrix.setenvs}} - src/build-scripts/ci-startup.bash - - name: Dependencies - run: | - ${{matrix.depcmds}} - src/build-scripts/gh-installdeps.bash - - name: Build - run: src/build-scripts/ci-build.bash - - name: Testsuite - if: matrix.skip_tests != '1' - run: src/build-scripts/ci-test.bash - - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 - if: failure() - with: - name: osl-${{github.job}}-${{matrix.nametag}} - path: | - build/cmake-save - build/*.cmake - build/CMake* - build/testsuite/*/*.* - ${{ matrix.extra_artifacts }} - macos: - name: "${{matrix.runner}} C++${{matrix.cxx_std}} py${{matrix.python_ver}} ${{matrix.desc}}" + name: "${{matrix.desc}}" + uses: ./.github/workflows/build-steps.yml + with: + nametag: ${{ matrix.nametag || 'unnamed!' }} + runner: ${{ matrix.runner }} + container: ${{ matrix.container }} + cc_compiler: ${{ matrix.cc_compiler || 'clang' }} + cxx_compiler: ${{ matrix.cxx_compiler || 'clang++' }} + cxx_std: ${{ matrix.cxx_std || '17' }} + batched: ${{ matrix.batched }} + build_type: ${{ matrix.build_type || 'Release' }} + depcmds: ${{ matrix.depcmds }} + extra_artifacts: ${{ matrix.extra_artifacts }} + fmt_ver: ${{ matrix.fmt_ver }} + opencolorio_ver: ${{ matrix.opencolorio_ver }} + openexr_ver: ${{ matrix.openexr_ver }} + openimageio_ver: ${{ matrix.openimageio_ver }} + pybind11_ver: ${{ matrix.pybind11_ver }} + python_ver: ${{ matrix.python_ver }} + setenvs: ${{ matrix.setenvs }} + simd: ${{ matrix.simd }} + skip_build: ${{ matrix.skip_build }} + skip_tests: ${{ matrix.skip_tests }} + abi_check: ${{ matrix.abi_check }} + build_docs: ${{ matrix.build_docs }} + generator: ${{ matrix.generator }} + ctest_args: ${{ matrix.ctest_args }} + ctest_test_timeout: ${{ matrix.ctest_test_timeout || '800' }} + coverage: ${{ matrix.coverage || 0 }} + sonar: ${{ matrix.sonar || 0 }} strategy: fail-fast: false matrix: include: - - desc: MacOS-13 llvm17 + - desc: MacOS-13-Intel llvm17 runner: macos-13 - nametag: macos13-p311 + nametag: macos13-p313 cc_compiler: /usr/local/opt/llvm/bin/clang cxx_compiler: /usr/local/opt/llvm/bin/clang++ cxx_std: 17 - openimageio_ver: release - python_ver: "3.11" + python_ver: "3.13" aclang: 14 setenvs: export DO_BREW_UPDATE=1 CTEST_TEST_TIMEOUT=120 + EXTRA_BREW_PACKAGES="openimageio" - desc: MacOS-14-ARM llvm17 runner: macos-14 - nametag: macos14-arm-p311 + nametag: macos14-arm-p313 cc_compiler: clang cxx_compiler: clang++ - Xcc_compiler: /usr/local/opt/llvm/bin/clang - Xcxx_compiler: /usr/local/opt/llvm/bin/clang++ cxx_std: 17 - openimageio_ver: main - python_ver: "3.11" + python_ver: "3.13" aclang: 15 setenvs: export DO_BREW_UPDATE=1 + EXTRA_BREW_PACKAGES="openimageio" + - desc: MacOS-15-ARM aclang16/C++17/py3.13 + runner: macos-15 + nametag: macos15-arm-py313 + cc_compiler: clang + cxx_compiler: clang++ + cxx_std: 17 + python_ver: "3.13" + openimageio_ver: main + - runs-on: ${{matrix.runner}} - env: - CXX: ${{matrix.cxx_compiler}} - CC: ${{matrix.cc_compiler}} - CMAKE_CXX_STANDARD: ${{matrix.cxx_std}} - PYTHON_VERSION: ${{matrix.python_ver}} - OPENIMAGEIO_VERSION: ${{matrix.openimageio_ver}} - steps: - - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 - - name: Prepare ccache timestamp - id: ccache_cache_keys - run: echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`" - - name: ccache - id: ccache - uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4 - with: - path: /Users/runner/.ccache - key: ${{github.job}}-${{matrix.nametag}}-${{steps.ccache_cache_keys.outputs.date}} - restore-keys: ${{github.job}}-${{matrix.nametag}}- - - name: Build setup - run: | - ${{matrix.setenvs}} - src/build-scripts/ci-startup.bash - - name: Dependencies - run: | - source src/build-scripts/install_homebrew_deps.bash - if [[ "$OPENIMAGEIO_VERSION" != "" ]] ; then \ - OPENIMAGEIO_CMAKE_FLAGS="-DOIIO_BUILD_TESTS=0 -DUSE_OPENGL=0 -DCMAKE_UNITY_BUILD=ON" ; \ - source src/build-scripts/build_openimageio.bash ; \ - else \ - brew install --display-times -q openimageio ; \ - PYTHONPATH=$PYTHONPATH:/usr/local/python${PYTHON_VERSION}/site-packages ; \ - fi - src/build-scripts/save-env.bash - - name: Build - run: | - src/build-scripts/ci-build.bash - - name: Testsuite - run: src/build-scripts/ci-test.bash - - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 - if: failure() - with: - name: osl-${{github.job}}-${{matrix.nametag}} - path: | - build/cmake-save - build/*.cmake - build/CMake* - build/testsuite/*/*.* diff --git a/src/build-scripts/ci-startup.bash b/src/build-scripts/ci-startup.bash index 860c7a747..5507f8c0f 100755 --- a/src/build-scripts/ci-startup.bash +++ b/src/build-scripts/ci-startup.bash @@ -11,11 +11,8 @@ # Environment variables we always need export PATH=/usr/local/bin/_ccache:/usr/lib/ccache:$PATH export USE_CCACHE=${USE_CCACHE:=1} -export CCACHE_CPP2=1 -export CCACHE_DIR=/tmp/ccache -if [[ "${RUNNER_OS}" == "macOS" ]] ; then - export CCACHE_DIR=$HOME/.ccache -fi +export CCACHE_CPP2= +export CCACHE_DIR=$HOME/.ccache mkdir -p $CCACHE_DIR export OSL_ROOT=$PWD/dist @@ -33,12 +30,13 @@ export PYTHONPATH=/usr/local/lib64/python${PYTHON_VERSION}/site-packages:$PYTHON export PYTHONPATH=$OSL_ROOT/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH export BUILD_MISSING_DEPS=${BUILD_MISSING_DEPS:=1} export COMPILER=${COMPILER:=gcc} +export CC=${CC:=gcc} export CXX=${CXX:=g++} export OSL_CI=true export USE_NINJA=${USE_NINJA:=1} export CMAKE_GENERATOR=${CMAKE_GENERATOR:=Ninja} export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release} -export CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD:=11} +export CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD:=17} export LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=$HOME/ext} export CMAKE_PREFIX_PATH=${LOCAL_DEPS_DIR}/dist:${CMAKE_PREFIX_PATH} @@ -51,6 +49,10 @@ export TESTSUITE_CLEANUP_ON_SUCCESS=${TESTSUITE_CLEANUP_ON_SUCCESS:=1} # For CI, default to building missing dependencies automatically export OpenImageIO_BUILD_MISSING_DEPS=${OpenImageIO_BUILD_MISSING_DEPS:=all} +# Sonar +export BUILD_WRAPPER_OUT_DIR="${PWD}/bw_output" +export BW_OUTPUT_DIR="${PWD}/bw_output" + # Parallel builds if [[ `uname -s` == "Linux" ]] ; then echo "procs: " `nproc` @@ -84,8 +86,10 @@ ls env | sort if [[ `uname -s` == "Linux" ]] ; then + echo "nprocs: " `nproc` head -40 /proc/cpuinfo -elif [[ ${RUNNER_OS} == "macOS" ]] ; then +elif [[ "${RUNNER_OS}" == "macOS" ]] ; then + echo "nprocs: " `sysctl -n hw.ncpu` sysctl machdep.cpu.features fi diff --git a/src/build-scripts/gh-installdeps.bash b/src/build-scripts/gh-installdeps.bash index 3ba0428c5..bd517ad6e 100755 --- a/src/build-scripts/gh-installdeps.bash +++ b/src/build-scripts/gh-installdeps.bash @@ -190,7 +190,7 @@ if [[ "$OPENIMAGEIO_VERSION" != "" ]] ; then export ENABLE_BMP=0 ENABLE_cineon=0 ENABLE_DDS=0 ENABLE_DPX=0 ENABLE_FITS=0 export ENABLE_ICO=0 ENABLE_iff=0 ENABLE_jpeg2000=0 ENABLE_PNM=0 ENABLE_PSD=0 export ENABLE_RLA=0 ENABLE_SGI=0 ENABLE_SOCKET=0 ENABLE_SOFTIMAGE=0 - export ENABLE_TARGA=0 ENABLE_WEBP=0 + export ENABLE_TARGA=0 ENABLE_WEBP=0 ENABLE_jpegxl=0 ENABLE_libuhdr=0 # We don't need to run OIIO's tests export OPENIMAGEIO_CMAKE_FLAGS+=" -DOIIO_BUILD_TESTING=OFF -DOIIO_BUILD_TESTS=0" # Don't let warnings in OIIO break OSL's CI run diff --git a/src/build-scripts/install_homebrew_deps.bash b/src/build-scripts/install_homebrew_deps.bash index 46b8f94b8..ae4ec003d 100755 --- a/src/build-scripts/install_homebrew_deps.bash +++ b/src/build-scripts/install_homebrew_deps.bash @@ -48,6 +48,9 @@ brew install --display-times -q llvm${LLVMBREWVER} if [[ "${USE_QT}" != "0" ]] ; then brew install --display-times -q qt${QT_VERSION} fi +if [[ "${EXTRA_BREW_PACKAGES}" != "" ]] ; then + brew install --display-times -q ${EXTRA_BREW_PACKAGES} +fi echo "" echo "After brew installs:" @@ -61,6 +64,8 @@ pip${PYTHON_VERSION} install numpy || true export PATH=${HOMEBREW_PREFIX}/opt/qt5/bin:$PATH export PATH=${HOMEBREW_PREFIX}/opt/python/libexec/bin:$PATH export PYTHONPATH=${HOMEBREW_PREFIX}/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH +echo "PYTHONPATH=$PYTHONPATH" +ls ${HOMEBREW_PREFIX}/lib/python${PYTHON_VERSION} # export PATH=${HOMEBREW_PREFIX}/opt/llvm${LLVMBREWVER}/bin:$PATH export LLVM_DIRECTORY=${HOMEBREW_PREFIX}/opt/llvm${LLVMBREWVER} export LLVM_ROOT=${HOMEBREW_PREFIX}/opt/llvm${LLVMBREWVER}