cmake-build.yml raw
1 # This workflow is for CMake-based build/test running on multiple platforms.
2 name: cmake build
3
4 on: [push, pull_request]
5
6 jobs:
7 build:
8 name: ${{ matrix.os }} ${{ matrix.c_compiler }} thr:${{ matrix.enable_threads }} rwlock:${{ matrix.enable_rwlock }} redir:${{ matrix.redirect_malloc }} dll:${{ matrix.shared_libs }} cpp:${{ matrix.enable_cplusplus }}
9 runs-on: ${{ matrix.os }}
10 timeout-minutes: 6
11
12 strategy:
13 # Deliver the feedback for all matrix combinations.
14 fail-fast: false
15
16 matrix:
17 os: [ macos-latest, ubuntu-latest, windows-latest ]
18 c_compiler: [ cl, clang, gcc ]
19 cxx_compiler: [ cl, clang++, g++ ]
20 enable_cplusplus: [ off, on ]
21 build_type: [ Release ]
22 disable_gc_debug: [ off ]
23 gc_assertions: [ on ]
24 large_config: [ on ]
25 enable_threads: [ off, on ]
26 enable_rwlock: [ off, on ]
27 redirect_malloc: [ off, on ]
28 shared_libs: [ off, on ]
29 exclude:
30 - os: macos-latest
31 c_compiler: cl
32 - os: macos-latest
33 c_compiler: gcc
34 - os: ubuntu-latest
35 c_compiler: cl
36 - enable_threads: off
37 enable_rwlock: on
38 - c_compiler: cl
39 cxx_compiler: clang++
40 - c_compiler: cl
41 cxx_compiler: g++
42 - c_compiler: clang
43 cxx_compiler: cl
44 - c_compiler: clang
45 cxx_compiler: g++
46 - c_compiler: gcc
47 cxx_compiler: cl
48 - c_compiler: gcc
49 cxx_compiler: clang++
50 - os: macos-latest
51 enable_cplusplus: off
52 - os: ubuntu-latest
53 enable_cplusplus: off
54 - os: windows-latest
55 c_compiler: cl
56 enable_cplusplus: off
57 - os: windows-latest # TODO: replacement operator cannot be inline
58 c_compiler: clang
59 enable_cplusplus: on
60 - os: windows-latest
61 c_compiler: gcc
62 enable_cplusplus: off
63 - os: windows-latest # TODO: support dependency on libatomic_ops
64 c_compiler: cl
65 enable_threads: on
66 include:
67 - os: windows-latest
68 c_compiler: gcc
69 cmake_generator_opt: '-G "Unix Makefiles"'
70 - os: windows-latest
71 c_compiler: clang
72 cmake_generator_opt: '-G "Unix Makefiles"'
73
74 steps:
75 - uses: actions/checkout@v4
76
77 - name: Set reusable strings
78 # Turn repeated input strings into step outputs.
79 id: strings
80 shell: bash
81 run: |
82 echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
83
84 - name: Configure CMake
85 # Configure CMake in a 'build' subdirectory.
86 run: >
87 cmake -B ${{ steps.strings.outputs.build-output-dir }}
88 ${{ matrix.cmake_generator_opt }}
89 -DBUILD_SHARED_LIBS=${{ matrix.shared_libs }}
90 -DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
91 -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }}
92 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
93 -Dbuild_tests=ON
94 -Ddisable_gc_debug=${{ matrix.disable_gc_debug }}
95 -Denable_cplusplus=${{ matrix.enable_cplusplus }}
96 -Denable_gc_assertions=${{ matrix.gc_assertions }}
97 -Denable_large_config=${{ matrix.large_config }}
98 -Denable_redirect_malloc=${{ matrix.redirect_malloc }}
99 -Denable_rwlock=${{ matrix.enable_rwlock }}
100 -Denable_threads=${{ matrix.enable_threads }}
101 -Denable_werror=ON
102 -Werror=dev
103 -S ${{ github.workspace }}
104
105 - name: Build
106 # Build the code with the given configuration.
107 run: >
108 cmake --build ${{ steps.strings.outputs.build-output-dir }}
109 --config ${{ matrix.build_type }} --verbose --parallel
110
111 - name: Test
112 working-directory: ${{ steps.strings.outputs.build-output-dir }}
113 # Execute tests defined by the CMake configuration.
114 run: ctest --build-config ${{ matrix.build_type }} --verbose --parallel 8
115