Skip to content

Commit 9ed1bc8

Browse files
Create build.yml
1 parent 5226ae4 commit 9ed1bc8

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

.github/workflows/build.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Build
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+
linux:
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: cmake -E make_directory ${{runner.workspace}}/build
24+
25+
- name: Configure CMake
26+
# Use a bash shell so we can use the same syntax for environment variable
27+
# access regardless of the host operating system
28+
shell: bash
29+
working-directory: ${{runner.workspace}}/build
30+
# Note the current convention is to use the -S and -B options here to specify source
31+
# and build directories, but this is only available with CMake 3.13 and higher.
32+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
33+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
34+
35+
- name: Build
36+
working-directory: ${{runner.workspace}}/build
37+
shell: bash
38+
# Execute the build. You can specify a specific target with "--target <NAME>"
39+
run: cmake --build . --config $BUILD_TYPE
40+
41+
- name: Test
42+
working-directory: ${{runner.workspace}}/build
43+
shell: bash
44+
# Execute tests defined by the CMake configuration.
45+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
46+
run: ctest -C $BUILD_TYPE
47+
macOS:
48+
# The CMake configure and build commands are platform agnostic and should work equally
49+
# well on Windows or Mac. You can convert this to a matrix build if you need
50+
# cross-platform coverage.
51+
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
52+
runs-on: macos-latest
53+
54+
steps:
55+
- uses: actions/checkout@v2
56+
57+
- name: Create Build Environment
58+
# Some projects don't allow in-source building, so create a separate build directory
59+
# We'll use this as our working directory for all subsequent commands
60+
run: cmake -E make_directory ${{runner.workspace}}/build
61+
62+
- name: Configure CMake
63+
# Use a bash shell so we can use the same syntax for environment variable
64+
# access regardless of the host operating system
65+
shell: bash
66+
working-directory: ${{runner.workspace}}/build
67+
# Note the current convention is to use the -S and -B options here to specify source
68+
# and build directories, but this is only available with CMake 3.13 and higher.
69+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
70+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
71+
72+
- name: Build
73+
working-directory: ${{runner.workspace}}/build
74+
shell: bash
75+
# Execute the build. You can specify a specific target with "--target <NAME>"
76+
run: cmake --build . --config $BUILD_TYPE
77+
78+
- name: Test
79+
working-directory: ${{runner.workspace}}/build
80+
shell: bash
81+
# Execute tests defined by the CMake configuration.
82+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
83+
run: ctest -C $BUILD_TYPE
84+
windows:
85+
# The CMake configure and build commands are platform agnostic and should work equally
86+
# well on Windows or Mac. You can convert this to a matrix build if you need
87+
# cross-platform coverage.
88+
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
89+
runs-on: windows-latest
90+
91+
steps:
92+
- uses: actions/checkout@v2
93+
94+
- name: Create Build Environment
95+
# Some projects don't allow in-source building, so create a separate build directory
96+
# We'll use this as our working directory for all subsequent commands
97+
run: cmake -E make_directory ${{runner.workspace}}/build
98+
99+
- name: Configure CMake
100+
# Use a bash shell so we can use the same syntax for environment variable
101+
# access regardless of the host operating system
102+
shell: bash
103+
working-directory: ${{runner.workspace}}/build
104+
# Note the current convention is to use the -S and -B options here to specify source
105+
# and build directories, but this is only available with CMake 3.13 and higher.
106+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
107+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
108+
109+
- name: Build
110+
working-directory: ${{runner.workspace}}/build
111+
shell: bash
112+
# Execute the build. You can specify a specific target with "--target <NAME>"
113+
run: cmake --build . --config $BUILD_TYPE
114+
115+
- name: Test
116+
working-directory: ${{runner.workspace}}/build
117+
shell: bash
118+
# Execute tests defined by the CMake configuration.
119+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
120+
run: ctest -C $BUILD_TYPE
121+
122+
123+

0 commit comments

Comments
 (0)