|
| 1 | +name: CMake |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +env: |
| 10 | + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) |
| 11 | + BUILD_TYPE: Release |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + # macos-11 is not available - https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners |
| 18 | + os: [ ubuntu-18.04, ubuntu-latest, macos-latest, windows-latest ] |
| 19 | + runs-on: ${{matrix.os}} |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + |
| 24 | + - name: Install libcurl on Linux |
| 25 | + if: runner.os == 'Linux' |
| 26 | + run: | |
| 27 | + sudo apt-get update |
| 28 | + sudo apt-get install libcurl4-openssl-dev |
| 29 | +
|
| 30 | + - name: Install libcurl on macOS |
| 31 | + if: runner.os == 'macOS' |
| 32 | + run: | |
| 33 | + brew update |
| 34 | + brew install curl |
| 35 | +
|
| 36 | + - name: Install libcurl on Windows |
| 37 | + if: runner.os == 'Windows' |
| 38 | + # Will install to C:\ProgramData\chocolatey\lib\curl\tools\curl-7.77.0-win64-mingw |
| 39 | + run: choco install --no-progress curl |
| 40 | + |
| 41 | + - name: Configure CMake |
| 42 | + if: runner.os != 'Windows' |
| 43 | + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. |
| 44 | + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type |
| 45 | + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} |
| 46 | + |
| 47 | + - name: Configure CMake on Windows |
| 48 | + if: runner.os == 'Windows' |
| 49 | + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. |
| 50 | + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type |
| 51 | + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCURL_LIBRARY=C:\ProgramData\chocolatey\lib\curl\tools\curl-7.77.0-win64-mingw\lib -DCURL_INCLUDE_DIR=C:\ProgramData\chocolatey\lib\curl\tools\curl-7.77.0-win64-mingw\include |
| 52 | + |
| 53 | + - name: Build |
| 54 | + # Build your program with the given configuration |
| 55 | + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} |
| 56 | + |
| 57 | + - name: Test |
| 58 | + working-directory: ${{github.workspace}}/build |
| 59 | + # Execute tests defined by the CMake configuration. |
| 60 | + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail |
| 61 | + run: ctest -C ${{env.BUILD_TYPE}} |
| 62 | + |
0 commit comments