Merge pull request #278 from PyO3/ci

Improve testing setup
This commit is contained in:
konstin 2019-01-08 20:41:44 +01:00 committed by GitHub
commit 1b4afd1102
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 35 deletions

2
.gitignore vendored
View File

@ -13,6 +13,8 @@ dist/
.hypothesis/
.eggs/
venv*
guide/book/
examples/*/py
*.so
*.out

View File

@ -1,28 +1,13 @@
.PHONY: default test publish
ifndef PY
PY := $(word 2, $(subst ., ,$(shell python --version 2>&1)))
endif
ifeq ($(PY),2)
FEATURES := python2
endif
ifeq ($(PY),3)
FEATURES := python3
endif
CARGO_FLAGS := --features "$(FEATURES)" --no-default-features
default: test
.PHONY: test publish
test:
cargo test $(CARGO_FLAGS)
pip install tox
cargo test
cargo clippy
tox
cd examples/word-count && tox
cd examples/rustapi_module && tox
for example in examples/*; do tox -e py --workdir $$example; done
publish:
cargo test
cargo publish --manifest-path pyo3-derive-backend/Cargo.toml
cargo publish --manifest-path pyo3cls/Cargo.toml
cargo publish

View File

@ -5,10 +5,10 @@ set -ex
### Setup latest mdbook version ################################################
INSTALLED=$(echo $(mdbook --version 2>/dev/null || echo "mdbook none") | cut -d' ' -f1)
PINNED=0.1.5
PINNED=0.2.1
if [ "$PINNED" != "$INSTALLED" ]; then
URL=https://github.com/rust-lang-nursery/mdBook/releases/download/v${PINNED}/mdbook-v${PINNED}-x86_64-unknown-linux-gnu.tar.gz
URL=https://github.com/rust-lang-nursery/mdBook/releases/download/v${PINNED}/mdbook-v${PINNED}-x86_64-unknown-linux-musl.tar.gz
curl -SsL $URL | tar xvz -C $HOME/.cargo/bin
fi

View File

@ -19,8 +19,8 @@ _latest() {
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=$TRAVIS_RUST_VERSION
export PATH=$PATH:$HOME/.cargo/bin
rustup component add clippy-preview
rustup component add clippy
rustup component add rustfmt
### Setup kcov #################################################################

View File

@ -1,18 +1,11 @@
#!/bin/sh
#!/bin/bash
set -ex
cargo build --features $FEATURES
cargo clippy --features $FEATURES
cargo fmt --all -- --check
cargo test --features $FEATURES
cargo clippy --features $FEATURES
for example in examples/*; do
cd $example
if [ -f tox.ini ]; then
tox -e py
else
pip install -e .
pytest -v tests
fi
cd $TRAVIS_BUILD_DIR
tox -e py --workdir $example
done