Skip to content

Commit 56bab59

Browse files
committed
Add Github actions
1 parent 4c1fd97 commit 56bab59

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: continuous-integration
2+
3+
on:
4+
push:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
build:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [macos-latest, ubuntu-20.04]
15+
cxx: [g++-10, clang++]
16+
include:
17+
- os: windows-latest
18+
cxx: msvc
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Configure CMake
24+
env:
25+
CXX: ${{ matrix.cxx }}
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: ${{github.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=Debug -DCMAKE_INSTALL_PREFIX:PATH=$GITHUB_WORKSPACE/artifacts
34+
35+
- name: Build
36+
working-directory: ${{github.workspace}}/build
37+
shell: bash
38+
# Execute the build. You can specify a specific target with "--target <NAME>"
39+
run: cmake --build . --config Debug
40+
41+
- name: Test
42+
working-directory: ${{github.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 Debug
47+
48+
- name: Install
49+
working-directory: ${{github.workspace}}/build
50+
shell: bash
51+
# Use CMake to "install" build artifacts (only interested in CMake registered targets) to our custom artifacts directory
52+
run: cmake --install . --config Debug
53+
54+
# Only run last two steps if this is a release
55+
- name: Release
56+
if: github.event_name == 'release'
57+
env:
58+
CXX: ${{ matrix.cxx }}
59+
# Use a bash shell so we can use the same syntax for environment variable
60+
# access regardless of the host operating system
61+
shell: bash
62+
working-directory: ${{github.workspace}}/build
63+
# Note the current convention is to use the -S and -B options here to specify source
64+
# and build directories, but this is only available with CMake 3.13 and higher.
65+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
66+
run: |
67+
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=$GITHUB_WORKSPACE/artifacts
68+
cmake --build . --config Release
69+
cmake --install . --config Release
70+
71+
# Only Upload releases
72+
- name: Upload
73+
if: github.event_name == 'release'
74+
uses: actions/upload-artifact@v2
75+
with:
76+
name: build_${{ github.sha }}_${{ matrix.os }}_${{ matrix.cxx }}
77+
path: ${{github.workspace}}/artifacts

0 commit comments

Comments
 (0)