|
3 | 3 | branches:
|
4 | 4 | - master
|
5 | 5 |
|
6 |
| -env: |
7 |
| - BUILD_TYPE: Release |
8 |
| - |
9 | 6 | jobs:
|
10 | 7 | build:
|
| 8 | + strategy: |
| 9 | + matrix: |
| 10 | + compiler: [gcc, clang] |
| 11 | + build_type: [Debug, Release] |
| 12 | + lto_config: |
| 13 | + - lto: false |
| 14 | + full_lto: false |
| 15 | + - lto: true |
| 16 | + full_lto: false |
| 17 | + - lto: true |
| 18 | + full_lto: true |
| 19 | + exclude: |
| 20 | + # Don't try to build Debug with LTO enabled |
| 21 | + - build_type: Debug |
| 22 | + lto_config: |
| 23 | + lto: true |
| 24 | + # GCC doesn't have a thin LTO mode |
| 25 | + - compiler: gcc |
| 26 | + build_type: Release |
| 27 | + lto_config: |
| 28 | + lto: true |
| 29 | + full_lto: false |
| 30 | + |
| 31 | + env: |
| 32 | + CC: ${{ matrix.compiler }} |
| 33 | + CXX: ${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }} |
| 34 | + LTO_CONFIG: ${{ matrix.build_type == 'Release' && format('-DNO_STF_LTO={0}', !matrix.lto_config.lto) || '' }} |
| 35 | + CLANG_FULL_LTO_CONFIG: ${{ (matrix.compiler == 'clang' && matrix.build_type == 'Release') && format('-DFULL_LTO={0}', matrix.lto_config.full_lto) || '' }} |
| 36 | + |
11 | 37 | runs-on: ubuntu-latest
|
12 | 38 |
|
13 | 39 | steps:
|
14 |
| - - uses: actions/checkout@v2 |
| 40 | + - name: Get number of CPU cores |
| 41 | + uses: SimenB/github-actions-cpu-cores@v2 |
| 42 | + id: cpu-cores |
| 43 | + |
| 44 | + - uses: actions/checkout@v4 |
15 | 45 |
|
16 | 46 | - name: Install Dependencies
|
17 | 47 | run: |
|
18 | 48 | sudo apt-get update
|
19 |
| - sudo apt-get -y install libboost-dev |
| 49 | + sudo apt-get -y install libboost-dev cython3 |
| 50 | +
|
| 51 | + - name: Install Clang |
| 52 | + run: | |
| 53 | + sudo apt-get -y install clang lld llvm |
| 54 | + if: ${{ matrix.compiler == 'clang' }} |
20 | 55 |
|
21 | 56 | - name: Create Build Directory
|
22 | 57 | run: cmake -E make_directory ${{runner.workspace}}/build
|
23 | 58 |
|
24 | 59 | - name: Configure CMAKE
|
25 | 60 | working-directory: ${{runner.workspace}}/build
|
26 |
| - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE |
| 61 | + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_STF_PYTHON_LIB=ON $LTO_CONFIG $CLANG_FULL_LTO_CONFIG |
27 | 62 |
|
28 | 63 | - name: Build
|
29 | 64 | working-directory: ${{runner.workspace}}/build
|
30 |
| - run: cmake --build . --config $BUILD_TYPE |
| 65 | + run: cmake --build . --config ${{ matrix.build_type }} -j ${{ steps.cpu-cores.outputs.count }} |
31 | 66 |
|
32 | 67 | - name: Regress
|
33 | 68 | working-directory: ${{runner.workspace}}/build
|
34 |
| - run: cmake --build . --config $BUILD_TYPE --target regress |
| 69 | + run: cmake --build . --config ${{ matrix.build_type }} -j ${{ steps.cpu-cores.outputs.count }} --target regress |
0 commit comments