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