Skip to content

Commit 8d27481

Browse files
committed
feat: CI build for GitHub actions
CI build workflow for GitHub actions.
1 parent 8cb2a85 commit 8d27481

4 files changed

Lines changed: 256 additions & 232 deletions

File tree

.circleci/config.yml

Lines changed: 0 additions & 232 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# The Reactive C++ Toolbox.
2+
# Copyright (C) 2020 Reactive Markets Limited
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
---
16+
name: CI Build
17+
18+
on:
19+
pull_request:
20+
branches:
21+
- master
22+
23+
jobs:
24+
lint:
25+
runs-on: ubuntu-latest
26+
container: reactivemarkets/toolchain-cpp:debian
27+
steps:
28+
- name: Checkout project
29+
uses: actions/checkout@v2
30+
31+
- name: Configure project
32+
run: |
33+
mkdir -p build
34+
cd build
35+
cmake .. -G "Unix Makefiles" \
36+
-DCMAKE_C_COMPILER=gcc-8 \
37+
-DCMAKE_CXX_COMPILER=g++-8
38+
39+
- name: Run cppcheck
40+
run: cd build && make -j2 cppcheck
41+
42+
- name: Run clang-format
43+
run: cd build && make clang-format &&
44+
[[ -z "$(git status --porcelain)" ]] ||
45+
{ echo "Please ensure files are formated by running target clang-format"; exit 1; }
46+
47+
test:
48+
runs-on: ubuntu-latest
49+
container: reactivemarkets/toolchain-cpp:debian
50+
needs: lint
51+
52+
strategy:
53+
matrix:
54+
build_type: [Debug, Release]
55+
compiler:
56+
- {cc: clang-7, cxx: clang++-7}
57+
- {cc: gcc-8, cxx: g++-8}
58+
59+
steps:
60+
- name: Checkout project
61+
uses: actions/checkout@v2
62+
63+
- name: Configure project
64+
run: |
65+
mkdir -p build
66+
cd build
67+
cmake .. -G "Unix Makefiles" \
68+
-DTOOLBOX_BUILD_SHARED=ON \
69+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
70+
-DCMAKE_C_COMPILER=${{ matrix.compiler.cc }} \
71+
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }}
72+
73+
- name: Build project
74+
run: cd build && VERBOSE=1 make -j2 all
75+
76+
- name: Run tests
77+
run: cd build && VERBOSE=1 make -j2 test

.github/workflows/gh-pages.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# The Reactive C++ Toolbox.
2+
# Copyright (C) 2020 Reactive Markets Limited
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
---
16+
name: GH Pages
17+
18+
on:
19+
push:
20+
branches:
21+
- master
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
container: reactivemarkets/toolchain-cpp:debian
27+
28+
strategy:
29+
matrix:
30+
build_type: [Release]
31+
compiler:
32+
- {cc: gcc-8, cxx: g++-8}
33+
34+
steps:
35+
- name: Checkout project
36+
uses: actions/checkout@v2
37+
38+
- name: Set release version
39+
run: |
40+
release_tag=$(echo ${GITHUB_REF##*/})
41+
echo ::set-env name=RELEASE_TAG::$release_tag
42+
echo ::set-env name=RELEASE_VERSION::$(echo $release_tag | sed "s,^v,,")
43+
44+
- name: Configure project
45+
run: |
46+
mkdir -p build
47+
cd build
48+
cmake .. -G "Unix Makefiles" \
49+
-DTOOLBOX_BUILD_SHARED=ON \
50+
-DTOOLBOX_VERSION=${{ env.RELEASE_VERSION }} \
51+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
52+
-DCMAKE_C_COMPILER=${{ matrix.compiler.cc }} \
53+
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }}
54+
55+
- name: Build documentation
56+
run: cd build && make -j2 toolbox-doc
57+
58+
- name: Upload documentation
59+
uses: actions/upload-artifact@v1
60+
with:
61+
name: doc
62+
path: build/doc/html
63+
64+
publish:
65+
runs-on: ubuntu-latest
66+
needs: build
67+
68+
steps:
69+
- name: Download documentation
70+
uses: actions/download-artifact@v1
71+
with:
72+
name: doc
73+
path: build/doc/html
74+
75+
- name: Publish documentation
76+
uses: peaceiris/actions-gh-pages@v3
77+
with:
78+
github_token: ${{ secrets.GITHUB_TOKEN }}
79+
publish_dir: ./build/doc/html

0 commit comments

Comments
 (0)