1# Copyright (c) 2021-2024 Intel Corporation 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15name: oneTBB CI 16 17on: 18 push: 19 branches: [master] 20 21 pull_request: 22 branches: [master] 23 types: 24 - opened 25 - synchronize 26 - reopened 27 28permissions: read-all 29 30env: 31 BUILD_CONCURRENCY: 2 32 MACOS_BUILD_CONCURRENCY: 3 33 TEST_TIMEOUT: 180 34 35jobs: 36 codespell: 37 runs-on: [ubuntu-20.04] 38 timeout-minutes: 10 39 steps: 40 - uses: actions/checkout@v2 41 - name: Run scan 42 run: | 43 sudo apt update && sudo apt install -y codespell 44 ${GITHUB_WORKSPACE}/.github/scripts/codespell.sh `pwd` 45 46 examples_clang-format: 47 runs-on: [ubuntu-20.04] 48 timeout-minutes: 10 49 steps: 50 - uses: actions/checkout@v2 51 - name: Run scan 52 run: | 53 command -v clang-format-10 54 cp -r examples examples_formatted 55 find examples_formatted -regex '.*\.\(cpp\|hpp\)' -exec clang-format-10 -style=file -i {} \; 56 diff -r examples examples_formatted 57 58 documentation: 59 needs: [codespell] 60 env: 61 BUILD_TYPE: oss 62 runs-on: [ubuntu-22.04] 63 timeout-minutes: 10 64 steps: 65 - uses: actions/checkout@v2 66 - name: Install prerequisites 67 run: | 68 pip3 install -U Jinja2 69 pip3 install git+https://github.com/executablebooks/sphinx-book-theme.git 70 pip3 install sphinx-tabs 71 echo GITHUB_SHA_SHORT=${GITHUB_SHA::8} >> $GITHUB_ENV 72 mkdir html 73 - name: Build documentation 74 run: | 75 export BUILD_TYPE=${BUILD_TYPE} && sphinx-build doc html 76 tar -czvf html.tar.gz html/ 77 - name: Save docs 78 uses: actions/upload-artifact@v2.2.1 79 with: 80 name: oneTBB-html-docs-${{ env.GITHUB_SHA_SHORT }} 81 path: html.tar.gz 82 83 pages: 84 if: ${{ github.ref == 'refs/heads/master' }} 85 runs-on: ubuntu-latest 86 needs: [documentation] 87 steps: 88 - name: Checkout gh-pages 89 uses: actions/checkout@v2 90 with: 91 ref: gh-pages 92 path: gh-pages 93 - name: Set env 94 run: echo GITHUB_SHA_SHORT=${GITHUB_SHA::8} >> $GITHUB_ENV 95 - name: Download documetation 96 uses: actions/download-artifact@v2 97 with: 98 name: oneTBB-html-docs-${{ env.GITHUB_SHA_SHORT }} 99 - name: Publish to github pages 100 run: | 101 tar -xvf html.tar.gz 102 cd gh-pages 103 rm -rf * 104 touch .nojekyll # https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/ 105 cp -r ../html/* . 106 git config user.name github-actions 107 git config user.email [email protected] 108 git add . 109 git commit --reset-author --amend -m "Update from GitHub Actions" 110 git push --force origin gh-pages 111 112 copyright_check: 113 if: ${{ github.ref != 'refs/heads/master' }} 114 runs-on: [ubuntu-20.04] 115 steps: 116 - uses: actions/checkout@v2 117 with: 118 fetch-depth: 0 119 - name: Run check 120 run: | 121 sed -i \ 122 -e "/Copyright (c) .* Intel Corporation/s/ \([0-9]\+\)[-0-9]*/ \\1-$(date +%Y)/" \ 123 -e "/Copyright (c) .* Intel Corporation/s/$(date +%Y)-$(date +%Y)/$(date +%Y)/" \ 124 $(git diff --diff-filter=d --name-only ${{ github.event.pull_request.base.sha }}) 125 git checkout -- third-party-programs.txt 126 git diff > years.diff 127 if [[ -s years.diff ]]; then 128 echo "Wrong copyright years" 129 cat years.diff 130 exit 1 131 fi 132 python_module_test_ubuntu_latest: 133 runs-on: [ubuntu-latest] 134 timeout-minutes: 15 135 steps: 136 - uses: actions/checkout@v2 137 - name: Run testing 138 run: | 139 mkdir build && cd build 140 cmake -DTBB4PY_BUILD=ON -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc .. 141 make VERBOSE=1 -j${BUILD_CONCURRENCY} python_build 142 ctest -R python_test --output-on-failure --timeout ${TEST_TIMEOUT} 143 144 linux-testing: 145 name: ${{ matrix.os }}_${{ matrix.cxx_compiler }}_cxx${{ matrix.std }}_${{ matrix.build_type }}_preview=${{ matrix.preview }} 146 runs-on: ['${{ matrix.os }}'] 147 timeout-minutes: 45 148 strategy: 149 fail-fast: false 150 matrix: 151 include: 152 - os: ubuntu-latest 153 c_compiler: gcc 154 cxx_compiler: g++ 155 std: 14 156 build_type: relwithdebinfo 157 preview: 'OFF' 158 - os: ubuntu-20.04 159 c_compiler: gcc 160 cxx_compiler: g++ 161 std: 17 162 build_type: release 163 preview: 'ON' 164 - os: ubuntu-20.04 165 c_compiler: gcc-10 166 cxx_compiler: g++-10 167 std: 20 168 build_type: debug 169 preview: 'ON' 170 steps: 171 - uses: actions/checkout@v2 172 - name: Run testing 173 shell: bash 174 run: | 175 set -x 176 mkdir build && cd build 177 cmake -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ 178 -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DTBB_CPF=${{ matrix.preview }} .. 179 make VERBOSE=1 -j${BUILD_CONCURRENCY} 180 ctest --timeout ${TEST_TIMEOUT} --output-on-failure 181 182 macos-testing: 183 name: ${{ matrix.os }}_${{ matrix.cxx_compiler }}_cxx${{ matrix.std }}_${{ matrix.build_type }}_preview=${{ matrix.preview }} 184 runs-on: ['${{ matrix.os }}'] 185 timeout-minutes: 45 186 strategy: 187 fail-fast: false 188 matrix: 189 include: 190 - os: macos-12 191 c_compiler: clang 192 cxx_compiler: clang++ 193 std: 14 194 build_type: relwithdebinfo 195 preview: 'ON' 196 steps: 197 - uses: actions/checkout@v2 198 - name: Run testing 199 shell: bash 200 run: | 201 set -x 202 mkdir build && cd build 203 cmake -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ 204 -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DTBB_CPF=${{ matrix.preview }} .. 205 make VERBOSE=1 -j${MACOS_BUILD_CONCURRENCY} 206 ctest --timeout ${TEST_TIMEOUT} --output-on-failure 207 208 windows-testing: 209 name: ${{ matrix.job_name }} 210 runs-on: ['${{ matrix.os }}'] 211 timeout-minutes: 45 212 strategy: 213 fail-fast: false 214 matrix: 215 include: 216 - os: windows-2019 217 generator: Visual Studio 16 2019 218 c_compiler: cl 219 cxx_compiler: cl 220 std: 14 221 build_type: relwithdebinfo 222 preview: 'ON' 223 job_name: windows_cl2019_cxx14_relwithdebinfo_preview=ON 224 - os: windows-2022 225 generator: Visual Studio 17 2022 226 c_compiler: cl 227 cxx_compiler: cl 228 std: 17 229 build_type: relwithdebinfo 230 preview: 'OFF' 231 job_name: windows_cl2022_cxx17_relwithdebinfo_preview=OFF 232 steps: 233 - uses: actions/checkout@v2 234 - name: Run testing 235 run: | 236 mkdir build 237 cd build 238 cmake -G "${{ matrix.generator }}" -A x64 -DCMAKE_CXX_STANDARD=${{ matrix.std }} ` 239 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} ` 240 -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DTBB_CPF=${{ matrix.preview }} .. 241 cmake --build . --config ${{ matrix.build_type }} -j -v 242 ctest -C ${{ matrix.build_type }} --timeout ${env:TEST_TIMEOUT} --output-on-failure 243 244 linux-examples-testing: 245 name: examples_${{ matrix.os }}_${{ matrix.cxx_compiler }}_cxx${{ matrix.std }}_${{ matrix.build_type }}_preview=${{ matrix.preview }} 246 runs-on: ['${{ matrix.os }}'] 247 timeout-minutes: 20 248 strategy: 249 fail-fast: false 250 matrix: 251 include: 252 - os: ubuntu-latest 253 c_compiler: gcc 254 cxx_compiler: g++ 255 std: 14 256 build_type: relwithdebinfo 257 preview: 'OFF' 258 - os: ubuntu-20.04 259 c_compiler: gcc 260 cxx_compiler: g++ 261 std: 17 262 build_type: release 263 preview: 'ON' 264 - os: ubuntu-20.04 265 c_compiler: gcc-10 266 cxx_compiler: g++-10 267 std: 20 268 build_type: debug 269 preview: 'ON' 270 steps: 271 - uses: actions/checkout@v2 272 - name: Run testing 273 shell: bash 274 run: | 275 set -x 276 mkdir build && cd build 277 cmake -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ 278 -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ 279 -DTBB_CPF=${{ matrix.preview }} -DTBB_TEST=OFF -DTBB_EXAMPLES=ON .. 280 cmake --build . -v --target light_test_examples 281 282 macos-examples-testing: 283 name: examples_${{ matrix.os }}_${{ matrix.cxx_compiler }}_cxx${{ matrix.std }}_${{ matrix.build_type }}_preview=${{ matrix.preview }} 284 runs-on: ['${{ matrix.os }}'] 285 timeout-minutes: 20 286 strategy: 287 fail-fast: false 288 matrix: 289 include: 290 - os: macos-12 291 c_compiler: clang 292 cxx_compiler: clang++ 293 std: 14 294 build_type: relwithdebinfo 295 preview: 'ON' 296 steps: 297 - uses: actions/checkout@v2 298 - name: Run testing 299 shell: bash 300 run: | 301 set -x 302 mkdir build && cd build 303 cmake -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ 304 -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ 305 -DTBB_CPF=${{ matrix.preview }} -DTBB_TEST=OFF -DTBB_EXAMPLES=ON .. 306 cmake --build . -v --target light_test_examples 307 308 windows-examples-testing: 309 name: ${{ matrix.job_name }} 310 runs-on: ['${{ matrix.os }}'] 311 timeout-minutes: 20 312 strategy: 313 fail-fast: false 314 matrix: 315 include: 316 - os: windows-2019 317 generator: Visual Studio 16 2019 318 c_compiler: cl 319 cxx_compiler: cl 320 std: 14 321 build_type: relwithdebinfo 322 preview: 'ON' 323 job_name: examples_windows_cl2019_cxx14_relwithdebinfo_preview=ON 324 - os: windows-2022 325 generator: Visual Studio 17 2022 326 c_compiler: cl 327 cxx_compiler: cl 328 std: 17 329 build_type: relwithdebinfo 330 preview: 'OFF' 331 job_name: examples_windows_cl2022_cxx17_relwithdebinfo_preview=OFF 332 steps: 333 - uses: actions/checkout@v2 334 - name: Run testing 335 run: | 336 mkdir build 337 cd build 338 cmake -G "${{ matrix.generator }}" -A x64 -DCMAKE_CXX_STANDARD=${{ matrix.std }} ` 339 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} ` 340 -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DTBB_CPF=${{ matrix.preview }} -DTBB_TEST=OFF -DTBB_EXAMPLES=ON .. 341 cmake --build . -v --target light_test_examples 342