Skip to content

build: add git-based versioning #5

build: add git-based versioning

build: add git-based versioning #5

name: CMake Multi-Platform
on:
push:
pull_request:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
build_type: [Debug, 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: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
- 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: cl
- os: macos-latest
c_compiler: gcc
- os: macos-latest
c_compiler: cl
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python (Windows)
if: runner.os == 'Windows'
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install glad generator deps (Windows)
if: runner.os == 'Windows'
run: |
python -m pip install --upgrade pip
python -m pip install jinja2
- name: Configure (Windows)
if: runner.os == 'Windows'
run: >
cmake -S . -B build
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DBUILD_VISUALIZATION=ON
-DBUILD_EXAMPLES=ON
-DPython_EXECUTABLE="$env:pythonLocation\python.exe"
- name: Configure (Non-Windows)
if: runner.os != 'Windows'
run: >
cmake -S . -B build
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DBUILD_VISUALIZATION=OFF
-DBUILD_EXAMPLES=OFF
- name: Build
run: cmake --build build --config ${{ matrix.build_type }}
- name: Test
run: ctest --test-dir build -C ${{ matrix.build_type }} --output-on-failure
- name: Package (Windows)
if: runner.os == 'Windows'
working-directory: build
run: cpack -G ZIP -C ${{ matrix.build_type }}
- name: Package (Linux/macOS)
if: runner.os != 'Windows'
working-directory: build
run: cpack -G TGZ -C ${{ matrix.build_type }}
- name: Upload package (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: grid-sim-${{ runner.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }}
path: build/*.zip
- name: Upload package (Linux/macOS)
if: runner.os != 'Windows'
uses: actions/upload-artifact@v4
with:
name: grid-sim-${{ runner.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }}
path: build/*.tar.gz
package-source:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Configure
run: >
cmake -S . -B build
-DCMAKE_BUILD_TYPE=Release
-DBUILD_VISUALIZATION=OFF
-DBUILD_EXAMPLES=OFF
- name: Package source
run: cpack -G TGZ --config build/CPackSourceConfig.cmake
- name: Upload source package
uses: actions/upload-artifact@v4
with:
name: grid-sim-source
path: build/*Source*.tar.gz