Browse Source

Enable code coverage on Travis.

Elliott Sales de Andrade 2 years ago
parent
commit
8a9479f8ea
2 changed files with 47 additions and 2 deletions
  1. 33
    0
      .coveragerc
  2. 14
    2
      .travis.yml

+ 33
- 0
.coveragerc View File

@@ -15,3 +15,36 @@ source =
15 15
     run_project_tests.py
16 16
     run_tests.py
17 17
     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

+ 14
- 2
.travis.yml View File

@@ -32,6 +32,8 @@ before_install:
32 32
   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
33 33
   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ninja python3; fi
34 34
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull jpakkane/mesonci:zesty; fi
35
+  - pip3 install codecov
36
+  - mkdir .coverage
35 37
 
36 38
 # We need to copy the current checkout inside the Docker container,
37 39
 # because it has the MR id to be tested checked out.
@@ -40,5 +42,15 @@ script:
40 42
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM jpakkane/mesonci:zesty > Dockerfile; fi
41 43
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile; fi
42 44
   - 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

Loading…
Cancel
Save