Skip to content

Commit

Permalink
Enable code coverage on Travis.
Browse files Browse the repository at this point in the history
  • Loading branch information
QuLogic committed May 21, 2017
1 parent 17328e7 commit 8a9479f
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
33 changes: 33 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,36 @@ source =
run_project_tests.py
run_tests.py
run_unittests.py

# Aliases to /root/ are needed because Travis runs in docker at /root/.
[paths]
meson =
meson.py
/root/meson.py
mesonbuild =
mesonbuild/
/root/mesonbuild/
mesonconf =
mesonconf.py
/root/mesonconf.py
mesonintrospect =
mesonintrospect.py
/root/mesonintrospect.py
mesonrewriter =
mesonrewriter.py
/root/mesonrewriter.py
mesontest =
mesontest.py
/root/mesontest.py
run_cross_test =
run_cross_test.py
/root/run_cross_test.py
run_project_tests =
run_project_tests.py
/root/run_project_tests.py
run_tests =
run_tests.py
/root/run_tests.py
run_unittests =
run_unittests.py
/root/run_unittests.py
16 changes: 14 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ninja python3; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull jpakkane/mesonci:zesty; fi
- pip3 install codecov
- mkdir .coverage

# We need to copy the current checkout inside the Docker container,
# because it has the MR id to be tested checked out.
Expand All @@ -40,5 +42,15 @@ script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM jpakkane/mesonci:zesty > Dockerfile; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit .; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && TRAVIS=true CC=$CC CXX=$CXX OBJC=$CC OBJCXX=$CXX ./run_tests.py -- $MESON_ARGS"; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) OBJC=$CC OBJCXX=$CXX ./run_tests.py --backend=ninja -- $MESON_ARGS ; fi
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
ci_env=`bash <(curl -s https://codecov.io/env)`
docker run $ci_env -v ${PWD}/.coverage:/root/.coverage \
withgit \
/bin/sh -c "cd /root && CC=$CC CXX=$CXX OBJC=$CC OBJCXX=$CXX ./run_tests.py --cov -- $MESON_ARGS; chmod -R a+rwX .coverage"
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) OBJC=$CC OBJCXX=$CXX ./run_tests.py --cov --backend=ninja -- $MESON_ARGS ; fi

after_success:
- coverage3 combine
- codecov

0 comments on commit 8a9479f

Please sign in to comment.