Update cmake-multi-platform.yml #8
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: Omath CI | ||
on: | ||
push: | ||
branches: [ main ] # change if your default branch is not "main" | ||
pull_request: | ||
branches: [ main ] | ||
concurrency: | ||
group: ci-${{ github.ref }} | ||
cancel-in-progress: true | ||
################################################################################ | ||
# 1) ARCH LINUX – runs inside archlinux:latest container | ||
################################################################################ | ||
jobs: | ||
arch-build-and-test: | ||
runs-on: ubuntu-latest | ||
container: archlinux:latest | ||
name: Arch Linux (Clang) | ||
steps: | ||
# Install Git, Clang, CMake, Ninja, make, etc. *before* we checkout | ||
- name: Install build tools | ||
shell: bash | ||
run: | | ||
pacman -Sy --noconfirm archlinux-keyring | ||
pacman -Syu --noconfirm --needed \ | ||
git base-devel clang cmake ninja | ||
# Normal checkout with submodules now works because Git is present | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Configure (CMake preset: linux-release) | ||
shell: bash | ||
run: cmake --preset linux-release -DOMATH_BUILD_TESTS=ON | ||
- name: Build | ||
shell: bash | ||
run: cmake --build cmake-build/build/linux-release | ||
- name: Run unit-tests from out/Release | ||
shell: bash | ||
run: | | ||
./out/Release/unit_tests | ||
################################################################################ | ||
# 2) macOS – latest Homebrew LLVM/Clang | ||
################################################################################ | ||
macos-build-and-test: | ||
runs-on: macos-latest | ||
name: macOS (latest Clang) | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Install Ninja | ||
uses: seanmiddleditch/gha-setup-ninja@v4 | ||
- name: Install latest LLVM/Clang with Homebrew | ||
run: | | ||
brew update | ||
brew install llvm | ||
echo "LLVM_PREFIX=$(brew --prefix llvm)" >> "$GITHUB_ENV" | ||
- name: Configure (preset: darwin-release) using Homebrew Clang | ||
shell: bash | ||
env: | ||
CC: ${{ env.LLVM_PREFIX }}/bin/clang | ||
CXX: ${{ env.LLVM_PREFIX }}/bin/clang++ | ||
run: | | ||
cmake --preset darwin-release \ | ||
-DCMAKE_C_COMPILER="$CC" \ | ||
-DCMAKE_CXX_COMPILER="$CXX" \ | ||
-DOMATH_BUILD_TESTS=ON | ||
- name: Build | ||
shell: bash | ||
run: cmake --build cmake-build/build/darwin-release | ||
- name: Run unit-tests from out/Release | ||
shell: bash | ||
run: | | ||
./out/Release/unit_tests | ||
################################################################################ | ||
# 3) WINDOWS – MSVC | ||
################################################################################ | ||
windows-build-and-test: | ||
runs-on: windows-latest | ||
name: Windows (MSVC) | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Install Ninja | ||
uses: seanmiddleditch/gha-setup-ninja@v4 | ||
- name: Set up MSVC developer command-prompt | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
- name: Configure (preset: windows-release) | ||
shell: bash | ||
run: cmake --preset windows-release -DOMATH_BUILD_TESTS=ON | ||
- name: Build | ||
shell: bash | ||
run: cmake --build cmake-build/build/windows-release | ||
- name: Run unit-tests from out\\Release | ||
shell: bash | ||
run: | | ||
./out/Release/unit_tests.exe |