-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
172 lines (153 loc) · 8.47 KB
/
.travis.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
##################################################################################
# #
# MIT License #
# #
# Copyright (c) 2020 Boubacar DIENE #
# #
# This file is part of NetworkService project #
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy #
# of this software and associated documentation files (the "Software"), to deal #
# in the Software without restriction, including without limitation the rights #
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell #
# copies of the Software, and to permit persons to whom the Software is #
# furnished to do so, subject to the following conditions: #
# #
# The above copyright notice and this permission notice shall be included in all #
# copies or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #
# SOFTWARE. #
# #
##################################################################################
# COVERITY_SCAN_TOKEN
# pip install travis
# cd <path_to>/NetworkService
# travis encrypt COVERITY_SCAN_TOKEN="<see https://scan.coverity.com for value>"
env:
global:
secure: "nEIqQV0B7HXI9jBoBabN7Mu5Ujej8+zZD5e9h6OB54HXA4DdSlDVczJecvKXQCBmBdUV/a1J4tWWU0w4a1bydeKkZHkLhfGpKILwLghHIXSzsX4ZqWOAreksoAGwe5CJBcLUaAxsgg3MrjNsRoS2G8XMNDmt2FujVBWhzTmbOcu4aCwijIVSgGtl6oIwepzW9AgQ/Fj3zZEJcWORZ+Za4xMWA8LEOFYliuC+TxMaEQbvgEBUu3Afta/cahIj3LHkNN1MPkvEYU9vo7JzoEP1hXe3BsX5Vfkwgh08VeAhcdvm9T0koK+qdqSe3br0Lbxv1Isr2AQINSa5kD3sfS1JI6wneGZHgULHDARN0Tfj6BP4AD+DKJbcld/lEg7FEnaoNjK8XhAk5s5T+wyugWxV3ezYqdMH+p8M9XuF1+9YiNIN7T8MsUxV1idcL22ccSfuWAgopNmRLXwqtEgsKZeGSt/Kul5JUfyjfXS8YAUm66VnOzsVNxaHcghp45W2F2KHjs6LvIrcDjBYHvWmJ0C/0rcSYyH60chHIx2yWC7VBAjo8hpZoH5nyOMz106WYG0hGLaKIPqXotHeaKYWtavCL29UsU7rGbD6aEcZprG9rJI3Z+WaeDbA8smOn77CuNiqDq7xpPLKIZczL1yM0lPerwbrTXDCh7kCZDDYoZZ6Oek="
# Language C++
language: cpp
# Ubuntu 18.04
dist: bionic
# Using docker to build the project
services:
- docker
# Generate docker image from ci/Dockerfile
before_install:
- docker build -t networkservice-image ci
# Checks to ensure that the commit/pull passed basic tests
before_script:
# Git - Make sure there is no whitespace
- |
if [[ -n $(git diff --check HEAD^) ]]; then
echo "Please, fix whitespaces (see below)"
echo ""
git diff --check HEAD^
exit -1
fi
# Make sure doxygen comments are correctly written
- docker run --privileged -it -u $(id -u) --rm -v $(pwd):/workdir networkservice-image:latest
-c "mkdir -p build && cd build;
cmake .. -DCMAKE_INSTALL_PREFIX=./out -DDOXYGEN_WARN_AS_ERROR=NO;
make doc && make install;"
- |
if [[ -s build/doc/doxygen_warnings.txt ]]; then
echo "Please, fix doxygen comments (see below)"
echo ""
cat build/doc/doxygen_warnings.txt
exit -1
fi
# Make sure code formatting is correct
- docker run --privileged -it -u $(id -u) --rm -v $(pwd):/workdir networkservice-image:latest
-c "mkdir -p build && cd build;
cmake .. -DCMAKE_INSTALL_PREFIX=./out; make clang-format;"
- |
if [[ -n $(git diff) ]]; then
echo "Please, fix code formatting (see below)"
echo ""
git diff
exit -1
fi
# Make sure static analysis/linting see no error
- docker run --privileged -it -u $(id -u) --rm -v $(pwd):/workdir networkservice-image:latest
-c "mkdir -p build && cd build;
cmake .. -DCMAKE_INSTALL_PREFIX=./out; make clang-tidy;"
- |
if [[ -n $(grep "warning: " build/clang_tidy_output.txt) ]] \
|| [[ -n $(grep "error: " build/clang_tidy_output.txt) ]]; then
echo "Please, fix programming issues (see below)"
echo ""
grep --color -E '^|warning: |error: ' build/clang_tidy_output.txt
exit -1;
fi
# Checks to ensure that the software compiles in all configurations
script:
# Build FAKE version (Debug build)
- docker run --privileged -it -u $(id -u) --rm -v $(pwd):/workdir networkservice-image:latest
-c "mkdir -p build && cd build;
cmake .. -DCMAKE_INSTALL_PREFIX=./out -DCMAKE_BUILD_TYPE=Debug -DENABLE_IWYU=ON -DCONFIG_LOADER=fake;
make && make install;"
# Build FAKE version (Release build)
- docker run --privileged -it -u $(id -u) --rm -v $(pwd):/workdir networkservice-image:latest
-c "mkdir -p build && cd build;
cmake .. -DCMAKE_INSTALL_PREFIX=./out -DCMAKE_BUILD_TYPE=Release -DCONFIG_LOADER=fake;
make && make install;"
# Build JSON version (Debug build)
- docker run --privileged -it -u $(id -u) --rm -v $(pwd):/workdir networkservice-image:latest
-c "mkdir -p build && cd build;
cmake .. -DCMAKE_INSTALL_PREFIX=./out -DCMAKE_BUILD_TYPE=Debug -DENABLE_IWYU=ON -DCONFIG_LOADER=json;
make && make install;"
# Build JSON version (Release build)
- docker run --privileged -it -u $(id -u) --rm -v $(pwd):/workdir networkservice-image:latest
-c "mkdir -p build && cd build;
cmake .. -DCMAKE_INSTALL_PREFIX=./out -DCMAKE_BUILD_TYPE=Release -DCONFIG_LOADER=json;
make && make install;"
# Run "analysis" target (=> dependency graph, clang-format and clang-tidy)
- docker run --privileged -it -u $(id -u) --rm -v $(pwd):/workdir networkservice-image:latest
-c "mkdir -p build && cd build;
cmake .. -DCMAKE_INSTALL_PREFIX=./out -DCMAKE_BUILD_TYPE=Debug -DCONFIG_LOADER=json;
make analysis && make install;"
# Build and run unit tests
- docker run --privileged -it -u $(id -u) --rm -v $(pwd):/workdir networkservice-image:latest
-c "mkdir -p build && cd build;
cmake .. -DCMAKE_INSTALL_PREFIX=./out -DCMAKE_BUILD_TYPE=Debug -DENABLE_UNIT_TESTING=ON;
make && ctest -V;"
after_script:
# Coverity scan
- wget https://scan.coverity.com/download/linux64 --post-data "token=$COVERITY_SCAN_TOKEN&project=BoubacarDiene%2FNetworkService" -O coverity_tool.tgz
- mkdir coverity_tool && tar xf coverity_tool.tgz -C coverity_tool --strip-components=1
- docker run --privileged -it -u $(id -u) --rm -v $(pwd):/workdir networkservice-image:latest
-c "mkdir -p coverityBuild && cd coverityBuild;
cmake .. -DCMAKE_INSTALL_PREFIX=./out -DCMAKE_BUILD_TYPE=Release;
../coverity_tool/bin/cov-build --dir cov-int make;
tar czvf cov-int.tgz cov-int;"
- curl --form token=$COVERITY_SCAN_TOKEN
--form [email protected]
--form file=@coverityBuild/cov-int.tgz
--form version="master"
--form description=""
https://scan.coverity.com/builds?project=BoubacarDiene%2FNetworkService
# Code coverage
after_success:
- docker run --privileged -it -u $(id -u) --rm -v $(pwd):/workdir -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" -e TRAVIS_BRANCH="$TRAVIS_BRANCH" networkservice-image:latest
-c "cd build;
coveralls -r .. -i src --exclude build/_deps --exclude build/CMakeFiles --gcov-options '\-lp' --verbose"
# Deploy documentation
# See https://docs.travis-ci.com/user/deployment/pages/
# https://github.com/EmaroLab/docs/wiki/Automatic-deployment-Doxygen-documentation
before_deploy:
- cp build/out/share/dependency-graph/dependency_graph.png build/out/share/doc/html/.
deploy:
provider: pages
skip_cleanup: true
local_dir: build/out/share/doc/html
github_token: $GH_REPO_TOKEN
on:
branch: master