diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 2a5dd0a..aeea4e2 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -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: @@ -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' @@ -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 }} @@ -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 +```