-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
151 lines (135 loc) · 4.93 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
# Use minimal image as base to avoid overriding environment variables.
language: minimal
os: linux
dist: focal
stages:
- check
- test
- coverage
- name: deploy
if: branch = main
matrix:
include:
#----------------------------------------------------------------------------
# Check Stage
# We run some linters and code formatters to check our code base. If this
# already fails, we can skip others stages.
#----------------------------------------------------------------------------
# Travis CI has integrated ShellCheck by default.
- name: "shellcheck linting"
stage: check
language: shell
before_script:
- shellcheck --version
script:
- ./tools/run_shellcheck.sh
- name: "cmake-format check"
stage: check
language: python
python: ['3.8']
addons: { apt: { packages: ['python3-setuptools', 'python3-pip'] } }
install:
- pip install cmake_format
before_script:
- cmake-format --version
script:
- ./tools/run_cmake_format.sh
- git diff --diff-filter=M --color | cat
- git diff --diff-filter=M --quiet || (echo "Found unformatted CMakeLists.txt! Use cmake-format!"; exit 1)
- name: "clang-tidy linting"
stage: check
env: CC=clang-12 CXX=clang++-12
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
# install modern gcc for std lib
- sudo apt install clang-12 clang-tidy-12 g++-11
before_script:
- cd tools
script:
- ./build_run_clang_tidy.sh
- git diff --diff-filter=M --color | cat
- git diff --diff-filter=M --quiet || (echo "Found fixable errors! Use clang-tidy!"; exit 1)
- name: "cppcheck linting"
stage: check
addons: { apt: { packages: ['cppcheck'] } }
before_script:
- cppcheck --version
script:
- ./tools/run_cppcheck.sh
#----------------------------------------------------------------------------
# Test Stage
# Build and test our application on macOS and linux. All stages have the
# script job in common (see end of this yml).
#----------------------------------------------------------------------------
# macOS build and test using system's clang. Dependencies are installed
# using the Homebrew addon, though "brew install ABC" works as well.
- name: "macOS clang"
stage: test
os: osx
osx_image: xcode10
compiler: clang
# Linux build and test using gcc-11. Dependencies are installed using the APT
# addon, though "apt-get install ABC" works as well.
- name: "linux build with GCC 11"
stage: test
env: CC=gcc-11 CXX=g++-11
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt install gcc-11 g++-11 python3-setuptools python3-pip
install:
- pip3 install cmake
- name: "linux build with GCC 10"
stage: test
env: CC=gcc-10 CXX=g++-10
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt install gcc-10 g++-10 python3-setuptools python3-pip
install:
- pip3 install cmake
# Windows build and test. Windows support is currently in beta on Travis.
# CMake and MinGw are installed by default.
#
# TODO: Chocolatey has too many time outs.
#
# - name: "Windows GCC builds"
# stage: test
# os: windows
# language: cpp
# compiler: gcc
# # env:
# # - CMAKE_GENERATOR_OVERRIDE="Visual Studio 15 2017 Win64"
# script:
# - echo "CC=$CC"
# - echo "CXX=$CXX"
# - cmake -DCMAKE_BUILD_TYPE=Debug -G "MinGW Makefiles" -DCMAKE_SH="CMAKE_SH-NOTFOUND" .. &&
# cmake --build . -j 2 &&
# ctest -j2
#----------------------------------------------------------------------------
# Coverage Stage
# Builds targets with "--coverage" and uses lcov to generate a coverage
# report.
#----------------------------------------------------------------------------
# Linux coverage build and test execution using gcc-11.
- name: "linux coverage run"
stage: coverage
env: CC=gcc-11 CXX=g++-11
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt install gcc-11 g++-11 python3-setuptools python3-pip
install:
# I had to many issues with older versions of lcov; use latest
- git clone https://github.com/linux-test-project/lcov.git &&
( cd lcov && sudo make install )
- sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-11 10
- pip3 install cmake
script:
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON &&
make -j$(nproc) &&
make coverage
- bash <(curl -s https://codecov.io/bash) -f coverage-filtered.info || echo "Codecov did not collect coverage reports"
before_script:
- mkdir build && cd $_
script:
- cmake -DCMAKE_BUILD_TYPE=Debug .. &&
cmake --build . -j $(nproc) --config "Debug" &&
ctest -j2