Improve testing setup
This commit is contained in:
parent
5edd263371
commit
2dc8813cf8
|
@ -13,6 +13,8 @@ dist/
|
||||||
.hypothesis/
|
.hypothesis/
|
||||||
.eggs/
|
.eggs/
|
||||||
venv*
|
venv*
|
||||||
|
guide/book/
|
||||||
|
examples/*/py
|
||||||
|
|
||||||
*.so
|
*.so
|
||||||
*.out
|
*.out
|
||||||
|
|
25
Makefile
25
Makefile
|
@ -1,28 +1,13 @@
|
||||||
.PHONY: default test publish
|
.PHONY: 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
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
cargo test $(CARGO_FLAGS)
|
cargo test
|
||||||
pip install tox
|
cargo clippy
|
||||||
tox
|
tox
|
||||||
cd examples/word-count && tox
|
for example in examples/*; do tox -e py --workdir $$example; done
|
||||||
cd examples/rustapi_module && tox
|
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
|
cargo test
|
||||||
cargo publish --manifest-path pyo3-derive-backend/Cargo.toml
|
cargo publish --manifest-path pyo3-derive-backend/Cargo.toml
|
||||||
cargo publish --manifest-path pyo3cls/Cargo.toml
|
cargo publish --manifest-path pyo3cls/Cargo.toml
|
||||||
cargo publish
|
cargo publish
|
||||||
|
|
|
@ -5,10 +5,10 @@ set -ex
|
||||||
### Setup latest mdbook version ################################################
|
### Setup latest mdbook version ################################################
|
||||||
|
|
||||||
INSTALLED=$(echo $(mdbook --version 2>/dev/null || echo "mdbook none") | cut -d' ' -f1)
|
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
|
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
|
curl -SsL $URL | tar xvz -C $HOME/.cargo/bin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ _latest() {
|
||||||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=$TRAVIS_RUST_VERSION
|
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=$TRAVIS_RUST_VERSION
|
||||||
export PATH=$PATH:$HOME/.cargo/bin
|
export PATH=$PATH:$HOME/.cargo/bin
|
||||||
|
|
||||||
rustup component add clippy-preview
|
rustup component add clippy
|
||||||
|
rustup component add rustfmt
|
||||||
|
|
||||||
### Setup kcov #################################################################
|
### Setup kcov #################################################################
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
cargo build --features $FEATURES
|
cargo fmt --all -- --check
|
||||||
cargo clippy --features $FEATURES
|
|
||||||
cargo test --features $FEATURES
|
cargo test --features $FEATURES
|
||||||
|
cargo clippy --features $FEATURES
|
||||||
|
|
||||||
for example in examples/*; do
|
for example in examples/*; do
|
||||||
cd $example
|
tox -e py --workdir $example
|
||||||
if [ -f tox.ini ]; then
|
|
||||||
tox -e py
|
|
||||||
else
|
|
||||||
pip install -e .
|
|
||||||
pytest -v tests
|
|
||||||
fi
|
|
||||||
cd $TRAVIS_BUILD_DIR
|
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue