Skip to content

🔨 Another CMake github actions attempt #14

🔨 Another CMake github actions attempt

🔨 Another CMake github actions attempt #14

name: Build and Test
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release, RelWithDebInfo]
include:
- os: windows-latest
cpp_compiler: cl
- os: ubuntu-latest
cpp_compiler: g++
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install System Dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libegl1-mesa-dev libgl1-mesa-dev ninja-build
- name: Setup Developer Command Prompt (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Install Ninja (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$NinjaPath = "C:\Program Files\Ninja"
New-Item -ItemType Directory -Path $NinjaPath -Force
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip" -OutFile "ninja.zip"
Expand-Archive "ninja.zip" -DestinationPath $NinjaPath
Add-Content $env:GITHUB_PATH "$NinjaPath"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install conan cmake
- name: Setup Conan
shell: bash
run: |
conan profile detect --force
- name: Install Conan Dependencies
run: |
conan install . --build=missing -s build_type=${{ matrix.build_type }}
- name: Configure CMake
run: |
cmake --preset conan-${{ matrix.build_type }}
- name: Build
run: cmake --build --preset conan-${{ matrix.build_type }}
- name: Test
run: ctest --preset conan-${{ matrix.build_type }}
- name: Set Artifact Path
id: artifact
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
echo "game-path=build/${{ matrix.build_type }}/src/game/stabby.exe" >> "$GITHUB_OUTPUT"
else
echo "game-path=build/${{ matrix.build_type }}/src/game/stabby" >> "$GITHUB_OUTPUT"
fi
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-${{ matrix.build_type }}-build
path: ${{ steps.artifact.outputs.game-path }}
if-no-files-found: ignore