Allow running travis build locally

This commit is contained in:
David Tolnay 2017-01-31 09:17:33 -08:00
parent 368784949e
commit 39c7797633
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
4 changed files with 78 additions and 21 deletions

View File

@ -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:

9
Cargo.toml Normal file
View File

@ -0,0 +1,9 @@
[workspace]
members = [
"serde",
"serde_codegen_internals",
"serde_derive",
"serde_test",
"test_suite",
"test_suite/no_std",
]

View File

@ -4,6 +4,8 @@ version = "0.0.0"
authors = ["David Tolnay <dtolnay@gmail.com>"]
publish = false
[workspace]
[dependencies]
serde = { path = "../../serde" }
serde_derive = { path = "../../serde_derive" }

86
travis.sh Normal file → Executable file
View File

@ -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
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