Skip to content

Commit 4a9130e

Browse files
authored
Create cmake.yml
1 parent fe8504f commit 4a9130e

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/cmake.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CMake
2+
3+
on: [push]
4+
5+
env:
6+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
7+
BUILD_TYPE: Release
8+
9+
jobs:
10+
build:
11+
# The CMake configure and build commands are platform agnostic and should work equally
12+
# well on Windows or Mac. You can convert this to a matrix build if you need
13+
# cross-platform coverage.
14+
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Create Build Environment
21+
# Some projects don't allow in-source building, so create a separate build directory
22+
# We'll use this as our working directory for all subsequent commands
23+
run: sudo apt-get update -y
24+
run: sudo apt-get upgrade -y
25+
run: sudo apt-get install libeigen3-dev
26+
run: cmake -E make_directory ${{runner.workspace}}/build
27+
28+
- name: Configure CMake
29+
# Use a bash shell so we can use the same syntax for environment variable
30+
# access regardless of the host operating system
31+
shell: bash
32+
working-directory: ${{runner.workspace}}/build
33+
# Note the current convention is to use the -S and -B options here to specify source
34+
# and build directories, but this is only available with CMake 3.13 and higher.
35+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
36+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
37+
38+
- name: Build
39+
working-directory: ${{runner.workspace}}/build
40+
shell: bash
41+
# Execute the build. You can specify a specific target with "--target <NAME>"
42+
run: cmake --build . --config $BUILD_TYPE
43+
44+
- name: Test
45+
working-directory: ${{runner.workspace}}/build
46+
shell: bash
47+
# Execute tests defined by the CMake configuration.
48+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
49+
run: ctest -C $BUILD_TYPE

0 commit comments

Comments
 (0)