Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 47 additions & 7 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
```
# GENERATED BY AI
# This starter workflow is for a CMake project running on multiple platforms.
# This workflow builds and tests the CMake project on multiple platforms
# using specific compiler versions.
name: CMake on multiple platforms

on:
Expand All @@ -19,26 +21,50 @@ jobs:
build_type: [Release]
c_compiler: [gcc, clang, cl]
include:
# Windows uses MSVC
- os: windows-latest
c_compiler: cl
cpp_compiler: cl

# Ubuntu uses GCC 16
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
c_compiler: gcc-16
cpp_compiler: g++-16

# Ubuntu uses Clang 18
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
c_compiler: clang-18
cpp_compiler: clang++-18

exclude:
- os: windows-latest
c_compiler: gcc

- os: windows-latest
c_compiler: clang

- os: ubuntu-latest
c_compiler: cl

steps:
- uses: actions/checkout@v4

# Install GCC 16 on Ubuntu
- name: Install GCC 16
if: matrix.c_compiler == 'gcc-16'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y gcc-16 g++-16

# Install Clang 18 on Ubuntu
- name: Install Clang 18
if: matrix.c_compiler == 'clang-18'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y clang-18

# Set up Developer Command Prompt explicitly for MSVC (cl) on Windows
- name: Set up MSVC Developer Command Prompt
if: matrix.os == 'windows-latest'
Expand All @@ -50,7 +76,19 @@ jobs:
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"

# Added -G Ninja and language standard enforcement flags
# Display the compiler version being used
- name: Show compiler version
shell: bash
run: |
if [ "${{ matrix.c_compiler }}" = "gcc-16" ]; then
g++-16 --version
elif [ "${{ matrix.c_compiler }}" = "clang-18" ]; then
clang++-18 --version
else
cl
fi

# Configure CMake with C++23 enabled
- name: Configure CMake
run: >
cmake -G Ninja -B ${{ steps.strings.outputs.build-output-dir }}
Expand All @@ -61,10 +99,12 @@ jobs:
-DCMAKE_CXX_STANDARD_REQUIRED=ON
-S ${{ github.workspace }}

# Build the project
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

# Added --output-on-failure so you can see exactly why a test fails in the logs
# Run tests and show detailed output if anything fails
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest --build-config ${{ matrix.build_type }} --output-on-failure
```