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