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 - pip install 'travis-cargo<0.2' --user
- export PATH=$HOME/.local/bin:$PATH - export PATH=$HOME/.local/bin:$PATH
script: sh travis.sh script: ./travis.sh
env: env:
global: 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>"] authors = ["David Tolnay <dtolnay@gmail.com>"]
publish = false publish = false
[workspace]
[dependencies] [dependencies]
serde = { path = "../../serde" } serde = { path = "../../serde" }
serde_derive = { path = "../../serde_derive" } serde_derive = { path = "../../serde_derive" }

84
travis.sh Normal file → Executable file
View File

@ -1,24 +1,70 @@
#!/bin/bash #!/bin/bash
set -ev
if [ "${CLIPPY}" = "true" ]; then set -e
if cargo install clippy -f; then
(cd serde && cargo clippy --features unstable-testing -- -Dclippy) DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
(cd serde_derive && cargo clippy --features unstable-testing -- -Dclippy)
(cd test_suite && cargo clippy --features unstable-testing -- -Dclippy) channel() {
(cd test_suite/deps && cargo clippy -- -Dclippy) if [ -n "${TRAVIS}" ]; then
(cd test_suite/no_std && cargo clippy -- -Dclippy) if [ "${TRAVIS_RUST_VERSION}" = "${CHANNEL}" ]; then
pwd
(set -x; cargo "$@")
fi
else else
echo "could not compile clippy, ignoring clippy tests" pwd
(set -x; cargo "+${CHANNEL}" "$@")
fi 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 else
(cd serde && travis-cargo build) CHANNEL=nightly
(cd serde && travis-cargo --only beta test) cargo clean
(cd serde && travis-cargo --only nightly test -- --features unstable-testing) cd "$DIR/serde"
(cd serde && travis-cargo build -- --no-default-features) channel build
(cd serde && travis-cargo --only nightly build -- --no-default-features --features alloc) channel build --no-default-features
(cd serde && travis-cargo --only nightly build -- --no-default-features --features collections) channel build --no-default-features --features alloc
(cd test_suite && travis-cargo --only beta test) channel build --no-default-features --features collections
(cd test_suite/deps && travis-cargo --only nightly build) channel test --features unstable-testing
(cd test_suite travis-cargo --only nightly test -- --features unstable-testing) cd "$DIR/test_suite/deps"
(cd test_suite/no_std && travis-cargo --only nightly build) 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 fi