From a8ad3619b92cb90298644ca7e12547c93f9b96d0 Mon Sep 17 00:00:00 2001 From: Simon Brunel Date: Fri, 26 May 2017 10:29:58 +0200 Subject: [PATCH] Setup Travis CI builds and code coverage Built with Qt 5.4.2/GCC 4.8.4, code coverage with LCOV 1.13 and reported to Codecov. --- .gitignore | 8 +++++++- .travis.yml | 32 ++++++++++++++++++++++++++++++++ README.md | 6 +++++- qtpromise.pri | 1 + tests/auto/future/future.pro | 1 + tests/auto/tests.pri | 14 +++++++++++++- 6 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 .travis.yml diff --git a/.gitignore b/.gitignore index d7a4d4d..bbeffbd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ -/*.user +*.gcno +*.gcda +*.moc +*.o +*.user +Makefile +coverage.info diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..51742dc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,32 @@ +sudo: required +dist: trusty +language: cpp +compiler: gcc + +before_install: + - sudo add-apt-repository -y ppa:beineri/opt-qt542-trusty + - sudo apt-get update -qq + +install: + - sudo apt-get install -qq qt54base + - source /opt/qt54/bin/qt54-env.sh + - wget http://archive.ubuntu.com/ubuntu/pool/universe/l/lcov/lcov_1.13.orig.tar.gz + - tar xf lcov_1.13.orig.tar.gz + - cd lcov-1.13/ + - sudo make install + - cd .. + +before_script: + - qmake --version + - lcov --version + - gcc --version + +script: + - qmake qtpromise.pro CONFIG+=coverage + - make -j4 + - make -j4 check --quiet + - lcov -capture --directory . --o coverage.info + - lcov -e coverage.info '**/src/**/*' -o coverage.info + +after_success: + - bash <(curl -s https://codecov.io/bash) -f coverage.info diff --git a/README.md b/README.md index 486f58d..8b6d92a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ Promises/A+ # QtPromise -[Promises/A+](https://promisesaplus.com/) implementation for [Qt](https://www.qt.io/). +[![Travis](https://img.shields.io/travis/simonbrunel/qtpromise.svg?style=flat-square)](https://travis-ci.org/simonbrunel/qtpromise) [![coverage](https://img.shields.io/codecov/c/github/simonbrunel/qtpromise.svg?style=flat-square)](https://codecov.io/gh/simonbrunel/qtpromise) + +[Promises/A+](https://promisesaplus.com/) implementation for [Qt/C++](https://www.qt.io/). + +Requires [Qt 5.4](https://www.qt.io/download/) or later. ## License QtPromise is available under the [MIT license](LICENSE.md). diff --git a/qtpromise.pri b/qtpromise.pri index f630570..d3302a8 100644 --- a/qtpromise.pri +++ b/qtpromise.pri @@ -1,2 +1,3 @@ INCLUDEPATH += $$PWD/include $$PWD/src DEPENDPATH += $$PWD/include $$PWD/src +CONFIG += c++11 diff --git a/tests/auto/future/future.pro b/tests/auto/future/future.pro index afb02c8..1468b06 100644 --- a/tests/auto/future/future.pro +++ b/tests/auto/future/future.pro @@ -1,3 +1,4 @@ +QT += concurrent TARGET = tst_future SOURCES += $$PWD/tst_future.cpp diff --git a/tests/auto/tests.pri b/tests/auto/tests.pri index 343679f..bcaabb9 100644 --- a/tests/auto/tests.pri +++ b/tests/auto/tests.pri @@ -1,6 +1,18 @@ TEMPLATE = app CONFIG += testcase -QT += testlib concurrent +QT += testlib +QT -= gui + DEFINES += QT_DEPRECATED_WARNINGS +coverage: { + gcc: { + message("Code coverage enabled (gcov)") + QMAKE_CXXFLAGS += --coverage -O0 -g + QMAKE_LFLAGS += --coverage -O0 -g + } else { + message("Code coverage only available when compiling with GCC") + } +} + include(../../qtpromise.pri)