Skip to content

Merge remote-tracking branch 'origin/fix-build' into fix-build #65

Merge remote-tracking branch 'origin/fix-build' into fix-build

Merge remote-tracking branch 'origin/fix-build' into fix-build #65

Workflow file for this run

name: Build
on:
push:
paths:
- "CMakeLists.txt"
- "src/**"
- ".github/**"
pull_request:
paths:
- "CMakeLists.txt"
- "src/**"
- ".github/**"
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
os: windows-latest,
name: "Windows MSVC",
cc: cl,
cxx: cl,
cflags: "",
}
- {
os: windows-latest,
name: "Windows Clang",
cc: clang-cl,
cxx: clang-cl,
}
- { os: ubuntu-latest, name: "Linux Clang", cc: clang, cxx: clang++ }
- { os: ubuntu-latest, name: "Linux GCC", cc: gcc-10, cxx: g++-10 }
- { os: macos-latest, name: "OS X Clang", cc: clang, cxx: clang++ }
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install dependencies
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
vcpkg install --triplet x64-windows sfml zlib
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install sfml zlib
else
set -e
sudo apt-get update
sudo apt-get install libsfml-dev
fi
- name: Configure CMake
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cmake \
-B ./build \
-DCMAKE_C_COMPILER=${{matrix.config.cc}} \
-DCMAKE_CXX_COMPILER=${{matrix.config.cxx}} \
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \
.
else
cmake \
-B ./build \
-DCMAKE_C_COMPILER=${{matrix.config.cc}} \
-DCMAKE_CXX_COMPILER=${{matrix.config.cxx}} \
.
fi
- name: Build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build build -j 3
- name: Run tests
shell: bash
run: cd build && ctest --output-on-failure
# TODO: release and publish artifacts: https://github.com/cristianadam/HelloWorld/blob/master/.github/workflows/build_cmake.yml