Skip to content

Simplify github actions CI yaml file to use stock github runners and latest versions of windows/mac/ubuntu #79

Simplify github actions CI yaml file to use stock github runners and latest versions of windows/mac/ubuntu

Simplify github actions CI yaml file to use stock github runners and latest versions of windows/mac/ubuntu #79

Workflow file for this run

name: Cross-Platform C++ Build
on:
push:
# Jobs are skipped when ONLY Markdown (*.md) files are changed
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build_type: [Release]
include:
- os: ubuntu-latest
build-shared: 'ON'
build-type: Release
cxx-standard: 17
cxx-compiler: g++
cc-compiler: gcc
- os: windows-latest
build-shared: 'OFF'
build-type: Release
cxx-standard: 17
- os: macos-latest
build-shared: 'ON'
build-type: Release
cxx-standard: 17
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up build environment
run: |
echo "Build type: ${{ matrix.build_type }}"
echo "OS: ${{ matrix.os }}"
# Linux specific setup
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake
# macOS specific setup
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install cmake
# Windows specific setup
- name: Setup MSVC (Windows)
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v2
- name: Configure CMake
run: |
cmake ../. \
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS='ON'\
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} \
-DCMAKE_CXX_FLAGS=${{ matrix.cxx-flags }} \
-DCMAKE_VERBOSE_MAKEFILE:BOOL='OFF' \
-DBUILD_SHARED_LIBS=${{ matrix.build-shared }}
- name: Build
run: |
run: |
cmake --build . \
--target install \
--config ${{ matrix.build-type }}
# Optional: Run tests if you have any
- name: Test
working-directory: build
run: |
ctest -C ${{ matrix.build-type }}
# Upload build artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.os }}-${{ matrix.build_type }}
path: |
build/
!build/**/*.o
!build/**/*.obj
!build/**/CMakeFiles/
retention-days: 7