|
| 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 | + cc_compiler: |
| 22 | + type: string |
| 23 | + cxx_compiler: |
| 24 | + type: string |
| 25 | + cxx_std: |
| 26 | + type: string |
| 27 | + build_type: |
| 28 | + type: string |
| 29 | + depcmds: |
| 30 | + type: string |
| 31 | + extra_artifacts: |
| 32 | + type: string |
| 33 | + fmt_ver: |
| 34 | + type: string |
| 35 | + opencolorio_ver: |
| 36 | + type: string |
| 37 | + openexr_ver: |
| 38 | + type: string |
| 39 | + pybind11_ver: |
| 40 | + type: string |
| 41 | + python_ver: |
| 42 | + type: string |
| 43 | + setenvs: |
| 44 | + type: string |
| 45 | + simd: |
| 46 | + type: string |
| 47 | + skip_build: |
| 48 | + type: string |
| 49 | + skip_tests: |
| 50 | + type: string |
| 51 | + abi_check: |
| 52 | + type: string |
| 53 | + build_docs: |
| 54 | + type: string |
| 55 | + generator: |
| 56 | + type: string |
| 57 | + ctest_args: |
| 58 | + type: string |
| 59 | + ctest_test_timeout: |
| 60 | + type: string |
| 61 | + coverage: |
| 62 | + type: string |
| 63 | + sonar: |
| 64 | + type: string |
| 65 | + nametag: |
| 66 | + type: string |
| 67 | + |
| 68 | +permissions: read-all |
| 69 | + |
| 70 | + |
| 71 | +jobs: |
| 72 | + |
| 73 | + steps: |
| 74 | + name: "${{inputs.cxx_compiler}} c++${{inputs.cxx_std}} py${{inputs.python_ver}}" |
| 75 | + runs-on: ${{ inputs.runner }} |
| 76 | + container: |
| 77 | + image: ${{ inputs.container }} |
| 78 | + |
| 79 | + env: |
| 80 | + CXX: ${{inputs.cxx_compiler}} |
| 81 | + CC: ${{inputs.cc_compiler}} |
| 82 | + CMAKE_BUILD_TYPE: ${{inputs.build_type}} |
| 83 | + CMAKE_CXX_STANDARD: ${{inputs.cxx_std}} |
| 84 | + CMAKE_GENERATOR: ${{inputs.generator}} |
| 85 | + CTEST_ARGS: ${{inputs.ctest_args}} |
| 86 | + CTEST_TEST_TIMEOUT: ${{inputs.ctest_test_timeout}} |
| 87 | + USE_SIMD: ${{inputs.simd}} |
| 88 | + FMT_VERSION: ${{inputs.fmt_ver}} |
| 89 | + OPENCOLORIO_VERSION: ${{inputs.opencolorio_ver}} |
| 90 | + OPENEXR_VERSION: ${{inputs.openexr_ver}} |
| 91 | + PYBIND11_VERSION: ${{inputs.pybind11_ver}} |
| 92 | + PYTHON_VERSION: ${{inputs.python_ver}} |
| 93 | + ABI_CHECK: ${{inputs.abi_check}} |
| 94 | + ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 |
| 95 | + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true |
| 96 | + |
| 97 | + steps: |
| 98 | + # - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 |
| 99 | + # # Note: can't upgrade to actions/checkout 4.0 because it needs newer |
| 100 | + # # glibc than these containers have. |
| 101 | + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 102 | + with: |
| 103 | + fetch-depth: '0' |
| 104 | + - name: Prepare ccache timestamp |
| 105 | + id: ccache_cache_keys |
| 106 | + shell: bash |
| 107 | + run: echo "date=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" >> $GITHUB_OUTPUT |
| 108 | + - name: ccache |
| 109 | + id: ccache |
| 110 | + uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3 |
| 111 | + # Note: can't upgrade to actions/cache 4.0 because it needs newer |
| 112 | + # glibc than these containers have. |
| 113 | + with: |
| 114 | + path: ./ccache |
| 115 | + key: ${{github.job}}-${{inputs.nametag}}-${{steps.ccache_cache_keys.outputs.date}} |
| 116 | + restore-keys: ${{github.job}}- |
| 117 | + save-always: true |
| 118 | + - name: Setup Nuget.exe (Windows only) |
| 119 | + if: runner.os == 'Windows' |
| 120 | + uses: nuget/setup-nuget@a21f25cd3998bf370fde17e3f1b4c12c175172f9 # v2.0.0 |
| 121 | + - name: Build setup |
| 122 | + shell: bash |
| 123 | + run: | |
| 124 | + ${{inputs.setenvs}} |
| 125 | + src/build-scripts/ci-startup.bash |
| 126 | + - name: Dependencies |
| 127 | + shell: bash |
| 128 | + run: | |
| 129 | + ${{inputs.depcmds}} |
| 130 | + if [[ "$RUNNER_OS" == "Linux" ]]; then |
| 131 | + src/build-scripts/gh-installdeps.bash |
| 132 | + elif [[ "$RUNNER_OS" == "macOS" ]]; then |
| 133 | + src/build-scripts/install_homebrew_deps.bash |
| 134 | + elif [[ "$RUNNER_OS" == "Windows" ]]; then |
| 135 | + src/build-scripts/gh-win-installdeps.bash |
| 136 | + fi |
| 137 | + - name: Install sonar-scanner and build-wrapper |
| 138 | + if: inputs.sonar == '1' |
| 139 | + uses: sonarsource/sonarcloud-github-c-cpp@e4882e1621ad2fb48dddfa48287411bed34789b1 # v2.0.2 |
| 140 | + - name: Build |
| 141 | + if: inputs.skip_build != '1' |
| 142 | + shell: bash |
| 143 | + run: src/build-scripts/ci-build.bash |
| 144 | + - name: Testsuite |
| 145 | + if: inputs.skip_tests != '1' |
| 146 | + shell: bash |
| 147 | + run: src/build-scripts/ci-test.bash |
| 148 | + - name: Code coverage |
| 149 | + if: inputs.coverage == '1' |
| 150 | + run: src/build-scripts/ci-coverage.bash |
| 151 | + - name: Sonar-scanner |
| 152 | + if: inputs.sonar == 1 |
| 153 | + env: |
| 154 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 155 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 156 | + run: | |
| 157 | + which sonar-scanner |
| 158 | + ls -l /__w/OpenImageIO/OpenImageIO/bw_output |
| 159 | + echo "BUILD_OUTPUT_DIR is " "${{ env.BUILD_WRAPPER_OUT_DIR }}" |
| 160 | + find . -name "*.gcov" -print |
| 161 | + # sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" |
| 162 | + 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" |
| 163 | + # Consult https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-cli/ for more information and options |
| 164 | + - name: Check out ABI standard |
| 165 | + if: inputs.abi_check != '' |
| 166 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 167 | + with: |
| 168 | + ref: ${{inputs.abi_check}} |
| 169 | + path: abi_standard |
| 170 | + - name: Build ABI standard |
| 171 | + if: inputs.abi_check != '' |
| 172 | + shell: bash |
| 173 | + run: | |
| 174 | + mkdir -p abi_standard/build |
| 175 | + pushd abi_standard |
| 176 | + src/build-scripts/ci-build.bash |
| 177 | + popd |
| 178 | + - name: Check ABI |
| 179 | + if: inputs.abi_check != '' |
| 180 | + shell: bash |
| 181 | + run: | |
| 182 | + src/build-scripts/ci-abicheck.bash ./build abi_standard/build libOpenImageIO libOpenImageIO_Util |
| 183 | + - name: Build Docs |
| 184 | + if: inputs.build_docs == '1' |
| 185 | + shell: bash |
| 186 | + run: | |
| 187 | + cd src/doc |
| 188 | + time make doxygen |
| 189 | + time make sphinx |
| 190 | + - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 |
| 191 | + # Note: versions of upload-artifact >= 4.0 can't run on the ASWF |
| 192 | + # containers because they need a newer glibc than they have. |
| 193 | + if: ${{ failure() || inputs.build_docs == '1'}} |
| 194 | + with: |
| 195 | + name: oiio-${{github.job}}-${{inputs.nametag}} |
| 196 | + path: | |
| 197 | + build/cmake-save |
| 198 | + build/compat_reports |
| 199 | + build/sphinx |
| 200 | + build/testsuite/*/*.* |
| 201 | + !build/testsuite/oiio-images |
| 202 | + !build/testsuite/openexr-images |
| 203 | + !build/testsuite/fits-images |
| 204 | + !build/testsuite/j2kp4files_v1_5 |
| 205 | + ${{ inputs.extra_artifacts }} |
0 commit comments