You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
4.4 KiB

3 years ago
2 years ago
3 years ago
  1. name: CMakeBuilds
  2. on:
  3. workflow_dispatch:
  4. push:
  5. paths:
  6. - 'src/**'
  7. - 'examples/**'
  8. - '.github/workflows/cmake.yml'
  9. - 'CMakeList.txt'
  10. - 'CMakeOptions.txt'
  11. - 'cmake/**'
  12. pull_request:
  13. paths:
  14. - 'src/**'
  15. - 'examples/**'
  16. - '.github/workflows/cmake.yml'
  17. - 'CMakeList.txt'
  18. - 'CMakeOptions.txt'
  19. - 'cmake/**'
  20. env:
  21. # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
  22. BUILD_TYPE: Release
  23. permissions:
  24. contents: read
  25. jobs:
  26. build_windows:
  27. name: Windows Build
  28. # The CMake configure and build commands are platform agnostic and should work equally
  29. # well on Windows or Mac. You can convert this to a matrix build if you need
  30. # cross-platform coverage.
  31. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
  32. runs-on: windows-latest
  33. steps:
  34. - uses: actions/checkout@v3
  35. - name: Create Build Environment
  36. # Some projects don't allow in-source building, so create a separate build directory
  37. # We'll use this as our working directory for all subsequent commands
  38. run: cmake -E make_directory ${{github.workspace}}/build
  39. - name: Configure CMake
  40. # Use a bash shell so we can use the same syntax for environment variable
  41. # access regardless of the host operating system
  42. shell: powershell
  43. working-directory: ${{github.workspace}}/build
  44. # Note the current convention is to use the -S and -B options here to specify source
  45. # and build directories, but this is only available with CMake 3.13 and higher.
  46. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12
  47. run: cmake $env:GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$env:BUILD_TYPE -DPLATFORM=Desktop
  48. - name: Build
  49. working-directory: ${{github.workspace}}/build
  50. shell: powershell
  51. # Execute the build. You can specify a specific target with "--target <NAME>"
  52. run: cmake --build . --config $env:BUILD_TYPE
  53. - name: Test
  54. working-directory: ${{github.workspace}}/build
  55. shell: powershell
  56. # Execute tests defined by the CMake configuration.
  57. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
  58. run: ctest -C $env:BUILD_TYPE
  59. build_linux:
  60. name: Linux Build
  61. # The CMake configure and build commands are platform agnostic and should work equally
  62. # well on Windows or Mac. You can convert this to a matrix build if you need
  63. # cross-platform coverage.
  64. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
  65. runs-on: ubuntu-latest
  66. steps:
  67. - uses: actions/checkout@v3
  68. - name: Create Build Environment
  69. # Some projects don't allow in-source building, so create a separate build directory
  70. # We'll use this as our working directory for all subsequent commands
  71. run: cmake -E make_directory ${{github.workspace}}/build
  72. - name: Setup Environment
  73. run: |
  74. sudo apt-get update -qq
  75. sudo apt-get install gcc-multilib
  76. 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
  77. - name: Configure CMake
  78. # Use a bash shell so we can use the same syntax for environment variable
  79. # access regardless of the host operating system
  80. shell: bash
  81. working-directory: ${{github.workspace}}/build
  82. # Note the current convention is to use the -S and -B options here to specify source
  83. # and build directories, but this is only available with CMake 3.13 and higher.
  84. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12
  85. run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPLATFORM=Desktop
  86. - name: Build
  87. working-directory: ${{github.workspace}}/build
  88. shell: bash
  89. # Execute the build. You can specify a specific target with "--target <NAME>"
  90. run: cmake --build . --config $BUILD_TYPE
  91. - name: Test
  92. working-directory: ${{github.workspace}}/build
  93. shell: bash
  94. # Execute tests defined by the CMake configuration.
  95. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
  96. run: ctest -C $BUILD_TYPE