|
1 | | -# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. |
2 | | -# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml |
3 | 1 | name: CMake on multiple platforms |
4 | 2 |
|
5 | 3 | on: |
|
9 | 7 | pull_request: |
10 | 8 | branches: [ "main" ] |
11 | 9 |
|
12 | | - |
13 | | - |
14 | 10 | jobs: |
15 | 11 | build: |
16 | 12 | runs-on: ${{ matrix.os }} |
17 | 13 |
|
18 | 14 | strategy: |
19 | | - # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. |
20 | 15 | fail-fast: false |
21 | 16 |
|
22 | | - # Set up a matrix to run the following 3 configurations: |
23 | | - # 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator> |
24 | | - # 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator> |
25 | | - # 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator> |
26 | | - # |
27 | | - # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. |
| 17 | + # Explicitly defining the matrix combinations ensures we get Linux/macOS cross x86/ARM |
28 | 18 | matrix: |
29 | | - os: [ubuntu-latest, macos-13] |
30 | | - build_type: [Release] |
31 | | - c_compiler: [gcc, clang] |
32 | 19 | include: |
| 20 | + # --- Linux (Ubuntu) --- |
33 | 21 | - os: ubuntu-latest |
| 22 | + arch: x86_64 |
34 | 23 | c_compiler: gcc |
35 | 24 | cpp_compiler: g++ |
36 | 25 | - os: ubuntu-latest |
| 26 | + arch: x86_64 |
37 | 27 | c_compiler: clang |
38 | 28 | cpp_compiler: clang++ |
39 | | - - os: macos-13 |
| 29 | + - os: ubuntu-24.04-arm |
| 30 | + arch: arm64 |
40 | 31 | c_compiler: gcc |
41 | | - cpp_compiler: c++ |
42 | | - - os: macos-13 |
| 32 | + cpp_compiler: g++ |
| 33 | + - os: ubuntu-24.04-arm |
| 34 | + arch: arm64 |
| 35 | + c_compiler: clang |
| 36 | + cpp_compiler: clang++ |
| 37 | + |
| 38 | + # --- macOS --- |
| 39 | + - os: macos-15-intel # Intel x86_64 runner |
| 40 | + arch: x86_64 |
| 41 | + c_compiler: clang |
| 42 | + cpp_compiler: clang++ |
| 43 | + - os: macos-latest # Apple Silicon M1/M2/M3 ARM64 runner |
| 44 | + arch: arm64 |
43 | 45 | c_compiler: clang |
44 | 46 | cpp_compiler: clang++ |
45 | 47 |
|
46 | 48 | steps: |
47 | 49 | - uses: actions/checkout@v4 |
48 | 50 |
|
49 | 51 | - name: Set reusable strings |
50 | | - # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. |
51 | 52 | id: strings |
52 | 53 | shell: bash |
53 | 54 | run: | |
54 | 55 | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" |
55 | 56 |
|
56 | 57 | - name: Configure CMake |
57 | | - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. |
58 | | - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type |
59 | 58 | run: > |
60 | 59 | cmake -B ${{ steps.strings.outputs.build-output-dir }} |
61 | 60 | -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} |
62 | 61 | -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} |
63 | | - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} |
| 62 | + -DCMAKE_BUILD_TYPE=Release |
64 | 63 | -DSIPM_ENABLE_TEST=ON |
65 | 64 | -S ${{ github.workspace }} |
66 | 65 |
|
67 | 66 | - name: Build |
68 | | - # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). |
69 | | - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} |
| 67 | + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Release |
70 | 68 |
|
71 | 69 | - name: Test |
72 | 70 | working-directory: ${{ steps.strings.outputs.build-output-dir }} |
73 | | - # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). |
74 | | - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail |
75 | | - run: ctest --build-config ${{ matrix.build_type }} --test-dir tests |
| 71 | + run: ctest --build-config Release |
0 commit comments