cmake.yml 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. name: CMake
  2. on:
  3. push:
  4. branches: ["master"]
  5. pull_request:
  6. branches: ["master"]
  7. env:
  8. # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
  9. BUILD_TYPE: Release
  10. jobs:
  11. build:
  12. # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
  13. # You can convert this to a matrix build if you need cross-platform coverage.
  14. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
  15. runs-on: ubuntu-latest
  16. steps:
  17. - uses: actions/checkout@v3
  18. # without GTest and Boost
  19. - name: Install Python NumPy and Pybind11
  20. run: sudo apt install python-numpy python-all-dev python-numpy-dev python3-pybind11 python3-distutils && sudo pip3 install tox
  21. - name: Configure CMake
  22. # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
  23. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
  24. run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
  25. - name: Build
  26. # Build your program with the given configuration
  27. run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
  28. - name: Test
  29. working-directory: ${{github.workspace}}/build
  30. # Execute tests defined by the CMake configuration.
  31. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
  32. run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
  33. ##################################################################
  34. # Do just the same but now with Google Test lib for C++ part
  35. ##################################################################
  36. - name: install Google Test
  37. run: sudo apt install libgtest-dev
  38. - name: Configure CMake
  39. # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
  40. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
  41. run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
  42. - name: Build
  43. # Build your program with the given configuration
  44. run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
  45. - name: Test
  46. working-directory: ${{github.workspace}}/build
  47. # Execute tests defined by the CMake configuration.
  48. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
  49. run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
  50. ##################################################################
  51. # Do just the same but now with Boost multiprecision
  52. ##################################################################
  53. - name: install Boost (to use multiprecision)
  54. run: sudo apt install libboost-all-dev
  55. - name: Configure CMake
  56. # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
  57. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
  58. run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
  59. - name: Build
  60. # Build your program with the given configuration
  61. run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
  62. - name: Test
  63. working-directory: ${{github.workspace}}/build
  64. # Execute tests defined by the CMake configuration.
  65. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
  66. run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure