Skip to content

Commit bef98b5

Browse files
committed
Introduce github action
1 parent 3a10df5 commit bef98b5

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/cmake.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
run: |
39+
choco install --no-progress curl
40+
echo "CURL_LIBRARY=C:\ProgramData\chocolatey\lib\curl\tools\curl-7.77.0-win64-mingw\lib" >> $GITHUB_ENV
41+
echo "CURL_INCLUDE_DIR=C:\ProgramData\chocolatey\lib\curl\tools\curl-7.77.0-win64-mingw\include" >> $GITHUB_ENV
42+
dir C:\ProgramData\chocolatey\lib\curl\tools\curl-7.77.0-win64-mingw
43+
44+
- name: Configure CMake
45+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
46+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
47+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
48+
49+
- name: Build
50+
# Build your program with the given configuration
51+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
52+
53+
- name: Test
54+
working-directory: ${{github.workspace}}/build
55+
# Execute tests defined by the CMake configuration.
56+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
57+
run: ctest -C ${{env.BUILD_TYPE}}
58+

0 commit comments

Comments
 (0)