From 1293d3d1b96f3a835b6338cf8b6500f9bd99c681 Mon Sep 17 00:00:00 2001 From: Hugues Delorme Date: Wed, 22 Mar 2017 09:21:37 +0100 Subject: [PATCH] travis: move codecov task in its own script file --- .travis.yml | 26 ++------------------------ scripts/travis-build.sh | 8 ++++---- scripts/travis-codecov.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 28 deletions(-) create mode 100644 scripts/travis-codecov.sh diff --git a/.travis.yml b/.travis.yml index d2d268f..9b5787d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,27 +41,5 @@ script: - ./scripts/travis-build.sh after_success: - - | - mkdir gcov; cd gcov - list_src_path=(gmio_core gmio_core/internal - gmio_stl gmio_stl/internal - gmio_amf) - basedir_output=../build/src/CMakeFiles/gmio_static.dir - for src_path in ${list_src_path[*]}; do - # Rename file.c.gcno -> file.gcno - for file in $basedir_output/$src_path/*.c.gcno; do - basename_file=`basename $file .c.gcno` - mv $file $basedir_output/$src_path/$basename_file.gcno - done - # Rename file.c.gcda -> file.gcda - for file in $basedir_output/$src_path/*.c.gcda; do - basename_file=`basename $file .c.gcda` - mv $file $basedir_output/$src_path/$basename_file.gcda - done - # Generate *.gcov files - gcov ../src/$src_path/*.c -o $basedir_output/$src_path - done - - if [ "$TRAVIS_TESTS_COVERAGE" = "ON" ]; then - bash <(curl -s https://codecov.io/bash) -X gcov -Xcoveragepy -s . - fi + - chmod +x scripts/travis-codecov.sh + - ./scripts/travis-codecov.sh diff --git a/scripts/travis-build.sh b/scripts/travis-build.sh index 0401667..ef35a47 100644 --- a/scripts/travis-build.sh +++ b/scripts/travis-build.sh @@ -5,16 +5,16 @@ set -e # CMake options as environment variables if [ -n "${TRAVIS_GCC_VERSION}" ]; then - export CC=gcc-$TRAVIS_GCC_VERSION; - export CXX=g++-$TRAVIS_GCC_VERSION; + export CC=gcc-$TRAVIS_GCC_VERSION + export CXX=g++-$TRAVIS_GCC_VERSION fi if [ -z "${TRAVIS_TESTS_COVERAGE}" ]; then - export TRAVIS_TESTS_COVERAGE=OFF; + export TRAVIS_TESTS_COVERAGE=OFF fi if [ -z "${TRAVIS_FLOAT2STR_LIB}" ]; then - export TRAVIS_FLOAT2STR_LIB=std; + export TRAVIS_FLOAT2STR_LIB=std fi # Run CMake diff --git a/scripts/travis-codecov.sh b/scripts/travis-codecov.sh new file mode 100644 index 0000000..91d84e9 --- /dev/null +++ b/scripts/travis-codecov.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +if [ -z "${TRAVIS_TESTS_COVERAGE}" ]; then + export TRAVIS_TESTS_COVERAGE=OFF +fi + +if [ "$TRAVIS_TESTS_COVERAGE" = "ON" ]; then + mkdir gcov; cd gcov + list_src_path=(gmio_core gmio_core/internal + gmio_stl gmio_stl/internal + gmio_amf) + basedir_output=../build/src/CMakeFiles/gmio_static.dir + for src_path in ${list_src_path[*]}; do + # Rename file.c.gcno -> file.gcno + for file in $basedir_output/$src_path/*.c.gcno; do + basename_file=`basename $file .c.gcno` + mv $file $basedir_output/$src_path/$basename_file.gcno + done + # Rename file.c.gcda -> file.gcda + for file in $basedir_output/$src_path/*.c.gcda; do + basename_file=`basename $file .c.gcda` + mv $file $basedir_output/$src_path/$basename_file.gcda + done + # Generate *.gcov files + gcov ../src/$src_path/*.c -o $basedir_output/$src_path + done + bash <(curl -s https://codecov.io/bash) -X gcov -Xcoveragepy -s . +fi