Skip to content

Commit 8cee526

Browse files
authored
Migrate jobs from Travis to GH Actions (#221)
1 parent 4ccc30c commit 8cee526

File tree

3 files changed

+69
-94
lines changed

3 files changed

+69
-94
lines changed

.github/workflows/build.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Build and test
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
linux:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Install boost, curl and lcov
11+
run: |
12+
sudo apt-get update
13+
sudo apt-get install -yq libcurl4-openssl-dev libboost-system1.65-dev libboost-filesystem1.65-dev libboost-test1.65-dev libboost-program-options1.65-dev lcov
14+
- name: Run CMake
15+
run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Debug
16+
- name: Build project
17+
run: cd build && make -j
18+
- name: Test
19+
run: cd build && make test
20+
- name: Generate codecov report
21+
run: |
22+
cd build
23+
set -x
24+
lcov --directory . --capture --output-file coverage.info
25+
lcov --remove coverage.info '/opt/*' '/usr/*' --output-file coverage.info
26+
lcov --list coverage.info
27+
- uses: codecov/codecov-action@v1
28+
with:
29+
token: ${{ secrets.CODECOV_TOKEN }}
30+
file: build/coverage.info
31+
fail_ci_if_error: true
32+
macos:
33+
runs-on: macos-latest
34+
steps:
35+
- uses: actions/checkout@v2
36+
- name: Install boost
37+
run: brew install boost
38+
- name: Run CMake
39+
run: mkdir build && cd build && cmake ..
40+
- name: Build project
41+
run: cd build && make -j
42+
- name: Test
43+
run: cd build && make test

.github/workflows/format.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Clang format
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
clang-format-8:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
with:
11+
ref: ${{ github.event.pull_request.head.sha }}
12+
- name: Run clang-foramt on changed files
13+
run: |
14+
set -x
15+
git fetch origin ${{ github.event.pull_request.base.ref }}
16+
git fetch origin pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
17+
BASE_COMMIT=$(git rev-parse ${{ github.event.pull_request.base.sha }})
18+
COMMIT_FILES=$(git diff --name-only ${BASE_COMMIT} | grep -i -v LinkDef)
19+
RESULT_OUTPUT=$(git-clang-format-8 --commit ${BASE_COMMIT} --diff --binary $(which clang-format-8) ${COMMIT_FILES})
20+
if [ "$RESULT_OUTPUT" == "no modified files to format" ] || [ "$RESULT_OUTPUT" == "clang-format did not modify any files" ]; then
21+
exit 0
22+
else
23+
git-clang-format-8 --commit $BASE_COMMIT --diff --binary $(which clang-format-8)
24+
echo "$RESULT_OUTPUT"
25+
exit 1
26+
fi

.travis.yml

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

0 commit comments

Comments
 (0)