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