Skip to content

Commit 8a9479f

Browse files
committed
Enable code coverage on Travis.
1 parent 17328e7 commit 8a9479f

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

.coveragerc

+33
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,36 @@ source =
1515
run_project_tests.py
1616
run_tests.py
1717
run_unittests.py
18+
19+
# Aliases to /root/ are needed because Travis runs in docker at /root/.
20+
[paths]
21+
meson =
22+
meson.py
23+
/root/meson.py
24+
mesonbuild =
25+
mesonbuild/
26+
/root/mesonbuild/
27+
mesonconf =
28+
mesonconf.py
29+
/root/mesonconf.py
30+
mesonintrospect =
31+
mesonintrospect.py
32+
/root/mesonintrospect.py
33+
mesonrewriter =
34+
mesonrewriter.py
35+
/root/mesonrewriter.py
36+
mesontest =
37+
mesontest.py
38+
/root/mesontest.py
39+
run_cross_test =
40+
run_cross_test.py
41+
/root/run_cross_test.py
42+
run_project_tests =
43+
run_project_tests.py
44+
/root/run_project_tests.py
45+
run_tests =
46+
run_tests.py
47+
/root/run_tests.py
48+
run_unittests =
49+
run_unittests.py
50+
/root/run_unittests.py

.travis.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ before_install:
3232
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
3333
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ninja python3; fi
3434
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull jpakkane/mesonci:zesty; fi
35+
- pip3 install codecov
36+
- mkdir .coverage
3537

3638
# We need to copy the current checkout inside the Docker container,
3739
# because it has the MR id to be tested checked out.
@@ -40,5 +42,15 @@ script:
4042
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM jpakkane/mesonci:zesty > Dockerfile; fi
4143
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile; fi
4244
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit .; fi
43-
- 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
44-
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) OBJC=$CC OBJCXX=$CXX ./run_tests.py --backend=ninja -- $MESON_ARGS ; fi
45+
- |
46+
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
47+
ci_env=`bash <(curl -s https://codecov.io/env)`
48+
docker run $ci_env -v ${PWD}/.coverage:/root/.coverage \
49+
withgit \
50+
/bin/sh -c "cd /root && CC=$CC CXX=$CXX OBJC=$CC OBJCXX=$CXX ./run_tests.py --cov -- $MESON_ARGS; chmod -R a+rwX .coverage"
51+
fi
52+
- 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
53+
54+
after_success:
55+
- coverage3 combine
56+
- codecov

0 commit comments

Comments
 (0)