diff --git a/.rustup.sh b/.rustup.sh deleted file mode 100755 index 18b5216..0000000 --- a/.rustup.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# Use rustup to locally run the same suite of tests as .travis.yml. -# (You should first install/update 1.0.0, beta, and nightly.) - -set -ex - -for toolchain in 1.0.0 beta nightly; do - run="rustup run $toolchain" - $run cargo build --verbose - $run /usr/bin/env make test - $run $PWD/.travis/test_features.sh - if [ $toolchain = nightly ]; then - $run $PWD/.travis/test_nightly.sh - fi - $run cargo doc -done diff --git a/.travis.yml b/.travis.yml index 80df3af..af0cca8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,19 @@ language: rust rust: - - 1.0.0 + - 1.8.0 + - 1.15.0 - beta - nightly sudo: false script: - cargo build --verbose - - make test - - .travis/test_features.sh - - | - [ $TRAVIS_RUST_VERSION != nightly ] || .travis/test_nightly.sh + - ./ci/test_full.sh - cargo doc after_success: | [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && [ $TRAVIS_RUST_VERSION = nightly ] && - ssh-agent .travis/deploy.sh + ssh-agent ./ci/deploy.sh notifications: email: on_success: never diff --git a/.travis/test_features.sh b/.travis/test_features.sh deleted file mode 100755 index 109fd50..0000000 --- a/.travis/test_features.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -set -ex - -for feature in '' bigint rational complex; do - cargo build --verbose --no-default-features --features="$feature" -done diff --git a/.travis/test_nightly.sh b/.travis/test_nightly.sh deleted file mode 100755 index 7ed93dd..0000000 --- a/.travis/test_nightly.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -set -ex - -cargo bench --verbose - -cargo test --verbose --manifest-path=macros/Cargo.toml -cargo test --verbose --manifest-path=derive/Cargo.toml - -# Build test for the serde feature -cargo build --verbose --features "serde" - -# Downgrade serde and build test the 0.7.0 channel as well -cargo update -p serde --precise 0.7.0 -cargo build --verbose --features "serde" diff --git a/Makefile b/Makefile deleted file mode 100644 index bce28aa..0000000 --- a/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -CARGO_CMD ?= cargo - -packages = bigint complex integer iter rational traits - -test: - $(MAKE) run-all TASK="test" - -run-all: $(packages) - $(CARGO_CMD) $(TASK) - -$(packages): - $(CARGO_CMD) $(TASK) --manifest-path $@/Cargo.toml - -.PHONY: $(packages) test diff --git a/README.md b/README.md index e615cce..e9a7489 100644 --- a/README.md +++ b/README.md @@ -22,3 +22,9 @@ and this to your crate root: ```rust extern crate num; ``` + +## Compatibility + +Most of the `num` crates are tested for rustc 1.8 and greater. +The exceptions are `num-derive` which requires at least rustc 1.15, +and the deprecated `num-macros` which requires nightly rustc. diff --git a/.travis/.gitignore b/ci/.gitignore similarity index 100% rename from .travis/.gitignore rename to ci/.gitignore diff --git a/.travis/deploy.enc b/ci/deploy.enc similarity index 100% rename from .travis/deploy.enc rename to ci/deploy.enc diff --git a/.travis/deploy.sh b/ci/deploy.sh similarity index 68% rename from .travis/deploy.sh rename to ci/deploy.sh index c342036..02372e2 100755 --- a/.travis/deploy.sh +++ b/ci/deploy.sh @@ -6,7 +6,7 @@ cp doc/* target/doc/ pip install ghp-import --user $HOME/.local/bin/ghp-import -n target/doc -openssl aes-256-cbc -K $encrypted_9e86330b283d_key -iv $encrypted_9e86330b283d_iv -in .travis/deploy.enc -out .travis/deploy -d -chmod 600 .travis/deploy -ssh-add .travis/deploy +openssl aes-256-cbc -K $encrypted_9e86330b283d_key -iv $encrypted_9e86330b283d_iv -in ./ci/deploy.enc -out ./ci/deploy -d +chmod 600 ./ci/deploy +ssh-add ./ci/deploy git push -qf ssh://git@github.com/${TRAVIS_REPO_SLUG}.git gh-pages diff --git a/ci/rustup.sh b/ci/rustup.sh new file mode 100755 index 0000000..f263dd8 --- /dev/null +++ b/ci/rustup.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Use rustup to locally run the same suite of tests as .travis.yml. +# (You should first install/update 1.8.0, 1.15.0, beta, and nightly.) + +set -ex + +for toolchain in 1.8.0 1.15.0 beta nightly; do + run="rustup run $toolchain" + $run cargo build --verbose + $run $PWD/ci/test_full.sh $toolchain + $run cargo doc +done diff --git a/ci/test_full.sh b/ci/test_full.sh new file mode 100755 index 0000000..b750b71 --- /dev/null +++ b/ci/test_full.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -ex + +echo Testing num on rustc ${TRAVIS_RUST_VERSION:=$1} + +# All of these packages should build and test everywhere. +for package in bigint complex integer iter rational traits; do + cargo build --manifest-path $package/Cargo.toml + cargo test --manifest-path $package/Cargo.toml +done + +# Each isolated feature should also work everywhere. +for feature in '' bigint rational complex; do + cargo build --verbose --no-default-features --features="$feature" + cargo test --verbose --no-default-features --features="$feature" +done + +# Build test for the serde feature +cargo build --verbose --features "serde" + +# Downgrade serde and build test the 0.7.0 channel as well +cargo update -p serde --precise 0.7.0 +cargo build --verbose --features "serde" + + +if [ "$TRAVIS_RUST_VERSION" = 1.8.0 ]; then exit; fi + +# num-derive should build on 1.15.0+ +cargo build --verbose --manifest-path=derive/Cargo.toml + + +if [ "$TRAVIS_RUST_VERSION" != nightly ]; then exit; fi + +# num-derive testing requires compiletest_rs, which requires nightly +cargo test --verbose --manifest-path=derive/Cargo.toml + +# num-macros only works on nightly, soon to be deprecated +cargo build --verbose --manifest-path=macros/Cargo.toml +cargo test --verbose --manifest-path=macros/Cargo.toml + +# benchmarks only work on nightly +cargo bench --verbose