-
Notifications
You must be signed in to change notification settings - Fork 10
181 lines (146 loc) · 5.51 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: build
on:
pull_request:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- build_type: Debug
- build_type: Release
env:
EXTERNAL_ROOT: /home/runner/3party
BUILD_TYPE: ${{ matrix.build_type }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install latest Boost
shell: bash
run: |
sudo apt-add-repository ppa:mhier/libboost-latest
sudo apt install libboost1.74-dev
- name: Install dependencies from source
run: .ci/fetch_system_dependencies.sh
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/telnetpp/build
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/telnetpp/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH=$EXTERNAL_ROOT -DTELNETPP_WITH_ZLIB=True
- name: Build
shell: bash
working-directory: ${{runner.workspace}}/telnetpp/build
run: cmake --build . --config $BUILD_TYPE
- name: Test
working-directory: ${{runner.workspace}}/telnetpp/build
shell: bash
run: ctest -C $BUILD_TYPE
build-coverage:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- build_type: Debug
env:
EXTERNAL_ROOT: /home/runner/3party
BUILD_TYPE: ${{ matrix.build_type }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install latest Boost
shell: bash
run: |
sudo apt-add-repository ppa:mhier/libboost-latest
sudo apt install libboost1.74-dev
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
# Build a cache for LCOV.
- name: Cache lcov
uses: actions/cache@v2
with:
path: ~/.lcov
key: lcov-cache-${{ steps.extract_branch.outputs.branch }}
restore-keys: |
lcov-cache-master
- name: Install LCOV
shell: bash
run: |
if [ ! -f "$HOME/.lcov/usr/local/bin/lcov" ]; then
mkdir $HOME/.lcov-build || true;
cd $HOME/.lcov-build;
wget https://github.com/linux-test-project/lcov/releases/download/v1.16/lcov-1.16.tar.gz;
tar -xzf lcov-1.16.tar.gz;
mkdir -p $HOME/.lcov || true;
DESTDIR=$HOME/.lcov make -C lcov-1.16/ install;
fi
echo "##[set-output name=bin;]$(echo $HOME/.lcov/usr/local/bin/lcov)"
id: lcov
- name: Install dependencies from source
run: .ci/fetch_system_dependencies.sh
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/telnetpp/build
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/telnetpp/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH=$EXTERNAL_ROOT -DTELNETPP_WITH_ZLIB=True -DTELNETPP_COVERAGE=True
- name: Build
shell: bash
working-directory: ${{runner.workspace}}/telnetpp/build
run: cmake --build . --config $BUILD_TYPE
- name: Zero test counters
shell: bash
run: ${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-11 --base-directory ${{runner.workspace}}/telnetpp/build --directory ${{runner.workspace}}/telnetpp/build --zerocounters -q
- name: Test
working-directory: ${{runner.workspace}}/telnetpp/build
shell: bash
run: ctest -C $BUILD_TYPE
- name: Calculate coverage
shell: bash
run: |
${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-11 --base-directory ${{runner.workspace}}/telnetpp/build --directory ${{runner.workspace}}/telnetpp/build --capture --output-file coverage.info;
${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-11 --remove coverage.info '*/test/*' '/usr/*' '*/3party/*' --output-file coverage.info;
${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-11 --list coverage.info;
- name: Post coverage to coveralls
uses: coverallsapp/github-action@master
with:
path-to-lcov: coverage.info
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Post coverage to Codacy
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.info
build-docs:
runs-on: ubuntu-latest
# Only build documentation for valid builds on master.
needs: [build]
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install Doxygen
shell: bash
run: sudo apt install doxygen
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/telnetpp/build
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/telnetpp/build
run: cmake $GITHUB_WORKSPACE -DTELNETPP_DOC_ONLY=True
- name: Build
working-directory: ${{runner.workspace}}/telnetpp/build
shell: bash
run: cmake --build . --target telnetpp_doc
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{runner.workspace}}/telnetpp/build/html