Use gcc & msvc on Linux & Windows #2
This file contains 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 | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
env: | |
CMAKE_GENERATOR: Ninja | |
DISPLAY: :0 | |
HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
jobs: | |
build: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
env: | |
CMAKE_PREFIX_PATH: ${{ matrix.cmake_prefix_path }} | |
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.osx_target }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: Linux | |
os: ubuntu-22.04 | |
osx_target: "" | |
cxx_flags: "-march=x86-64-v2" | |
- name: macOS-X64 | |
os: macos-13 | |
osx_target: "10.15" | |
cxx_flags: "-march=x86-64-v2" | |
cmake_prefix_path: "" | |
- name: macOS-ARM64 | |
os: macos-14 | |
osx_target: "11.0" | |
cxx_flags: "" | |
cmake_prefix_path: "" | |
- name: Windows | |
os: windows-latest | |
osx_target: "" | |
cxx_flags: "" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
lfs: true | |
- name: Install dependencies (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt update -y | |
sudo apt install -y libasound2-dev libx11-dev libxinerama-dev libxext-dev libfreetype6-dev libwebkit2gtk-4.0-dev libglu1-mesa-dev xvfb ninja-build ccache | |
- name: Install dependencies (macOS) | |
if: runner.os == 'macOS' | |
run: brew install ninja osxutils | |
- name: Install dependencies (Windows) | |
if: runner.os == 'Windows' | |
shell: bash | |
run: choco install ninja ccache | |
# - name: Install clang | |
# if: runner.os != 'macOS' | |
# uses: egor-tensin/setup-clang@v1 | |
- name: Set up Visual Studio shell | |
if: runner.os == 'Windows' | |
uses: egor-tensin/vs-shell@v2 | |
with: | |
arch: x64 | |
- name: Install conan | |
run: | | |
pip3 install --upgrade conan | |
conan profile detect -f | |
- name: Install ccache | |
uses: hendrikmuhs/ccache-action@main | |
with: | |
key: ${{ matrix.name }}-ccache-v1 | |
- name: CMake configure | |
run: > | |
cmake | |
-B build | |
-G Ninja | |
-D CMAKE_BUILD_TYPE=Release | |
-D CMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" | |
-D CMAKE_PROJECT_TOP_LEVEL_INCLUDES=3rd_party/cmake-conan/conan_provider.cmake | |
- name: CMake build | |
run: cmake --build build --config Release | |
- name: CTest | |
run: ctest --test-dir build -C Release --output-on-failure -j 1 |