cmake-multi-platform.yml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
  2. # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
  3. name: CMake on multiple platforms
  4. on:
  5. push:
  6. branches: [ "master" ]
  7. pull_request:
  8. branches: [ "master" ]
  9. jobs:
  10. build:
  11. runs-on: ${{ matrix.os }}
  12. strategy:
  13. # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
  14. fail-fast: false
  15. # Set up a matrix to run the following 3 configurations:
  16. # 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
  17. # 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
  18. # 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
  19. #
  20. # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
  21. matrix:
  22. os: [ubuntu-latest, windows-latest]
  23. build_type: [Release]
  24. c_compiler: [gcc, clang, cl]
  25. include:
  26. - os: windows-latest
  27. c_compiler: cl
  28. cpp_compiler: cl
  29. - os: ubuntu-latest
  30. c_compiler: gcc
  31. cpp_compiler: g++
  32. - os: ubuntu-latest
  33. c_compiler: clang
  34. cpp_compiler: clang++
  35. exclude:
  36. - os: windows-latest
  37. c_compiler: gcc
  38. - os: windows-latest
  39. c_compiler: clang
  40. - os: ubuntu-latest
  41. c_compiler: cl
  42. steps:
  43. - name: Checkout code with submodules
  44. uses: actions/checkout@v4
  45. with:
  46. submodules: 'recursive'
  47. - name: Install dependencies for Ubuntu
  48. if: runner.os == 'Linux'
  49. run: |
  50. sudo apt update
  51. sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libwayland-bin libxkbcommon-dev
  52. - name: Set reusable strings
  53. # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
  54. id: strings
  55. shell: bash
  56. run: |
  57. echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
  58. - name: Configure CMake
  59. # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
  60. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
  61. run: >
  62. cmake -B ${{ steps.strings.outputs.build-output-dir }}
  63. -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
  64. -DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
  65. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
  66. -DR3D_RAYLIB_VENDORED=ON
  67. -DR3D_ASSIMP_VENDORED=ON
  68. -S ${{ github.workspace }}
  69. - name: Build
  70. # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
  71. run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
  72. - name: Test
  73. working-directory: ${{ steps.strings.outputs.build-output-dir }}
  74. # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
  75. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
  76. run: ctest --build-config ${{ matrix.build_type }}