Merge pull request #397 from Alexander-N/coverage
Reactivate coverage on CI
This commit is contained in:
commit
7cdd253593
11
.travis.yml
11
.travis.yml
|
@ -5,6 +5,8 @@ dist: xenial
|
||||||
cache:
|
cache:
|
||||||
pip: true
|
pip: true
|
||||||
cargo: true
|
cargo: true
|
||||||
|
directories:
|
||||||
|
- "$HOME/kcov"
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
@ -56,7 +58,16 @@ install:
|
||||||
script:
|
script:
|
||||||
- ./ci/travis/test.sh
|
- ./ci/travis/test.sh
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- ./ci/travis/cover.sh
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
|
- provider: script
|
||||||
|
skip_cleanup: true
|
||||||
|
script: ./ci/travis/cover.sh
|
||||||
|
on:
|
||||||
|
branch: master
|
||||||
|
condition: $TRAVIS_EVENT_TYPE != "cron"
|
||||||
- provider: script
|
- provider: script
|
||||||
skip_cleanup: true
|
skip_cleanup: true
|
||||||
script: ./ci/travis/guide.sh
|
script: ./ci/travis/guide.sh
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
[![Build Status](https://travis-ci.org/PyO3/pyo3.svg?branch=master)](https://travis-ci.org/PyO3/pyo3)
|
[![Build Status](https://travis-ci.org/PyO3/pyo3.svg?branch=master)](https://travis-ci.org/PyO3/pyo3)
|
||||||
[![Build Status](https://ci.appveyor.com/api/projects/status/github/PyO3/pyo3?branch=master&svg=true)](https://ci.appveyor.com/project/fafhrd91/pyo3)
|
[![Build Status](https://ci.appveyor.com/api/projects/status/github/PyO3/pyo3?branch=master&svg=true)](https://ci.appveyor.com/project/fafhrd91/pyo3)
|
||||||
|
[![codecov](https://codecov.io/gh/PyO3/pyo3/branch/master/graph/badge.svg)](https://codecov.io/gh/PyO3/pyo3)
|
||||||
[![crates.io](http://meritbadge.herokuapp.com/pyo3)](https://crates.io/crates/pyo3)
|
[![crates.io](http://meritbadge.herokuapp.com/pyo3)](https://crates.io/crates/pyo3)
|
||||||
[![Join the dev chat](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/PyO3/Lobby)
|
[![Join the dev chat](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/PyO3/Lobby)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
### Run kcov in parallel #######################################################
|
||||||
|
|
||||||
|
rm -f target/debug/pyo3*.d
|
||||||
|
rm -f target/debug/test_*.d
|
||||||
|
rm -f target/debug/test_doc-*
|
||||||
|
|
||||||
|
FILES=$(find . -path ./target/debug/pyo3\* -or -path ./target/debug/test_\*)
|
||||||
|
echo $FILES | xargs -n1 -P $(nproc) sh -c '
|
||||||
|
dir="target/cov/$(basename $@)"
|
||||||
|
mkdir -p $dir
|
||||||
|
echo "Collecting coverage data of $(basename $@)"
|
||||||
|
kcov \
|
||||||
|
--exclude-path=./tests \
|
||||||
|
--exclude-region="#[cfg(test)]:#[cfg(testkcovstopmarker)]" \
|
||||||
|
--exclude-pattern=/.cargo,/usr/lib \
|
||||||
|
--verify $dir "$@" 2>&1 >/dev/null
|
||||||
|
' _
|
||||||
|
|
||||||
|
### Upload coverage ############################################################
|
||||||
|
|
||||||
|
echo "Uploading code coverage"
|
||||||
|
curl -SsL https://codecov.io/bash | bash
|
|
@ -18,3 +18,18 @@ PYTHON_LIB=$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR
|
||||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PYTHON_LIB:$HOME/rust/lib"
|
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PYTHON_LIB:$HOME/rust/lib"
|
||||||
|
|
||||||
echo ${LD_LIBRARY_PATH}
|
echo ${LD_LIBRARY_PATH}
|
||||||
|
|
||||||
|
### Setup kcov #################################################################
|
||||||
|
|
||||||
|
if [ ! -f "$HOME/.cargo/bin/kcov" ]; then
|
||||||
|
if [ ! -d "$HOME/kcov/.git" ]; then
|
||||||
|
git clone --depth=1 https://github.com/SimonKagstrom/kcov "$HOME/kcov"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $HOME/kcov
|
||||||
|
git pull
|
||||||
|
cmake .
|
||||||
|
make
|
||||||
|
install src/kcov $HOME/.cargo/bin/kcov
|
||||||
|
cd $TRAVIS_BUILD_DIR
|
||||||
|
fi
|
||||||
|
|
|
@ -3,6 +3,7 @@ set -ex
|
||||||
|
|
||||||
cargo clean
|
cargo clean
|
||||||
cargo test --features "$FEATURES num-complex"
|
cargo test --features "$FEATURES num-complex"
|
||||||
|
( cd pyo3-derive-backend; cargo test )
|
||||||
if [ $TRAVIS_JOB_NAME = 'Minimum nightly' ]; then
|
if [ $TRAVIS_JOB_NAME = 'Minimum nightly' ]; then
|
||||||
cargo fmt --all -- --check
|
cargo fmt --all -- --check
|
||||||
cargo clippy --features "$FEATURES num-complex"
|
cargo clippy --features "$FEATURES num-complex"
|
||||||
|
|
Loading…
Reference in New Issue