• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Build and Test CI - macOS
2# Build and Test CI for macOS-latest
3
4on: [ push, pull_request ]
5
6jobs:
7  build:
8    name: ${{ matrix.config.name }}
9    runs-on: ${{ matrix.config.os }}
10    strategy:
11      fail-fast: true
12      matrix:
13        config:
14          # <macOS-latest ARM64 Platform, Release Build, Clang toolchain, Ninja generator>
15          - name: "macOS latest ARM64 clang rel ninja"
16            os: macos-latest
17            build_type: Release
18            cc: clang
19            cxx: clang++
20            cmake-opts: '-DUHDR_BUILD_TESTS=1 -DUHDR_ENABLE_LOGS=1 -DUHDR_ENABLE_INSTALL=1 -DUHDR_ENABLE_WERROR=1'
21
22          # <macOS-13 Platform, Release Build, Clang toolchain, Ninja generator>
23          - name: "macOS-13 clang rel ninja"
24            os: macos-13
25            build_type: Release
26            cc: clang
27            cxx: clang++
28            cmake-opts: '-DUHDR_BUILD_TESTS=1 -DUHDR_ENABLE_LOGS=1 -DUHDR_ENABLE_INSTALL=1 -DUHDR_ENABLE_WERROR=1'
29
30          # <macOS-latest ARM64 Platform, Release Build, Clang toolchain, Ninja generator, Build Deps>
31          - name: "macOS latest ARM64 clang rel ninja with deps"
32            os: macos-latest
33            build_type: Release
34            cc: clang
35            cxx: clang++
36            cmake-opts: '-DUHDR_BUILD_TESTS=1 -DUHDR_ENABLE_LOGS=1 -DUHDR_BUILD_DEPS=1 -DUHDR_ENABLE_WERROR=1'
37
38          # <macOS-latest ARM64 Platform, Release Build, Clang toolchain, Ninja generator, Static linking>
39          - name: "macOS latest ARM64 clang rel ninja static"
40            os: macos-latest
41            build_type: Release
42            cc: clang
43            cxx: clang++
44            cmake-opts: '-DUHDR_BUILD_TESTS=1 -DUHDR_ENABLE_LOGS=1 -DUHDR_ENABLE_INSTALL=1 -DBUILD_SHARED_LIBS=0 -DUHDR_ENABLE_WERROR=1'
45
46          # <macOS-13 Platform, Release Build, Clang toolchain, Ninja generator, Static linking>
47          - name: "macOS-13 clang rel ninja static"
48            os: macos-13
49            build_type: Release
50            cc: clang
51            cxx: clang++
52            cmake-opts: '-DUHDR_BUILD_TESTS=1 -DUHDR_ENABLE_LOGS=1 -DUHDR_ENABLE_INSTALL=1 -DBUILD_SHARED_LIBS=0 -DUHDR_ENABLE_WERROR=1'
53
54    steps:
55    - name: Checkout the repository
56      uses: actions/checkout@v4
57
58    - name: Setup ninja
59      uses: seanmiddleditch/gha-setup-ninja@master
60
61    - name: Setup cmake
62      uses: jwlawson/actions-setup-cmake@v2
63
64    - name: Install dependencies on macOS
65      run: |
66        if ! command -v pkg-config &> /dev/null; then
67          brew install pkg-config
68        fi
69        if ! brew list jpeg-turbo &> /dev/null; then
70          brew install jpeg-turbo
71        fi
72
73    - name: Configure CMake
74      shell: bash
75      run: |
76        export CC=${{ matrix.config.cc }}
77        export CXX=${{ matrix.config.cxx }}
78        mkdir build
79        cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} ${{ matrix.config.cmake-opts }}
80
81    - name: Build
82      run: cmake --build build --config ${{ matrix.config.build_type }}
83
84    - name: Test
85      working-directory: build
86      run: ctest --build-config ${{ matrix.config.build_type }}