build_cmake.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. name: Building(CMake)
  2. on:
  3. push:
  4. branches: [ master ]
  5. paths-ignore:
  6. - 'README.md'
  7. - 'LICENSE'
  8. pull_request:
  9. branches: [ master ]
  10. paths-ignore:
  11. - 'README.md'
  12. - 'LICENSE'
  13. env:
  14. # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
  15. BUILD_TYPE: RelWithDebInfo
  16. jobs:
  17. linux-build:
  18. name: ${{ matrix.os}}
  19. runs-on: ${{ matrix.os }}
  20. strategy:
  21. matrix:
  22. os: [ubuntu-20.04]
  23. steps:
  24. - name: Checkout Source code
  25. if: github.event_name == 'push'
  26. uses: actions/checkout@v2
  27. - name: Checkout Source code
  28. if: github.event_name == 'pull_request'
  29. uses: actions/checkout@v2
  30. with:
  31. ref: ${{ github.event.pull_request.head.sha }}
  32. - name: Install Dependencies
  33. run: |
  34. sudo apt-get -y -qq update
  35. sudo apt-get -y --no-install-recommends install \
  36. cmake \
  37. extra-cmake-modules \
  38. build-essential \
  39. qt5-default \
  40. qttools5-dev-tools \
  41. qttools5-dev \
  42. libqt5dbus5 \
  43. libqt5network5 \
  44. libqt5core5a \
  45. libqt5widgets5 \
  46. libqt5gui5 \
  47. libqt5svg5-dev
  48. - name: Create Build Environment
  49. # Some projects don't allow in-source building, so create a separate build directory
  50. # We'll use this as our working directory for all subsequent commands
  51. run: cmake -E make_directory ${{runner.workspace}}/build
  52. - name: Configure CMake
  53. # Use a bash shell so we can use the same syntax for environment variable
  54. # access regardless of the host operating system
  55. shell: bash
  56. working-directory: ${{runner.workspace}}/build
  57. # Note the current convention is to use the -S and -B options here to specify source
  58. # and build directories, but this is only available with CMake 3.13 and higher.
  59. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12
  60. #
  61. # We need to source the profile file to make sure conan is in PATH
  62. run: |
  63. cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
  64. - name: Build
  65. working-directory: ${{runner.workspace}}/build
  66. shell: bash
  67. # Execute the build. You can specify a specific target with "--target <NAME>"
  68. run: cmake --build . --config $BUILD_TYPE
  69. - name: Test
  70. working-directory: ${{runner.workspace}}/build
  71. shell: bash
  72. # Execute tests defined by the CMake configuration.
  73. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
  74. run: ctest -C $BUILD_TYPE
  75. windows-build:
  76. runs-on: ${{ matrix.config.os }}
  77. strategy:
  78. fail-fast: false
  79. matrix:
  80. config:
  81. - {
  82. name: "Windows 2019 MSVC",
  83. artifact: "Windows-MSVC.tar.xz",
  84. os: windows-2019,
  85. cc: "cl", cxx: "cl",
  86. environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
  87. }
  88. - {
  89. name: "Windows 2019 MinGW",
  90. artifact: "Windows-MinGW.tar.xz",
  91. os: windows-2019,
  92. cc: "gcc", cxx: "g++"
  93. }
  94. steps:
  95. - uses: actions/checkout@v2
  96. - name: Cache Qt
  97. id: cache-qt
  98. uses: actions/cache@v1
  99. with:
  100. path: ./build/Qt
  101. key: ${{ runner.os }}-QtCache
  102. - name: Install Qt
  103. uses: jurplel/install-qt-action@v2
  104. with:
  105. version: 5.15.2
  106. target: desktop
  107. dir: '${{ github.workspace }}/build/'
  108. - name: Configure
  109. working-directory: build
  110. shell: powershell
  111. run: |
  112. cmake -DCMAKE_BUILD_TYPE=$env:BUILD_TYPE ../
  113. - name: Build
  114. working-directory: build
  115. shell: powershell
  116. run: |
  117. cmake --build . --config $env:BUILD_TYPE