Skip to content

Commit a5a0603

Browse files
committed
Gate Travis builds by default
1 parent 560fcb6 commit a5a0603

File tree

3 files changed

+58
-32
lines changed

3 files changed

+58
-32
lines changed

.travis.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ sudo: required
22
dist: trusty
33
services:
44
- docker
5+
language: rust
56

67
matrix:
78
include:
@@ -118,33 +119,23 @@ branches:
118119
- stable
119120
- auto
120121

121-
notifications:
122-
webhooks: http://buildbot.rust-lang.org/homu/travis
123-
124122
install:
125-
- sudo pip install awscli
126-
- aws configure set preview.cloudfront true
127-
- curl https://static.rust-lang.org/rustup.sh |
128-
sh -s -- --prefix=$HOME/rust --spec=nightly-2017-04-25 --with-target=$TARGET
123+
- rustup target add $TARGET
129124

130125
script:
131-
- mkdir -p target/$TARGET
132-
- if [ ! -z "$DOCKER" ]; then
133-
sh ci/build-run-docker.sh "$DOCKER" "$TARGET" "$SKIP_TESTS";
126+
- mkdir -p target/$TARGET;
127+
- >
128+
if [[ "$TRAVIS_PULL_REQUEST" == "false" || "$ALLOW_PR" == "1" ]]; then
129+
if [ ! -z "$DOCKER" ]; then
130+
sh ci/build-run-docker.sh "$DOCKER" "$TARGET" "$SKIP_TESTS";
131+
else
132+
PATH=$HOME/rust/bin:$PATH sh ci/run.sh;
133+
fi
134134
else
135-
PATH=$HOME/rust/bin:$PATH sh ci/run.sh;
135+
echo 'skipping build';
136136
fi
137-
# Install kcov dependencies
138-
# FIXME: busted!
139-
#- if [ "$TARGET" == "x86_64-unknown-linux-gnu" ]; then
140-
# wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz;
141-
# tar xzf master.tar.gz && mkdir kcov-master/build && cd kcov-master/build && cmake .. && make;
142-
# sudo make install && cd ../..;
143-
# echo "Uploading coverage... $TRAVIS_JOB_ID";
144-
# find target/debug/deps/*-* -executable -exec kcov --verify --coveralls-id=$TRAVIS_JOB_ID --exclude-pattern=/.cargo target/kcov '{}' \;;
145-
# find target/debug/*-* -executable ! -name rustup-rs -exec kcov --verify --coveralls-id=$TRAVIS_JOB_ID --exclude-pattern=/.cargo target/kcov '{}' \;;
146-
# fi
147-
# prepare for a deploy if this will be a deployment
137+
138+
before_deploy:
148139
- bash ci/prepare-deploy-travis.sh
149140

150141
deploy:
@@ -163,4 +154,6 @@ deploy:
163154

164155
# FIXME: I don't know if this really works
165156
after_deploy:
157+
- sudo pip install awscli
158+
- aws configure set preview.cloudfront true
166159
- aws cloudfront create-invalidation --paths "rustup/$TARGET/* rustup/dev/$TARGET/* rustup/www/* rustup/dev/www/* rustup/* rustup/dev/*"

appveyor.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
image: Visual Studio 2017
22
environment:
3-
RUSTFLAGS: -Zunstable-options -Ctarget-feature=+crt-static
3+
RUSTFLAGS: -Ctarget-feature=+crt-static
44
matrix:
5+
- TARGET: x86_64-pc-windows-msvc
6+
ALLOW_PR: 1
7+
- TARGET: i686-pc-windows-msvc
58
# FIXME
69
#- TARGET: i686-pc-windows-msvc
710
# BUILD_MSI: 1
811
- TARGET: i686-pc-windows-gnu
912
MINGW_DIR: mingw32
1013
- TARGET: x86_64-pc-windows-gnu
1114
MINGW_DIR: mingw64
12-
- TARGET: i686-pc-windows-msvc
13-
- TARGET: x86_64-pc-windows-msvc
1415
access_token:
1516
secure: q8Wqx0brgfpOYFQqWauvucE2h0o1WYb41a3gKaCKV9QiE4eTz6qLNlqyC3mdsp4Q
1617
branches:
@@ -20,6 +21,9 @@ branches:
2021
- auto
2122

2223
install:
24+
# If this is a PR and we're not allowed to test PRs, skip the whole build
25+
- if defined APPVEYOR_PULL_REQUEST_NUMBER if NOT defined ALLOW_PR appveyor exit
26+
2327
# Install MSYS2 and MINGW (32-bit & 64-bit)
2428
- ps: |
2529
# Check if MSYS2 was restored from cache
@@ -28,12 +32,12 @@ install:
2832
# Download and install MINGW (32-bit)
2933
Write-Host "Installing MinGW (32-bit)..." -ForegroundColor Cyan
3034
Write-Host "Downloading installation package..."
31-
appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z -FileName mingw.7z
35+
appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z -FileName mingw.7z
3236
} elseif($env:MINGW_DIR -eq "mingw64") {
3337
# Download and install MINGW (64-bit)
3438
Write-Host "Installing MinGW (64-bit)..." -ForegroundColor Cyan
3539
Write-Host "Downloading installation package..."
36-
appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z -FileName mingw.7z
40+
appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z -FileName mingw.7z
3741
}
3842
Write-Host "Extracting installation package..."
3943
7z x -y mingw.7z -oC:\msys64 | Out-Null
@@ -43,8 +47,8 @@ install:
4347
}
4448
4549
# Install rust, x86_64-pc-windows-msvc host
46-
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
47-
- rustup-init.exe -y --default-toolchain=nightly-2017-04-25-x86_64-pc-windows-msvc
50+
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
51+
- rustup-init.exe -y --default-host=x86_64-pc-windows-msvc
4852
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
4953

5054
# Install the target we're compiling for

src/rustup-mock/src/mock_bin_src.rs

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,46 @@ use std::env::consts::EXE_SUFFIX;
22
use std::env;
33
use std::fs::File;
44
use std::io::{self, Write, Read};
5+
use std::path::PathBuf;
56
use std::process::Command;
67

78
fn main() {
89
let mut args = env::args().skip(1);
910
match args.next().as_ref().map(|s| &**s) {
1011
Some("--version") => {
11-
let me = env::current_exe().unwrap().display().to_string();
12-
let version_file = format!("{}.version", me);
13-
let hash_file = format!("{}.version-hash", me);
12+
let me = env::current_exe().unwrap();
13+
let mut version_file = PathBuf::from(format!("{}.version", me.display()));
14+
let mut hash_file = PathBuf::from(format!("{}.version-hash", me.display()));
1415
let mut version = String::new();
1516
let mut hash = String::new();
17+
if !version_file.exists() {
18+
// There's a "MAJOR HACKS" statement in `toolchain.rs` right
19+
// now where custom toolchains use a `cargo.exe` that's
20+
// temporarily located elsewhere so they can execute the correct
21+
// `rustc.exe`. This means that our dummy version files may not
22+
// be just next to use.
23+
//
24+
// Detect this here and work around it.
25+
assert!(cfg!(windows));
26+
assert!(env::var_os("RUSTUP_TOOLCHAIN").is_some());
27+
let mut alt = me.clone();
28+
alt.pop(); // remove our filename
29+
assert!(alt.ends_with("fallback"));
30+
alt.pop(); // pop 'fallback'
31+
alt.push("toolchains");
32+
33+
let mut part = PathBuf::from("bin");
34+
part.push(me.file_name().unwrap());
35+
36+
let toolchain = alt.read_dir().unwrap()
37+
.map(|e| e.unwrap().path())
38+
.find(|p| p.join(&part).exists())
39+
.unwrap();
40+
let path = toolchain.join(part);
41+
42+
version_file = format!("{}.version", path.display()).into();
43+
hash_file = format!("{}.version-hash", path.display()).into();
44+
}
1645
File::open(&version_file).unwrap().read_to_string(&mut version).unwrap();
1746
File::open(&hash_file).unwrap().read_to_string(&mut hash).unwrap();
1847
println!("{} ({})", version, hash);

0 commit comments

Comments
 (0)