Skip to content

Commit 72310ae

Browse files
authored
Merge pull request #1 from WeiJiLab/github-action-test
Create a Github action
2 parents 436dc4d + 07d3cd5 commit 72310ae

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.github/workflows/cmake.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CMake
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
pull_request:
8+
branches:
9+
- develop
10+
11+
env:
12+
BUILD_TYPE: RelWithDebInfo
13+
# Conan cache environment variables
14+
CONAN_SYSREQUIRES_MODE: enabled
15+
CONAN_USER_HOME: "${{ github.workspace }}/conan-cache"
16+
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short"
17+
18+
jobs:
19+
build:
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
24+
runs-on: ${{ matrix.os }}
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
29+
- name: Cache
30+
uses: actions/cache@v2
31+
env:
32+
cache-name: cache-conan-modules
33+
with:
34+
path: |
35+
${{ env.CONAN_USER_HOME }}
36+
~/.cache/pip
37+
key: ${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('cmake/Conan.cmake') }}
38+
39+
- name: Get Conan
40+
uses: turtlebrowser/[email protected]
41+
42+
- name: Configure CMake
43+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
44+
45+
- name: Build
46+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
47+
48+
- name: Test
49+
working-directory: ${{github.workspace}}/build
50+
run: ctest -C ${{env.BUILD_TYPE}}

rest/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ if(WIN32)
1010
target_compile_definitions(rest PRIVATE _WIN32_WINNT=0x0601)
1111
endif()
1212

13+
set(THREADS_PREFER_PTHREAD_FLAG ON)
14+
find_package(Threads REQUIRED)
15+
target_link_libraries(rest PRIVATE Threads::Threads)
16+
1317
target_link_libraries(rest PUBLIC controller)

0 commit comments

Comments
 (0)