-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve CI build environment with code coverage, static analysis, valgrind #72
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
codecov: | ||
disable_default_path_fixes: true | ||
|
||
fixes: | ||
- home/travis/build/boost/::include/boost/ | ||
- home/travis/build/*/*/:: | ||
|
||
coverage: | ||
range: "85...100" | ||
|
||
parsers: | ||
gcov: | ||
branch_detection: | ||
conditional: yes | ||
loop: yes | ||
method: no | ||
macro: no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,172 @@ | ||
# Copyright 2016, 2017 Peter Dimov | ||
# Copyright 2016 Peter Dimov | ||
# Copyright 2017, 2018 James E. King III | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) | ||
|
||
language: cpp | ||
# | ||
# Generic Travis CI build script for boostorg repositories | ||
# | ||
# Instructions for customizing this script for your library: | ||
# | ||
# 1. Copy the ci/ directory from the same source into your project: | ||
# ci/build.sh runs the build | ||
# ci/codecov.sh is used to run a profiling build and upload results to codecov.io | ||
# ci/coverity.sh is used to run a coverity build and upload results coverity scan | ||
# 2. Customize the compilers and language levels you want. Default is C++03. | ||
# 3. Update the global B2 environment settings to your liking. | ||
# 4. If you have more than include/, src/, and test/ directories then | ||
# add them to the depinst.py line as "--include tools" for tools/ (you | ||
# can put multiple --include on the command line). | ||
# 5. If you want to enable Coverity Scan, you need to provide the environment | ||
# variables COVERITY_SCAN_TOKEN and COVERITY_SCAN_NOTIFICATION_EMAIL in | ||
# your github settings. | ||
# 6. Enable pull request builds in your boostorg/<library> account. | ||
# 7. Change the default C++ version in ci/*.sh (search for CXXSTD) | ||
# | ||
# That's it - the scripts will do everything else for you. | ||
|
||
sudo: false | ||
dist: trusty | ||
language: cpp | ||
|
||
python: "2.7" | ||
env: | ||
global: | ||
# see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties | ||
# to use the default for a given environment, comment it out; recommend you build debug and release however.. | ||
# - B2_ADDRESS_MODEL=address-model=64,32 | ||
# - B2_LINK=link=shared,static | ||
# - B2_THREADING=threading=multi,single | ||
- B2_VARIANT=variant=release,debug | ||
|
||
install: | ||
- export SELF=`basename $TRAVIS_BUILD_DIR` | ||
- cd .. | ||
- git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root | ||
- cd boost-root | ||
- git submodule update -q --init tools/boostdep | ||
- git submodule update -q --init tools/build | ||
- git submodule update -q --init tools/inspect | ||
- cp -r $TRAVIS_BUILD_DIR/* libs/$SELF | ||
- export BOOST_ROOT="`pwd`" | ||
- export PATH="`pwd`":$PATH | ||
- python tools/boostdep/depinst/depinst.py $SELF --include example | ||
- ./bootstrap.sh | ||
- ./b2 headers | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- binutils-gold | ||
- gdb | ||
- libc6-dbg | ||
|
||
branches: | ||
only: | ||
- master | ||
- develop | ||
- /feature\/.*/ | ||
|
||
env: | ||
matrix: | ||
- BOGUS_JOB=true | ||
|
||
matrix: | ||
|
||
exclude: | ||
- env: BOGUS_JOB=true | ||
- master | ||
|
||
script: | ||
- cd libs/$SELF | ||
- ci/build.sh | ||
|
||
jobs: | ||
include: | ||
#################### Jobs to run on every pull request #################### | ||
- os: linux | ||
env: | ||
- COMMENT="C++03" | ||
- TOOLSET=gcc,gcc-7 | ||
addons: | ||
apt: | ||
packages: | ||
- g++-7 | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
- os: linux | ||
compiler: g++ | ||
env: TOOLSET=gcc CXXSTD=03,11 | ||
env: | ||
- COMMENT="C++11" | ||
- TOOLSET=clang | ||
- CXXSTD=11 | ||
addons: | ||
apt: | ||
packages: | ||
- g++-7 | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
- os: linux | ||
env: | ||
- COMMENT=valgrind | ||
- TOOLSET=clang | ||
- B2_VARIANT=variant=debug | ||
- TESTFLAGS=testing.launcher=valgrind | ||
addons: | ||
apt: | ||
packages: | ||
- clang-5.0 | ||
- libstdc++-7-dev | ||
- valgrind | ||
sources: | ||
- llvm-toolchain-trusty-5.0 | ||
- ubuntu-toolchain-r-test | ||
|
||
- os: linux | ||
env: | ||
- COMMENT=cppcheck | ||
script: | ||
- libs/$SELF/ci/cppcheck.sh | ||
|
||
- os: linux | ||
compiler: clang++ | ||
env: TOOLSET=clang CXXSTD=03,11 | ||
env: | ||
- COMMENT=UBSAN | ||
- B2_VARIANT=variant=debug | ||
- TOOLSET=gcc-7 | ||
- CXXFLAGS="cxxflags=-fno-omit-frame-pointer cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined" | ||
- LINKFLAGS="linkflags=-fsanitize=undefined linkflags=-fno-sanitize-recover=undefined" | ||
- UBSAN_OPTIONS=print_stacktrace=1 | ||
addons: | ||
apt: | ||
packages: | ||
- libstdc++-4.9-dev | ||
- g++-7 | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
|
||
# the backlog of macos builds is too long to justify waiting a day for this | ||
# - os: osx | ||
# compiler: clang++ | ||
# env: TOOLSET=clang CXXSTD=03,11 | ||
- os: linux | ||
env: | ||
- COMMENT=CodeCov | ||
- TOOLSET=gcc-7 | ||
addons: | ||
apt: | ||
packages: | ||
- gcc-7 | ||
- g++-7 | ||
- lcov | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
script: | ||
- cd libs/$SELF | ||
- ci/codecov.sh | ||
|
||
install: | ||
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true | ||
- cd .. | ||
- git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root | ||
- cd boost-root | ||
- git submodule update --init tools/build | ||
- git submodule update --init libs/config | ||
- git submodule update --init tools/boostdep | ||
- cp -r $TRAVIS_BUILD_DIR/* libs/date_time | ||
- python tools/boostdep/depinst/depinst.py date_time | ||
- ./bootstrap.sh | ||
- ./b2 headers | ||
# osx was disabled because it is very slow to start (can delay builds by 30 minutes) | ||
# - os: osx | ||
# osx_image: xcode9 | ||
# env: | ||
# - TOOLSET=clang | ||
# - CXXSTD=03,11 | ||
|
||
script: | ||
- ./b2 libs/date_time/test toolset=$TOOLSET cxxstd=$CXXSTD | ||
#################### Jobs to run on master merges only ################### | ||
|
||
# Coverity Scan | ||
- os: linux | ||
if: branch = master | ||
env: | ||
- COMMENT="Coverity Scan" | ||
- TOOLSET=gcc | ||
script: | ||
- echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- | ||
- cd libs/$SELF | ||
- ci/coverity.sh | ||
|
||
notifications: | ||
email: | ||
on_success: always | ||
false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
DateTime, part of the collection of [Boost C++ Libraries](http://github.com/boostorg), makes programming with dates and times as simple and natural as programming with strings and integers. | ||
|
||
### License | ||
|
||
Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). | ||
|
||
### Properties | ||
|
||
* C++03 | ||
* Requires Linking | ||
|
||
### Build Status | ||
|
||
Branch | Travis | Appveyor | Coverity Scan | codecov.io | Documentation | Regression Tests | ||
--------------- | ------ | -------- | ------------- | ---------- | ------------- | ---------------- | ||
[master](https://github.com/boostorg/date_time/tree/master) | [![Build Status](https://travis-ci.org/boostorg/date_time.svg?branch=master)](https://travis-ci.org/boostorg/date_time) | [![Build status](https://ci.appveyor.com/api/projects/status/upf5c528fy09fudk?svg=true)](https://ci.appveyor.com/project/jeking3/date-time-1evbf) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/14908/badge.svg)](https://scan.coverity.com/projects/boostorg-date_time) | [![codecov](https://codecov.io/gh/boostorg/date_time/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/date_time/branch/master) | [![Documentation](https://img.shields.io/badge/documentation-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/date_time.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/date_time.html) | ||
[develop](https://github.com/boostorg/date_time/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/date_time.svg?branch=develop)](https://travis-ci.org/boostorg/date_time) | [![Build status](https://ci.appveyor.com/api/projects/status/upf5c528fy09fudk/branch/develop?svg=true)](https://ci.appveyor.com/project/boostorg/date_time/branch/develop) | | [![codecov](https://codecov.io/gh/boostorg/date_time/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/date_time/branch/develop) | [![Documentation](https://img.shields.io/badge/documentation-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/date_time.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/date_time.html) | ||
|
||
### Dependencies | ||
|
||
This is a list of other Boost libraries that are required by Boost.DateTime: | ||
|
||
* algorithm | ||
* assert | ||
* config | ||
* core | ||
* io | ||
* lexical_cast | ||
* mpl | ||
* numeric | ||
* range | ||
* serialization | ||
* smart_ptr | ||
* static_assert | ||
* throw_exception | ||
* test (for running unit tests only) | ||
* tokenizer | ||
* type_traits | ||
* utility | ||
* winapi | ||
|
||
### Directories | ||
|
||
| Name | Purpose | | ||
| --------- | ------------------------------ | | ||
| `build` | build script for link library | | ||
| `ci` | continuous integration scripts | | ||
| `data` | timezone database | | ||
| `doc` | documentation | | ||
| `example` | use case examples | | ||
| `include` | headers | | ||
| `src` | source code for link library | | ||
| `test` | unit tests | | ||
| `xmldoc` | additional documentation | | ||
|
||
### More information | ||
|
||
* [Documentation](http://boost.org/libs/date_time) | ||
* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-date_time): Be sure to read the documentation first to see if it answers your question. | ||
* [Report bugs](https://github.com/boostorg/date_time/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. | ||
* [Submit Pull Requests](https://github.com/boostorg/date_time/pulls) against the **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). Be sure to include tests proving your changes work properly. | ||
* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[date_time]` tag at the beginning of the subject line. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# A script to find direct depenedencies (for documentation) | ||
# | ||
# Copyright (c) 2018 James E. King III | ||
# | ||
# Use, modification, and distribution are subject to the | ||
# Boost Software License, Version 1.0. (See accompanying file | ||
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# takes one or more arguments - subdirectories to calculate depenedencies for | ||
function finddeps | ||
{ | ||
local hdrs=`find $* -type f -exec grep 'include' {} \; | grep 'boost/' | grep -v 'date_time' | sed 's/</\"/g' | sed 's/>/\"/g' | cut -d\" -f2 | sort | uniq` | ||
local deps=`for hdr in $hdrs; do local hdronly=${hdr##*/}; find .. -name $hdronly -print | grep $hdr | cut -d'/' -f2; done` | ||
echo $deps | xargs -n1 | sort -u | ||
} | ||
|
||
finddeps $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#! /bin/bash | ||
# | ||
# Copyright 2017 James E. King III | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# (See accompanying file LICENSE_1_0.txt or copy at | ||
# http://www.boost.org/LICENSE_1_0.txt) | ||
# | ||
# Bash script to run in travis to perform a bjam build | ||
# cwd should be $BOOST_ROOT/libs/$SELF before running | ||
# | ||
|
||
set -ex | ||
|
||
# default language level: c++03 | ||
if [[ -z "$CXXSTD" ]]; then | ||
CXXSTD=03 | ||
fi | ||
|
||
$BOOST_ROOT/b2 . toolset=$TOOLSET cxxstd=$CXXSTD $CXXFLAGS $DEFINES $LINKFLAGS $TESTFLAGS $B2_ADDRESS_MODEL $B2_LINK $B2_THREADING $B2_VARIANT -j3 $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#! /bin/bash | ||
# | ||
# Copyright 2017 James E. King III | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# (See accompanying file LICENSE_1_0.txt or copy at | ||
# http://www.boost.org/LICENSE_1_0.txt) | ||
# | ||
# Bash script to run in travis to perform codecov.io integration | ||
# | ||
|
||
### | ||
### NOTE: Make sure you grab and customize .codecov.yml | ||
### | ||
|
||
# assumes cwd is the top level directory of the boost project | ||
# assumes an environment variable $SELF is the boost project name | ||
|
||
set -ex | ||
|
||
B2_VARIANT=debug | ||
ci/build.sh cxxflags=-fprofile-arcs cxxflags=-ftest-coverage linkflags=-fprofile-arcs linkflags=-ftest-coverage | ||
|
||
# switch back to the original source code directory | ||
# this ensures codecov doesn't get confused | ||
cd $TRAVIS_BUILD_DIR | ||
|
||
# get the version of lcov | ||
lcov --version | ||
|
||
# coverage files are in ../../b2 from this location | ||
lcov --gcov-tool=gcov-7 --rc lcov_branch_coverage=1 --base-directory `pwd` --directory "$BOOST_ROOT" --capture --output-file all.info | ||
|
||
# all.info contains all the coverage info for all projects - limit to ours | ||
lcov --gcov-tool=gcov-7 --extract all.info "*/boost/$SELF/*" --output-file coverage.info | ||
|
||
# dump a summary just for grins | ||
lcov --gcov-tool=gcov-7 --list coverage.info | ||
|
||
# | ||
# upload to codecov.io | ||
# | ||
curl -s https://codecov.io/bash > .codecov | ||
chmod +x .codecov | ||
./.codecov -f coverage.info -X gcov -x "gcov-7" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
g++ 7 is -std=gnu++14 by default if you don't pass anything; if you really want c++03, need cxxstd=03.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just saw that you're setting it to 03 in
ci/build.sh
if not set; you can ignore that then :-) although I'd still use CXXSTD: 03 here. Testing without -std= set is a legitimate scenario that you might wish to enable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is handled in the ci/build.sh script.
CXXSTD=03 is used if not set otherwise for this particular repo.