Skip to content

Commit d1f539f

Browse files
committed
Merge pull request #17 from DCM-UPB/travis
TravisCI and more
2 parents 89d98f3 + 0c6d877 commit d1f539f

File tree

9 files changed

+114
-8
lines changed

9 files changed

+114
-8
lines changed

.travis.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
dist: xenial
2+
language: c++
3+
services:
4+
- docker
5+
6+
addons:
7+
apt:
8+
packages:
9+
- cmake
10+
- valgrind
11+
- python-pip
12+
13+
homebrew:
14+
packages:
15+
- cmake
16+
- valgrind
17+
18+
matrix:
19+
include:
20+
- os: linux // travis ubuntu xenial
21+
env:
22+
- MYCXX="g++"
23+
- USE_DOCKER="FALSE"
24+
- USE_GCOV="TRUE"
25+
26+
- os: linux // arch linux docker
27+
env:
28+
- MYCXX="g++"
29+
- USE_DOCKER="TRUE"
30+
- USE_GCOV="FALSE"
31+
32+
- os: osx
33+
osx_image: xcode10.1
34+
env:
35+
- MYCXX="g++"
36+
- USE_DOCKER="FALSE"
37+
- USE_GCOV="FALSE"
38+
39+
- os: osx
40+
osx_image: xcode10.1
41+
env:
42+
- MYCXX="clang++"
43+
- USE_DOCKER="FALSE"
44+
- USE_GCOV="FALSE"
45+
46+
before_install:
47+
- |
48+
if [[ "$USE_DOCKER" == "TRUE" ]]; then
49+
docker pull nnvmc/base;
50+
else
51+
${MYCXX} -v;
52+
fi;
53+
echo "CXX_COMPILER=${MYCXX}" >> config.sh;
54+
echo "CXX_FLAGS=\"-O0 -g -Wall -Wno-unused-function ${configopt}\"" >> config.sh;
55+
if [[ "$USE_GCOV" == "TRUE" ]]; then echo "USE_COVERAGE=1" >> config.sh;
56+
else
57+
echo "USE_COVERAGE=0" >> config.sh;
58+
fi;
59+
60+
script:
61+
- |
62+
if [[ "$USE_DOCKER" == "TRUE" ]]; then
63+
docker run -it -v $(pwd):/root/repo nnvmc/base /bin/bash -c "cd /root/repo && ./build.sh" || exit 1;
64+
else
65+
./build.sh || exit 1;
66+
fi;
67+
- |
68+
if [[ "$USE_DOCKER" == "TRUE" ]]; then
69+
if [[ "$USE_GCOV" == "TRUE" ]]; then
70+
docker run -it -v $(pwd):/root/repo nnvmc/base /bin/bash -c "cd /root/repo/test && ./run.sh";
71+
docker run -e TRAVIS=$TRAVIS -e TRAVIS_JOB_ID=$TRAVIS_JOB_ID -it -v $(pwd):/root/repo nnvmc/base /bin/bash -c "pip install cpp-coveralls && cd /root/repo/build && coveralls --verbose -b ./ -r ../ -i include -i src -x .cpp -x .hpp --gcov-options '\-lp'";
72+
else
73+
docker run -it -v $(pwd):/root/repo nnvmc/base /bin/bash -c "cd /root/repo/test && ./run.sh";
74+
fi;
75+
else
76+
if [[ "$USE_GCOV" == "TRUE" ]]; then
77+
cd build && make test && cd .. ;
78+
pip install --user cpp-coveralls && cd build && coveralls --verbose -b ./ -r ../ -i include -i src -x .cpp -x .hpp --gcov-options '\-lp';
79+
else
80+
cd test && ./run.sh && cd .. ;
81+
fi;
82+
fi;
83+
84+
notifications:
85+
email:
86+
on_success: change
87+
on_failure: change

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
88
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
99
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${USER_CXX_FLAGS}")
1010

