cmake.yml 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 python3-numpy python3-all-dev python-numpy-dev python3-pybind11 python3-distutils && sudo pip3 install tox
  21. run: sudo apt install python3-numpy python3-all-dev python3-pybind11 python3-distutils && sudo pip3 install tox
  22. - name: Configure CMake
  23. # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
  24. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
  25. run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
  26. - name: Build
  27. # Build your program with the given configuration
  28. run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
  29. - name: Test
  30. working-directory: ${{github.workspace}}/build
  31. # Execute tests defined by the CMake configuration.
  32. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
  33. run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
  34. ##################################################################
  35. # Do just the same but now with Google Test lib for C++ part
  36. ##################################################################
  37. - name: install Google Test
  38. run: sudo apt install libgtest-dev
  39. - name: Configure CMake
  40. # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
  41. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
  42. run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
  43. - name: Build
  44. # Build your program with the given configuration
  45. run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
  46. - name: Test
  47. working-directory: ${{github.workspace}}/build
  48. # Execute tests defined by the CMake configuration.
  49. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
  50. run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
  51. ##################################################################
  52. # Do just the same but now with Boost multiprecision
  53. ##################################################################
  54. - name: install Boost (to use multiprecision)
  55. run: sudo apt install libboost-all-dev
  56. - name: Configure CMake
  57. # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
  58. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
  59. run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
  60. - name: Build
  61. # Build your program with the given configuration
  62. run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
  63. - name: Test
  64. working-directory: ${{github.workspace}}/build
  65. # Execute tests defined by the CMake configuration.
  66. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
  67. run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure