From cf71ae0d453817e9ac984cf425c4f6695cf24315 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 30 Nov 2016 11:12:49 -0800 Subject: [PATCH] Slight tweaks to CI * Pass `--quiet` to all tests to have some quieter output * Skip builds on branches other than `auto-cargo` as it's already checked * Check the right env var for repo branches on appveyor * Only run a few builds on PRs --- .travis.yml | 25 +++++++++++++------------ Makefile.in | 3 ++- appveyor.yml | 20 ++++++++------------ src/ci/docker/run.sh | 3 +++ src/ci/run.sh | 15 ++++++++++++++- 5 files changed, 40 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index 961c8488c99..51e50435f8b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,9 @@ os: linux services: - docker +git: + depth: 1 + matrix: include: # stable linux builds, tested @@ -13,6 +16,7 @@ matrix: ALT=i686-unknown-linux-gnu IMAGE=dist MAKE_TARGETS="test distcheck doc install uninstall" + ALLOW_PR=1 - env: TARGET=i686-unknown-linux-gnu IMAGE=dist MAKE_TARGETS=test-unit-i686-unknown-linux-gnu @@ -99,11 +103,15 @@ before_script: sh -s -- --add-target=$ALT --disable-sudo -y --prefix=`rustc --print sysroot`; fi script: - - if [ "$TRAVIS_OS_NAME" = "osx" ]; then - SRC=. src/ci/run.sh $TARGET; - else - src/ci/docker/run.sh $IMAGE $TARGET; - fi + - > + if [ "$ALLOW_PR" = "" ] && [ "$TRAVIS_BRANCH" != "auto-cargo" ]; then + echo skipping, not a full build; + elif [ "$TRAVIS_OS_NAME" = "osx" ]; then + SRC=. src/ci/run.sh $TARGET; + else + src/ci/docker/run.sh $IMAGE $TARGET; + fi + after_success: | [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && @@ -121,13 +129,6 @@ notifications: email: on_success: never -branches: - only: - - master - - auto-cargo - - beta - - stable - before_deploy: - mkdir -p deploy/$TRAVIS_COMMIT - cp target/$TARGET/release/dist/cargo-*-$TARGET.tar.gz diff --git a/Makefile.in b/Makefile.in index 79d9a52e094..ef02d4547ba 100644 --- a/Makefile.in +++ b/Makefile.in @@ -103,7 +103,8 @@ test-unit-$(1): target/openssl/$(1).stamp cargo-$(1) @mkdir -p $$(CFG_BUILD_DIR)/target/$(1)/cit $$(CARGO) test --target $(1) \ --manifest-path $(S)Cargo.toml \ - $$(OPT_FLAG) $$(CARGOFLAGS) $$(VERBOSE_FLAG) $$(only) + $$(OPT_FLAG) $$(CARGOFLAGS) $$(VERBOSE_FLAG) $$(only) -- \ + --quiet endef $(foreach target,$(CFG_TARGET),$(eval $(call CARGO_TARGET,$(target)))) diff --git a/appveyor.yml b/appveyor.yml index 905b35b9c32..cfc59f75d0b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,12 +1,10 @@ environment: matrix: - TARGET: x86_64-pc-windows-gnu - ARCH: amd64 BITS: 64 CFG_DISABLE_CROSS_TESTS: 1 MAKE_TARGETS: test-unit-x86_64-pc-windows-gnu - TARGET: i686-pc-windows-gnu - ARCH: x86 BITS: 32 MINGW_URL: https://s3.amazonaws.com/rust-lang-ci MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z @@ -15,13 +13,12 @@ environment: MAKE_TARGETS: test-unit-i686-pc-windows-gnu - TARGET: i686-pc-windows-msvc BITS: 32 - ARCH: x86 MAKE_TARGETS: test-unit-i686-pc-windows-msvc CFG_DISABLE_CROSS_TESTS: 1 + ALLOW_PR: 1 - TARGET: x86_64-pc-windows-msvc OTHER_TARGET: i686-pc-windows-msvc BITS: 64 - ARCH: amd64 MAKE_TARGETS: test-unit-x86_64-pc-windows-msvc install: @@ -38,6 +35,8 @@ install: - cargo -V - git submodule update --init +clone_depth: 1 + build: false test_script: @@ -48,16 +47,13 @@ cache: - C:\Users\appveyor\.cargo\registry after_test: - - mkdir %APPVEYOR_REPO_COMMIT% + - ps: New-Item -Path "${env:APPVEYOR_REPO_COMMIT}" -ItemType "directory" + - ps: New-Item -Path "target" -ItemType "directory" -Force + - ps: New-Item -Path "target/${env:TARGET}" -ItemType "directory" -Force + - ps: New-Item -Path "target/${env:TARGET}/release" -ItemType "directory" -Force + - ps: New-Item -Path "target/${env:TARGET}/release/dist" -ItemType "directory" -Force - ps: Get-ChildItem -Path target\${env:TARGET}\release\dist -Filter '*.tar.gz' | Move-Item -Destination ${env:APPVEYOR_REPO_COMMIT} -branches: - only: - - master - - auto-cargo - - beta - - stable - artifacts: - path: $(APPVEYOR_REPO_COMMIT)\cargo-*-$(TARGET).tar.gz name: cargo diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index 1a0bb0c21c7..f0546972be6 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -37,6 +37,9 @@ exec docker run \ --env SRC=/checkout \ --env CARGO_HOME=/cargo \ --env TRAVIS_BRANCH=$TRAVIS_BRANCH \ + --env TRAVIS_PULL_REQUEST_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH \ + --env ALLOW_PR=$ALLOW_PR \ + --env CI=$CI \ --volume "$HOME/.cargo:/cargo" \ --volume `rustc --print sysroot`:/rust:ro \ --volume `pwd`/target:/tmp/target \ diff --git a/src/ci/run.sh b/src/ci/run.sh index a532757d9f3..1f20a7652d9 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -19,7 +19,7 @@ fi BRANCH=$TRAVIS_BRANCH if [ "$BRANCH" = "" ]; then - BRANCH=$APPVEYOR_BRANCH + BRANCH=$APPVEYOR_REPO_BRANCH fi if [ "$BRANCH" = "stable" ]; then @@ -34,6 +34,19 @@ else CHANNEL=dev fi +# We want to only run tests in a few situations: +# +# * All tests on the auto-cargo branch +# * One test on PRs +# * Any tests done locally +# +# This means that here if we're on CI, then we skip tests if it's not the right +# branch or if we're not configured to run a test on PRs +if [ -n "$CI" ] && [ "$BRANCH" != "auto-cargo" ] && [ "$ALLOW_PR" = "" ]; then + echo no build necessary, skipping + exit 0 +fi + $SRC/configure \ --prefix=/tmp/obj/install \ --target=$TARGET \