-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
142 lines (115 loc) · 4.62 KB
/
appveyor.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
version: '1.0.{build}'
image: ubuntu1804
matrix:
fast_finish: true
configuration:
- Debug
- Release
environment:
CLANG_VERSION: 10
CPP_CHECK_OUTPUT_FILE: cppcheck_output.xml
GTEST_OUTPUT_FILE: gtest_output.xml
GOOGLEBENCHMARK_OUTPUT_FILE: googlebenchmark_output.csv
LCOV_OUTPUT_FILE: lcov.info
LCOV_TEST_DIRECTORY: experimental/tests/CMakeFiles/test_experimental.dir/tests
PYTHON_MAJOR_VERSION: 3
UPDATE_ALTERNATIVE_PRIORITY: 9999
matrix:
- COMPILER: gcc
COMPILER_CPP: g++
COMPILER_VERSION: 10
- COMPILER: clang
COMPILER_CPP: clang++
COMPILER_VERSION: ${CLANG_VERSION}
install:
# Compilers
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update -y
- sudo apt-get install ${COMPILER}-${COMPILER_VERSION} ${COMPILER_CPP}-${COMPILER_VERSION} -y
- |
if [ "clang" == "${COMPILER}" ]; then
sudo update-alternatives --remove-all ${COMPILER}
sudo update-alternatives --remove-all ${COMPILER_CPP}
fi
- sudo update-alternatives --install /usr/bin/${COMPILER} ${COMPILER} /usr/bin/${COMPILER}-${COMPILER_VERSION} ${UPDATE_ALTERNATIVE_PRIORITY} --slave /usr/bin/${COMPILER_CPP} ${COMPILER_CPP} /usr/bin/${COMPILER_CPP}-${COMPILER_VERSION}
# Python
- sudo apt-get install python${PYTHON_MAJOR_VERSION}-pip -y
- pip${PYTHON_MAJOR_VERSION} install pandas
- pip${PYTHON_MAJOR_VERSION} install matplotlib
# Coverage
- |
if [ "gcc" == "${COMPILER}" ]; then
git clone https://github.com/linux-test-project/lcov.git
cd lcov && sudo make install && cd .. && rm -rf lcov
fi
# Static analysis
- sudo apt-get install cppcheck -y
- sudo apt-get install clang-tidy-${CLANG_VERSION} -y
- sudo ln -s /usr/bin/clang-tidy-${CLANG_VERSION} /usr/bin/clang-tidy
- sudo apt-get install clang-format-${CLANG_VERSION} -y
- sudo ln -s /usr/bin/clang-format-${CLANG_VERSION} /usr/bin/clang-format
- appveyor AddMessage 'Install succeed!' -Category Information
before_build:
# Debug logs
- lsb_release -a
- ldd --version
- ld -v
- ${COMPILER_CPP} -v
- cmake --version
- cppcheck --version
- ulimit -a
- env
# cmake
- git submodule update --init --recursive
- mkdir build && cd build
- export GTEST_OUTPUT="xml:${PWD}/${GTEST_OUTPUT_FILE}"
- cmake -DCMAKE_CXX_COMPILER=/usr/bin/${COMPILER_CPP} -DCMAKE_BUILD_TYPE=${CONFIGURATION} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
build_script:
- make -j8 VERBOSE=1
- appveyor AddMessage 'Build succeed!' -Category Information
after_build:
- make cppcheck-deprecated 2> ${PWD}/${CPP_CHECK_OUTPUT_FILE}
- appveyor PushArtifact ${PWD}/${CPP_CHECK_OUTPUT_FILE}
- |
make clang-format-xml | grep "<replacement "
if [ 1 -ne $? ]; then
echo "Formatting change required by clang-format!"
exit 1
fi
- |
if [ "clang" == "${COMPILER}" ]; then
make clang-tidy &> clang-tidy_output.log
appveyor PushArtifact ${PWD}/clang-tidy_output.log
fi
- appveyor AddMessage 'Static analysis succeed!' -Category Information
test_script:
- ctest -V
- python3 ../appveyor/upload_gtest_result.py --gtest_xml=${PWD}/${GTEST_OUTPUT_FILE}
- appveyor PushArtifact ${PWD}/${GTEST_OUTPUT_FILE}
- appveyor AddMessage 'Tests succeed!' -Category Information
after_test:
# Coverage
- |
if [ "Debug" == "${CONFIGURATION}" ]; then
if [ "gcc" == "${COMPILER}" ]; then
lcov --gcov-tool /usr/bin/gcov-${COMPILER_VERSION} -c -d ${PWD}/${LCOV_TEST_DIRECTORY}/ -o ${LCOV_OUTPUT_FILE}
lcov --gcov-tool /usr/bin/gcov-${COMPILER_VERSION} --remove ${LCOV_OUTPUT_FILE} '/usr/include/*' '*/external/*' -o ${LCOV_OUTPUT_FILE}
mkdir gcov_report
genhtml ${LCOV_OUTPUT_FILE} -o ${PWD}/gcov_report/
zip -r gcov_report.zip gcov_report/
appveyor PushArtifact gcov_report.zip
elif [ "clang" == "${COMPILER}" ]; then
llvm-profdata-${CLANG_VERSION} merge -output=llvm-cov.profdata ${PWD}/experimental/tests/default.profraw
llvm-cov-${CLANG_VERSION} show -format=html -instr-profile=llvm-cov.profdata ./bin/test_experimental > llvm-cov_report.html
zip llvm-cov_report.zip llvm-cov_report.html
appveyor PushArtifact ${PWD}/llvm-cov_report.zip
fi
fi
# Benchmark
- |
if [ "Release" == "${CONFIGURATION}" ]; then
./bin/benchmark_${APPVEYOR_PROJECT_NAME} --benchmark_out=${PWD}/${GOOGLEBENCHMARK_OUTPUT_FILE} --benchmark_out_format=csv
python3 ../appveyor/upload_googlebenchmark_result.py --googlebenchmark_csv=${PWD}/${GOOGLEBENCHMARK_OUTPUT_FILE}
appveyor PushArtifact ${PWD}/${GOOGLEBENCHMARK_OUTPUT_FILE}
appveyor AddMessage 'Benchmark succeed!' -Category Information
fi