From 39c77976335ef8e56a9739bf06a1af453dd95a26 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 31 Jan 2017 09:17:33 -0800 Subject: [PATCH 1/5] Allow running travis build locally --- .travis.yml | 2 +- Cargo.toml | 9 ++++ test_suite/deps/Cargo.toml | 2 + travis.sh | 86 +++++++++++++++++++++++++++++--------- 4 files changed, 78 insertions(+), 21 deletions(-) create mode 100644 Cargo.toml mode change 100644 => 100755 travis.sh diff --git a/.travis.yml b/.travis.yml index c415551e..8f492748 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ before_script: - pip install 'travis-cargo<0.2' --user - export PATH=$HOME/.local/bin:$PATH -script: sh travis.sh +script: ./travis.sh env: global: diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000..601a709e --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[workspace] +members = [ + "serde", + "serde_codegen_internals", + "serde_derive", + "serde_test", + "test_suite", + "test_suite/no_std", +] diff --git a/test_suite/deps/Cargo.toml b/test_suite/deps/Cargo.toml index 40bd1bb5..fbe2f2cd 100644 --- a/test_suite/deps/Cargo.toml +++ b/test_suite/deps/Cargo.toml @@ -4,6 +4,8 @@ version = "0.0.0" authors = ["David Tolnay "] publish = false +[workspace] + [dependencies] serde = { path = "../../serde" } serde_derive = { path = "../../serde_derive" } diff --git a/travis.sh b/travis.sh old mode 100644 new mode 100755 index 225869ee..f37a7a07 --- a/travis.sh +++ b/travis.sh @@ -1,24 +1,70 @@ #!/bin/bash -set -ev -if [ "${CLIPPY}" = "true" ]; then - if cargo install clippy -f; then - (cd serde && cargo clippy --features unstable-testing -- -Dclippy) - (cd serde_derive && cargo clippy --features unstable-testing -- -Dclippy) - (cd test_suite && cargo clippy --features unstable-testing -- -Dclippy) - (cd test_suite/deps && cargo clippy -- -Dclippy) - (cd test_suite/no_std && cargo clippy -- -Dclippy) + +set -e + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +channel() { + if [ -n "${TRAVIS}" ]; then + if [ "${TRAVIS_RUST_VERSION}" = "${CHANNEL}" ]; then + pwd + (set -x; cargo "$@") + fi else - echo "could not compile clippy, ignoring clippy tests" + pwd + (set -x; cargo "+${CHANNEL}" "$@") fi +} + +if [ -n "${CLIPPY}" ]; then + if [ -n "${TRAVIS}" ]; then + # cached installation will not work on a later nightly + cargo install clippy --force + fi + + cd "$DIR/serde" + cargo clippy --features unstable-testing -- -Dclippy + + cd "$DIR/serde_derive" + cargo clippy --features unstable-testing -- -Dclippy + + cd "$DIR/test_suite" + cargo clippy --features unstable-testing -- -Dclippy + + cd "$DIR/test_suite/no_std" + cargo clippy -- -Dclippy else - (cd serde && travis-cargo build) - (cd serde && travis-cargo --only beta test) - (cd serde && travis-cargo --only nightly test -- --features unstable-testing) - (cd serde && travis-cargo build -- --no-default-features) - (cd serde && travis-cargo --only nightly build -- --no-default-features --features alloc) - (cd serde && travis-cargo --only nightly build -- --no-default-features --features collections) - (cd test_suite && travis-cargo --only beta test) - (cd test_suite/deps && travis-cargo --only nightly build) - (cd test_suite travis-cargo --only nightly test -- --features unstable-testing) - (cd test_suite/no_std && travis-cargo --only nightly build) -fi \ No newline at end of file + CHANNEL=nightly + cargo clean + cd "$DIR/serde" + channel build + channel build --no-default-features + channel build --no-default-features --features alloc + channel build --no-default-features --features collections + channel test --features unstable-testing + cd "$DIR/test_suite/deps" + channel build + cd "$DIR/test_suite" + channel test --features unstable-testing + cd "$DIR/test_suite/no_std" + channel build + + CHANNEL=beta + cargo clean + cd "$DIR/serde" + channel build + cd "$DIR/test_suite" + channel test + + CHANNEL=stable + cargo clean + cd "$DIR/serde" + channel build + channel build --no-default-features + + CHANNEL=1.13.0 + cargo clean + cd "$DIR/serde" + channel build + channel build --no-default-features +fi From b47e1a6dc3fa6489820f6ef98901d384c4848c50 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 31 Jan 2017 12:02:03 -0800 Subject: [PATCH 2/5] Allow clippy failure in travis --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8f492748..b5968d21 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,10 @@ matrix: include: - rust: nightly env: CLIPPY=true + allow_failures: + - rust: nightly + env: CLIPPY=true + fast_finish: true before_script: - pip install 'travis-cargo<0.2' --user From 9a0f05d00dac7c1fef757f317c4f6f0c5caa5fe8 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 31 Jan 2017 12:09:44 -0800 Subject: [PATCH 3/5] Speed up the travis clippy installation --- travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis.sh b/travis.sh index f37a7a07..7c981c60 100755 --- a/travis.sh +++ b/travis.sh @@ -19,7 +19,7 @@ channel() { if [ -n "${CLIPPY}" ]; then if [ -n "${TRAVIS}" ]; then # cached installation will not work on a later nightly - cargo install clippy --force + cargo install clippy --debug --force fi cd "$DIR/serde" From 48f4deac556ad6a33de484c42eceeee5c4f0c421 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 31 Jan 2017 12:18:57 -0800 Subject: [PATCH 4/5] No more travis-cargo --- .travis.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index b5968d21..d5bf00f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,12 +18,4 @@ matrix: env: CLIPPY=true fast_finish: true -before_script: - - pip install 'travis-cargo<0.2' --user - - export PATH=$HOME/.local/bin:$PATH - script: ./travis.sh - -env: - global: - - TRAVIS_CARGO_NIGHTLY_FEATURE="" From 34b39083bca36b4bc58137c8b97caa6282f4c456 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 1 Feb 2017 00:38:02 -0800 Subject: [PATCH 5/5] No error if clippy install fails --- .travis.yml | 4 ---- travis.sh | 7 ++++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index d5bf00f3..05bd0df7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,9 +13,5 @@ matrix: include: - rust: nightly env: CLIPPY=true - allow_failures: - - rust: nightly - env: CLIPPY=true - fast_finish: true script: ./travis.sh diff --git a/travis.sh b/travis.sh index 7c981c60..24de5d28 100755 --- a/travis.sh +++ b/travis.sh @@ -17,9 +17,10 @@ channel() { } if [ -n "${CLIPPY}" ]; then - if [ -n "${TRAVIS}" ]; then - # cached installation will not work on a later nightly - cargo install clippy --debug --force + # cached installation will not work on a later nightly + if [ -n "${TRAVIS}" ] && ! cargo install clippy --debug --force; then + echo "COULD NOT COMPILE CLIPPY, IGNORING CLIPPY TESTS" + exit fi cd "$DIR/serde"