11+
if (USE_COVERAGE)
12+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
13+
endif()
14+
1115
# find packages
12-
message(STATUS "Configured CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
13-
message(STATUS "Configured CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
1416

1517
find_package(MPI)
1618
if (MPI_FOUND)
@@ -20,6 +22,9 @@ if (MPI_FOUND)
2022
message(STATUS "MPI_CXX_LIBRARIES: ${MPI_CXX_LIBRARIES}")
2123
endif()
2224

25+
message(STATUS "Configured CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
26+
message(STATUS "Configured CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
27+
2328
# set header / library paths
2429
include_directories(include/) # headers
2530

@@ -29,4 +34,3 @@ enable_testing()
2934
add_subdirectory(src)
3035
add_subdirectory(test)
3136
add_subdirectory(examples)
32-

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[![Build Status](https://travis-ci.com/DCM-UPB/MCIntegratorPlusPlus.svg?branch=master)](https://travis-ci.com/DCM-UPB/MCIntegratorPlusPlus)
2+
[![Coverage Status](https://coveralls.io/repos/github/DCM-UPB/MCIntegratorPlusPlus/badge.svg?branch=master)](https://coveralls.io/github/DCM-UPB/MCIntegratorPlusPlus?branch=master)
3+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/4fb9f98862c7474b86c8ef88b501b454)](https://www.codacy.com/app/NNVMC/MCIntegratorPlusPlus?utm_source=github.com&utm_medium=referral&utm_content=DCM-UPB/MCIntegratorPlusPlus&utm_campaign=Badge_Grade)
4+
[![CodeFactor](https://www.codefactor.io/repository/github/dcm-upb/mcintegratorplusplus/badge)](https://www.codefactor.io/repository/github/dcm-upb/mcintegratorplusplus)
15

26
# MCIntegrator++
37

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
. ./config.sh
33
mkdir -p build
44
cd build
5-
cmake -DCMAKE_CXX_COMPILER="${CXX_COMPILER}" -DUSER_CXX_FLAGS="${CXX_FLAGS}" ..
5+
cmake -DCMAKE_CXX_COMPILER="${CXX_COMPILER}" -DUSER_CXX_FLAGS="${CXX_FLAGS}" -DUSE_COVERAGE="${USE_COVERAGE}" ..
66
make

config_template.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
#C++ compiler
44
CXX_COMPILER="g++"
55

66
# C++ flags
77
CXX_FLAGS="-O3 -flto -Wall -Wno-unused-function"
88

9+
# add coverage flags
10+
USE_COVERAGE=0

doc/doxygen/doxygen.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,8 @@ WARN_LOGFILE =
791791
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
792792
# Note: If this tag is empty the current directory is searched.
793793

794-
INPUT = "../../src" \
794+
INPUT = "../../include/mci" \
795+
"../../src" \
795796
"doxygen_stl.cpp"
796797

797798
# This tag can be used to specify the character encoding of the source files

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ if (MPI_FOUND)
66
target_link_libraries(mci ${MPI_CXX_LIBRARIES})
77
target_link_libraries(mci_static ${MPI_CXX_LIBRARIES})
88
endif()
9+
10+
if (USE_COVERAGE)
11+
target_link_libraries(mci --coverage)
12+
target_link_libraries(mci_static --coverage)
13+
endif()

src/Estimators.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,9 @@ namespace mci
257257
double ** err = new double*[MAX_BLOCKS-MIN_BLOCKS+1];
258258
for (int j=0; j<MAX_BLOCKS-MIN_BLOCKS+1; ++j){ *(err+j) = new double[ndim]; }
259259

260-
int nblocks;
261260
for (int i1=0; i1<MAX_BLOCKS-MIN_BLOCKS+1; ++i1)
262261
{
263-
nblocks=i1+MIN_BLOCKS;
262+
const int nblocks=i1+MIN_BLOCKS;
264263
MultiDimBlockEstimator(n, ndim, x, nblocks, *(av+i1), *(err+i1));
265264
}
266265

test/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
include_directories(common/)
22
link_libraries(mci)
3+
if (USE_COVERAGE)
4+
link_libraries(--coverage)
5+
endif()
6+
37
add_executable(check main.cpp)
48
add_executable(ut1.exe ut1/main.cpp)
59
add_executable(ut2.exe ut2/main.cpp)

0 commit comments

Comments
 (0)