[brief] Fixes compiler issues on Apple. #15
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: [ master ] | |
paths-ignore: | |
- '**.md' | |
- '**.rst' | |
- 'LICENSE' | |
- 'data/**' | |
- '**/release-*.yml' | |
tags-ignore: | |
- "*.*.*" | |
pull_request: | |
branches: [ master ] | |
paths-ignore: | |
- '**.md' | |
- '**.rst' | |
- 'LICENSE' | |
- '**/release-*.yml' | |
tags-ignore: | |
- "*.*.*" | |
workflow_dispatch: | |
jobs: | |
format: | |
uses: ./.github/workflows/clang-format.yml | |
build: | |
name: ${{ matrix.config.os }}-${{ matrix.config.preset }}-${{ matrix.build }} | |
runs-on: ${{ matrix.config.os }} | |
needs: format | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: "windows-latest", cxx: "msvc", cc: "msvc", preset: "msvc"} | |
- {os: "ubuntu-24.04", cxx: "clang++-18", cc: "clang-18", preset: "clang"} | |
- {os: "ubuntu-24.04", cxx: "g++-14", cc: "gcc-14", preset: "gcc"} | |
- {os: "macos-latest", cxx: "clang++", cc: "clang", preset: "apple"} | |
build: ["Debug", "Release"] | |
steps: | |
- name: Chekout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
id: setup_python | |
with: | |
python-version: "3.12" | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/cache@v4 | |
with: | |
path: ~/deps | |
key: deps_${{ matrix.config.os }}_${{ matrix.build }}_${{ hashfiles('dependencies.txt') }} | |
- name: Build dependencies | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
shell: bash | |
env: | |
BUILD_TYPE: ${{ matrix.build }} | |
run: | | |
if [[ "$OSTYPE" == "msys" ]]; then | |
python tools/build_dependencies.py ~/deps -b $BUILD_TYPE | |
else | |
# Clang and GCC binaries are compatible, so only compile with GCC. | |
export CC="gcc-14" | |
export CXX="g++-14" | |
python3 tools/build_dependencies.py ~/deps | |
fi | |
- name: Build Zeus | |
shell: bash | |
env: | |
BUILD_TYPE: ${{ matrix.build }} | |
CONFIG_TYPE: ${{ matrix.config.preset }} | |
CC: ${{ matrix.config.cc }} | |
CXX: ${{ matrix.config.cxx }} | |
run: | | |
cmake --preset=$CONFIG_TYPE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_SHARED_LIBS=OFF -DCMAKE_PREFIX_PATH=~/deps | |
cd ./build | |
if [[ "$OSTYPE" == "msys" ]]; then | |
cmake --build . --config $BUILD_TYPE | |
else | |
make | |
fi | |
- name: Run tests | |
shell: bash | |
working-directory: ./build | |
env: | |
BUILD_TYPE: ${{ matrix.build }} | |
CONFIG_TYPE: ${{ matrix.config.preset }} | |
CC: ${{ matrix.config.cc }} | |
CXX: ${{ matrix.config.cxx }} | |
run: | | |
if [[ "$OSTYPE" == "msys" ]]; then | |
cmake --build . --target RUN_TESTS --config $BUILD_TYPE | |
else | |
make test | |
fi |