From 9436efb80e751b92f6ae7930fc57c0069a27bc77 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 15 Sep 2018 15:34:05 -0700 Subject: [PATCH] Move CI commands into travis.yml and appveyor.yml --- .travis.yml | 112 +++++++++++++++++++++++++++++++++++++++--------- appveyor.yml | 28 +++++++++++- travis.sh | 117 --------------------------------------------------- 3 files changed, 118 insertions(+), 139 deletions(-) delete mode 100755 travis.sh diff --git a/.travis.yml b/.travis.yml index 9124ebbb..9c0650ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,97 @@ -sudo: false language: rust -cache: cargo - -# run builds for all the trains (and more) -rust: - - stable - - beta - - nightly - - 1.13.0 - - 1.15.0 - - 1.20.0 - - 1.21.0 - - 1.25.0 - - 1.26.0 matrix: include: - - rust: nightly - env: CLIPPY=true - - rust: nightly - env: EMSCRIPTEN=true - script: nvm install 9 && ./travis.sh + - rust: stable + script: | + cd "${TRAVIS_BUILD_DIR}/serde" + cargo build --features rc + cargo build --no-default-features + cd "${TRAVIS_BUILD_DIR}/serde_test" + cargo build + cargo test -script: ./travis.sh + - rust: beta + script: | + cd "${TRAVIS_BUILD_DIR}/serde" + cargo build --features rc + cd "${TRAVIS_BUILD_DIR}/test_suite" + cargo test + + - rust: nightly + script: | + cd "${TRAVIS_BUILD_DIR}/serde" + cargo build + cargo build --no-default-features + cargo build --no-default-features --features alloc + cargo build --no-default-features --features rc,alloc + cargo test --features rc,unstable + cd "${TRAVIS_BUILD_DIR}/test_suite/deps" + cargo build + cd "${TRAVIS_BUILD_DIR}/test_suite" + cargo test --features unstable + cd "${TRAVIS_BUILD_DIR}/test_suite/no_std" + cargo build + + - rust: 1.13.0 + script: | + cd "${TRAVIS_BUILD_DIR}/serde" + cargo build --features rc + cargo build --no-default-features + cd "${TRAVIS_BUILD_DIR}/serde_test" + cargo build + + - rust: 1.15.0 + script: | + cd "${TRAVIS_BUILD_DIR}/serde_derive" + cargo build + + - rust: 1.20.0 + - rust: 1.21.0 + - rust: 1.25.0 + - rust: 1.26.0 + + - rust: nightly + env: CLIPPY + script: | + if rustup component add clippy-preview; then + cargo clippy -- -Dclippy + + cd "${TRAVIS_BUILD_DIR}/serde" + cargo clippy --features rc,unstable -- -Dclippy + + cd "${TRAVIS_BUILD_DIR}/serde_derive" + cargo clippy -- -Dclippy + + cd "${TRAVIS_BUILD_DIR}/serde_test" + cargo clippy -- -Dclippy + + cd "${TRAVIS_BUILD_DIR}/test_suite" + cargo clippy --features unstable -- -Dclippy + + cd "${TRAVIS_BUILD_DIR}/test_suite/no_std" + cargo clippy -- -Dclippy + fi + + - rust: nightly + env: EMSCRIPTEN + script: | + nvm install 9 + + CARGO_WEB_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/koute/cargo-web/releases/latest) + CARGO_WEB_VERSION=$(echo "${CARGO_WEB_RELEASE}" | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/') + CARGO_WEB_URL="https://github.com/koute/cargo-web/releases/download/${CARGO_WEB_VERSION}/cargo-web-x86_64-unknown-linux-gnu.gz" + + mkdir -p ~/.cargo/bin + echo "Downloading cargo-web from: ${CARGO_WEB_URL}" + curl -L "${CARGO_WEB_URL}" | gzip -d > ~/.cargo/bin/cargo-web + chmod +x ~/.cargo/bin/cargo-web + + cd "${TRAVIS_BUILD_DIR}/test_suite" + cargo web test --target=asmjs-unknown-emscripten --nodejs + cargo web test --target=wasm32-unknown-emscripten --nodejs + +script: | + cd "${TRAVIS_BUILD_DIR}/serde" + cargo build --no-default-features + cargo build diff --git a/appveyor.yml b/appveyor.yml index 92d40511..d081e06b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,5 +13,29 @@ install: build: false -test_script: - - sh -c 'PATH=`rustc --print sysroot`/bin:$PATH ./travis.sh' +for: + - matrix: + only: + - APPVEYOR_RUST_CHANNEL: stable + test_script: + - cd %APPVEYOR_BUILD_FOLDER%\serde + - cargo build --features rc + - cargo build --no-default-features + - cd %APPVEYOR_BUILD_FOLDER%\serde_test + - cargo build + - cargo test + + - matrix: + only: + - APPVEYOR_RUST_CHANNEL: nightly + test_script: + - cd %APPVEYOR_BUILD_FOLDER%\serde + - cargo build + - cargo build --no-default-features + - cargo build --no-default-features --features alloc + - cargo build --no-default-features --features rc,alloc + - cargo test --features rc,unstable + - cd %APPVEYOR_BUILD_FOLDER%\test_suite\deps + - cargo build + - cd %APPVEYOR_BUILD_FOLDER%\test_suite + - cargo test --features unstable diff --git a/travis.sh b/travis.sh deleted file mode 100755 index 9002e3e5..00000000 --- a/travis.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash - -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 - elif [ -n "${APPVEYOR}" ]; then - if [ "${APPVEYOR_RUST_CHANNEL}" = "${CHANNEL}" ]; then - pwd - (set -x; cargo "$@") - fi - else - pwd - (set -x; cargo "+${CHANNEL}" "$@") - fi -} - -if [ -n "${CLIPPY}" ]; then - # 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" - cargo clippy --features 'rc unstable' -- -Dclippy - - cd "$DIR/serde_derive" - cargo clippy -- -Dclippy - - cd "$DIR/serde_test" - cargo clippy -- -Dclippy - - cd "$DIR/test_suite" - cargo clippy --features unstable -- -Dclippy - - cd "$DIR/test_suite/no_std" - cargo clippy -- -Dclippy -elif [ -n "${EMSCRIPTEN}" ]; then - CARGO_WEB_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/koute/cargo-web/releases/latest) - CARGO_WEB_VERSION=$(echo "${CARGO_WEB_RELEASE}" | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/') - CARGO_WEB_URL="https://github.com/koute/cargo-web/releases/download/${CARGO_WEB_VERSION}/cargo-web-x86_64-unknown-linux-gnu.gz" - - mkdir -p ~/.cargo/bin - echo "Downloading cargo-web from: ${CARGO_WEB_URL}" - curl -L "${CARGO_WEB_URL}" | gzip -d > ~/.cargo/bin/cargo-web - chmod +x ~/.cargo/bin/cargo-web - - cd "$DIR/test_suite" - cargo web test --target=asmjs-unknown-emscripten --nodejs - cargo web test --target=wasm32-unknown-emscripten --nodejs -else - CHANNEL=nightly - cd "$DIR" - 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 'rc alloc' - channel test --features 'rc unstable' - cd "$DIR/test_suite/deps" - channel build - cd "$DIR/test_suite" - channel test --features unstable - if [ -z "${APPVEYOR}" ]; then - cd "$DIR/test_suite/no_std" - channel build - fi - - CHANNEL=beta - cd "$DIR" - cargo clean - cd "$DIR/serde" - channel build --features rc - cd "$DIR/test_suite" - channel test - - CHANNEL=stable - cd "$DIR" - cargo clean - cd "$DIR/serde" - channel build --features rc - channel build --no-default-features - cd "$DIR/serde_test" - channel build - channel test - - CHANNEL=1.13.0 - cd "$DIR" - cargo clean - cd "$DIR/serde" - channel build --features rc - channel build --no-default-features - cd "$DIR/serde_test" - channel build - - CHANNEL=1.15.0 - cd "$DIR" - cargo clean - cd "$DIR/serde_derive" - channel build - - for CHANNEL in 1.20.0 1.21.0 1.25.0 1.26.0; do - cd "$DIR" - cargo clean - cd "$DIR/serde" - channel build --no-default-features - channel build - done -fi