diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 00000000..5c67d1b1 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,4 @@ +coverage: + ignore: + - tests/ + - bundled/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index d426e176..521a1abd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,8 +34,8 @@ jobs: - ubuntu-toolchain-r-test - sourceline: 'ppa:likemartinma/devel' packages: + - lcov - ccache - - g++-8 - openmpi-bin - libopenmpi-dev - libhdf5-dev @@ -45,8 +45,8 @@ jobs: - libeigen3-dev env: - CMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu - - OMPI_CC=gcc-8 - - OMPI_CXX=g++-8 + - OMPI_CC=gcc + - OMPI_CXX=g++ - CPLUS_INCLUDE_PATH=/usr/lib/openmpi/include script: ./share/qa/unit_and_integration_test.sh @@ -171,5 +171,8 @@ jobs: install: - ccache -M 2G +after_success: + - if [[ -f "${TRAVIS_BUILD_DIR}/cmake-build-release/Testing/Temporary/LastTest.log" ]] ; then ./share/qa/compute_coverage.sh ; fi + after_failure: - if [[ -f "${TRAVIS_BUILD_DIR}/cmake-build-release/Testing/Temporary/LastTest.log" ]] ; then cat "${TRAVIS_BUILD_DIR}/cmake-build-release/Testing/Temporary/LastTest.log" ; fi \ No newline at end of file diff --git a/README.md b/README.md index 2f06ad34..aae9db60 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +[![Build Status](https://travis-ci.com/epfl-ecps/channelflow.svg?branch=master)](https://travis-ci.com/epfl-ecps/channelflow) +[![codecov](https://codecov.io/gh/epfl-ecps/channelflow/branch/master/graph/badge.svg)](https://codecov.io/gh/epfl-ecps/channelflow) +[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) + # Channelflow Project Channelflow is a software system for numerical analysis of the incompressible fluid flow in diff --git a/share/qa/compute_coverage.sh b/share/qa/compute_coverage.sh new file mode 100755 index 00000000..4cf5c2d4 --- /dev/null +++ b/share/qa/compute_coverage.sh @@ -0,0 +1,17 @@ +#!/bin/bash -e + +if [[ "${OMPI_CC}" == "gcc" ]] +then + # Go to the build directory and compute coverage + cd ${TRAVIS_BUILD_DIR}/cmake-build-release + lcov --version + echo $PWD + lcov --rc lcov_branch_coverage=1 --directory . --capture --output-file coverage.info + lcov --rc lcov_branch_coverage=1 --remove coverage.info '/*tests/*' --output-file coverage.info + lcov --rc lcov_branch_coverage=1 --remove coverage.info '/*/bundled/*' --output-file coverage.info + lcov --rc lcov_branch_coverage=1 --remove coverage.info '/usr/*' --output-file coverage.info + lcov --rc lcov_branch_coverage=1 --list coverage.info + + # Upload to codecov website + bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" +fi diff --git a/share/qa/unit_and_integration_test.sh b/share/qa/unit_and_integration_test.sh index 7c02166f..3c26cfa1 100755 --- a/share/qa/unit_and_integration_test.sh +++ b/share/qa/unit_and_integration_test.sh @@ -7,9 +7,17 @@ ccache -V ccache -z -# Parallel build in Release mode mkdir ${TRAVIS_BUILD_DIR}/cmake-build-release && cd ${TRAVIS_BUILD_DIR}/cmake-build-release -CC="ccache mpicc" CXX="ccache mpicxx" cmake -DCMAKE_BUILD_TYPE:STRING=Release -DWITH_HDF5CXX:BOOL=ON -DWITH_PYTHON:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=ON -DWITH_NSOLVER:BOOL=ON -DWITH_NETCDF:STRING=Serial ${TRAVIS_BUILD_DIR} +# Tests done for coverage are built in debug mode, to hit assertions. +# We use -Og not to slow down excessively the executables and tests +if [[ "${OMPI_CC}" == "gcc" ]] +then + # Parallel build in Release mode + CXXFLAGS="--coverage -ggdb3 -Og" CC="ccache mpicc" CXX="ccache mpicxx" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=Debug -DWITH_HDF5CXX:BOOL=ON -DWITH_PYTHON:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=ON -DWITH_NSOLVER:BOOL=ON -DWITH_NETCDF:STRING=Serial ${TRAVIS_BUILD_DIR} +else + # Parallel build in Release mode + CC="ccache mpicc" CXX="ccache mpicxx" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=Release -DWITH_HDF5CXX:BOOL=ON -DWITH_PYTHON:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=ON -DWITH_NSOLVER:BOOL=ON -DWITH_NETCDF:STRING=Serial ${TRAVIS_BUILD_DIR} +fi make -j 4 # Print ccache statistics