Skip to content

v0.6.2

v0.6.2 #374

name: Compilation
on:
push:
branches: ["dev", "devops"]
tags:
- "*"
pull_request:
branches: ["main", "dev"]
jobs:
build_gengine:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build_type: [Release]
c_compiler: [gcc, clang, cl]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: macos-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl
- os: macos-latest
c_compiler: gcc
- os: macos-latest
c_compiler: cl
steps:
- uses: actions/checkout@v4
- name: Install ubuntu packages necessary for glfw3
if: matrix.os == 'ubuntu-latest'
run: sudo apt update && sudo apt install libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Cache build directory
id: cache-build
uses: actions/cache@v4
with:
path: build
key: ${{ runner.os }}-build-${{ hashFiles('CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-build-
- name: Configure CMake
if: steps.cache-build.outputs.cache-hit != 'true'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
# Since metadata is not cached, we need to reconfigure cmake but without triggering a vcpkg pull
- name: Configure CMake CACHED
if: steps.cache-build.outputs.cache-hit == 'true'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DVCPKG_SHOULD_NOT_UPDATE=TRUE
-S ${{ github.workspace }}
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 8
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest --build-config ${{ matrix.build_type }}
# the cache is mainly for cmake, and the timestamps don't match anyway. maybe next time we'll use another cache handler
- name: Clean the cmake build directory Windows
if: matrix.os == 'windows-latest' && steps.cache-build.outputs.cache-hit != 'true'
run: |
cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target clean
Get-ChildItem -Path build/vcpkg/* -Exclude 'downloads', 'installed', 'scripts', 'triplets' | Remove-Item -Recurse -Force
Remove-Item -Recurse -Force build/Release/*.dll
- name: Clean the cmake build directory UNIX like
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' && steps.cache-build.outputs.cache-hit != 'true'
run: |
cmake --build ${{ steps.strings.outputs.build-output-dir }} --target clean
find build/.vcpkg -mindepth 1 -maxdepth 1 ! -name 'downloads' ! -name 'installed' ! -name 'scripts' ! -name 'triplets' -exec rm -rf {} +
cleanup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for build artifacts
run: |
artifacts=$(find ${{ github.workspace }} -type f -name "*.so" -o -name "*.o" -o -name "*.d" -o -name "*.a")
if [ -n "$artifacts" ]; then
echo "Found unwanted artifacts:"
echo "$artifacts"
exit 1
else
echo "No unwanted artifacts found."
fi
beautify:
runs-on: ubuntu-latest
container:
image: fedora:40
steps:
- uses: actions/checkout@v4
- name: Install clang-format
run: sudo dnf install clang-tools-extra -y
- name: Check clang-format compliance
run: |
clang-format --version
files=$(find . -name "*.hpp" -o -name "*.cpp" -o -name "*.inl")
clang-format -Werror -dry-run $files