ci: fix ARM macOS build compatibility #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Test | |
| on: | |
| push: | |
| branches: [ master, develop ] | |
| pull_request: | |
| branches: [ master ] | |
| env: | |
| BUILD_TYPE: Release | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: ${{ matrix.os }} - ${{ matrix.compiler }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Ubuntu with GCC | |
| - os: ubuntu-latest | |
| compiler: gcc-12 | |
| cc: gcc-12 | |
| cxx: g++-12 | |
| - os: ubuntu-latest | |
| compiler: gcc-13 | |
| cc: gcc-13 | |
| cxx: g++-13 | |
| # Ubuntu with Clang | |
| - os: ubuntu-latest | |
| compiler: clang-17 | |
| cc: clang-17 | |
| cxx: clang++-17 | |
| - os: ubuntu-latest | |
| compiler: clang-18 | |
| cc: clang-18 | |
| cxx: clang++-18 | |
| # macOS | |
| - os: macos-latest | |
| compiler: apple-clang | |
| cc: clang | |
| cxx: clang++ | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies (Ubuntu) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ninja-build libomp-dev | |
| # Install specific compiler versions if needed | |
| if [[ "${{ matrix.compiler }}" == "gcc-13" ]]; then | |
| sudo apt-get install -y gcc-13 g++-13 | |
| fi | |
| if [[ "${{ matrix.compiler }}" == clang-* ]]; then | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh ${CLANG_VERSION#clang-} | |
| fi | |
| env: | |
| CLANG_VERSION: ${{ matrix.compiler }} | |
| - name: Install dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install ninja libomp | |
| - name: Configure CMake | |
| env: | |
| CC: ${{ matrix.cc }} | |
| CXX: ${{ matrix.cxx }} | |
| run: | | |
| cmake -B build \ | |
| -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ | |
| -DCMAKE_CXX_FLAGS="-march=native" | |
| - name: Build | |
| run: cmake --build build --config ${{ env.BUILD_TYPE }} | |
| - name: Run Tests | |
| working-directory: build | |
| run: ctest -C ${{ env.BUILD_TYPE }} --output-on-failure --timeout 300 | |
| build-debug: | |
| name: Debug Build with Sanitizers | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ninja-build gcc-12 g++-12 libomp-dev | |
| - name: Configure CMake (Debug) | |
| env: | |
| CC: gcc-12 | |
| CXX: g++-12 | |
| run: | | |
| cmake -B build \ | |
| -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Debug | |
| - name: Build | |
| run: cmake --build build --config Debug | |
| - name: Run Tests | |
| working-directory: build | |
| run: ctest -C Debug --output-on-failure --timeout 300 | |
| code-quality: | |
| name: Code Quality Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ninja-build clang-format-15 cppcheck | |
| - name: Check formatting | |
| run: | | |
| find examples tests benchmarks -name "*.cpp" -o -name "*.hpp" | \ | |
| xargs clang-format-15 --dry-run --Werror || \ | |
| echo "::warning::Some files need formatting" | |
| - name: Run cppcheck | |
| run: | | |
| cppcheck --enable=warning,style,performance \ | |
| --suppress=missingIncludeSystem \ | |
| --error-exitcode=0 \ | |
| examples/ tests/ benchmarks/ || true |