Skip to content

Fix GitHub pipeline #78

Fix GitHub pipeline

Fix GitHub pipeline #78

Workflow file for this run

name: Build
on:
push:
branches: [ master, main, develop, "feature/*" ]
pull_request:
branches: [ master, main, develop ]
env:
CMAKE_VERSION: 3.31.4
BUILD_TYPE: Release
BUILD_DIR: ${{ github.workspace }}/build
jobs:
build:
name: ${{ matrix.os }} - ${{ matrix.build_type }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build_type: [Debug, Release]
include:
- os: ubuntu-latest
install_deps: |
sudo apt-get update
# Install Qt6 packages (correct names for Ubuntu)
sudo apt-get install -y \
qt6-base-dev qt6-base-dev-tools \
libgl1-mesa-dev \
libxrandr-dev \
libxcursor-dev \
libxi-dev \
libxinerama-dev \
libx11-dev \
libxext-dev \
libudev-dev \
libopenal-dev \
libflac-dev \
libvorbis-dev \
libegl1-mesa-dev \
libdrm-dev \
libgbm-dev \
libfreetype6-dev \
zlib1g-dev
# Build SFML 3 from source as it's not in Ubuntu repos yet
git clone --depth 1 --branch 3.0.0 https://github.com/SFML/SFML.git
cd SFML
cmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
cmake --build build --config Release
sudo cmake --install build
cd ..
# Update library cache for SFML
sudo ldconfig
# Install spdlog (compatible version)
git clone --depth 1 --branch v1.12.0 https://github.com/gabime/spdlog.git
cd spdlog
cmake -B build -DCMAKE_BUILD_TYPE=Release -DSPDLOG_BUILD_SHARED=ON
cmake --build build --config Release
sudo cmake --install build
cd ..
# Update library cache for spdlog
sudo ldconfig
- os: windows-latest
install_deps: |
# Use vcpkg for dependencies
vcpkg install qtbase:x64-windows qttools:x64-windows sfml:x64-windows spdlog:x64-windows zlib:x64-windows
cmake_extra_args: -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
- os: macos-latest
install_deps: |
brew install qt@6 zlib
# Build SFML 3 from source
git clone --depth 1 --branch 3.0.0 https://github.com/SFML/SFML.git
cd SFML
cmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
cmake --build build --config Release
sudo cmake --install build
cd ..
# Install spdlog (compatible version, same as Ubuntu)
git clone --depth 1 --branch v1.12.0 https://github.com/gabime/spdlog.git
cd spdlog
cmake -B build -DCMAKE_BUILD_TYPE=Release -DSPDLOG_BUILD_SHARED=ON
cmake --build build --config Release
sudo cmake --install build
cd ..
cmake_prefix_path: /opt/homebrew/opt/qt@6:/usr/local/opt/qt@6
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Fix vfspp CMake version requirement
shell: bash
run: |
# Patch vfspp CMakeLists.txt to use compatible CMake version
if [ "${{ matrix.os }}" == "macos-latest" ]; then
sed -i '.bak' 's/cmake_minimum_required(VERSION 3.50)/cmake_minimum_required(VERSION 3.20)/' vendor/vfspp/CMakeLists.txt
else
sed -i 's/cmake_minimum_required(VERSION 3.50)/cmake_minimum_required(VERSION 3.20)/' vendor/vfspp/CMakeLists.txt
fi
- name: Set up CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: ${{ env.CMAKE_VERSION }}
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/vcpkg
~/.cache/vcpkg
~/Library/Caches/Homebrew
/usr/local/Cellar
/opt/homebrew/Cellar
key: ${{ runner.os }}-deps-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-deps-
- name: Install dependencies
shell: bash
run: ${{ matrix.install_deps }}
- name: Configure CMake
shell: bash
run: |
if [ "${{ matrix.os }}" == "macos-latest" ]; then
export CMAKE_PREFIX_PATH="${{ matrix.cmake_prefix_path }}:$CMAKE_PREFIX_PATH"
fi
if [ "${{ matrix.os }}" == "windows-latest" ]; then
# Use Windows paths with proper escaping
cmake -B "${{ env.BUILD_DIR }}" \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DGECK_BUILD_TESTS=ON \
-DGECK_AUTO_TEST=OFF \
${{ matrix.cmake_extra_args }} \
-S "${{ github.workspace }}"
else
# Set library path for CMake test discovery on Linux/macOS
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
cmake -B ${{ env.BUILD_DIR }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DGECK_BUILD_TESTS=ON \
-DGECK_AUTO_TEST=OFF \
-DSPDLOG_FMT_EXTERNAL=OFF \
-DCMAKE_CXX_FLAGS="-Wno-error" \
${{ matrix.cmake_extra_args }} \
-S ${{ github.workspace }}
fi
- name: Build
shell: bash
run: |
if [ "${{ matrix.os }}" != "windows-latest" ]; then
# Set library path for Linux/macOS
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
fi
cmake --build ${{ env.BUILD_DIR }} --config ${{ matrix.build_type }} --parallel
- name: Run Unit Tests
shell: bash
working-directory: ${{ env.BUILD_DIR }}
run: |
if [ "${{ matrix.os }}" == "windows-latest" ]; then
# Run tests with proper configuration
ctest -C ${{ matrix.build_type }} --output-on-failure --verbose
else
# Set library path for Linux and macOS
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
# Set Qt platform to offscreen for headless testing on Linux
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
export QT_QPA_PLATFORM=offscreen
fi
ctest --output-on-failure --verbose
fi
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: geck-mapper-${{ matrix.os }}-${{ matrix.build_type }}
path: |
${{ env.BUILD_DIR }}/src/geck-mapper*
${{ env.BUILD_DIR }}/tests/*_tests*
retention-days: 7
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-${{ matrix.build_type }}
path: |
test-results/
${{ env.BUILD_DIR }}/Testing/
retention-days: 7