Skip to content

Commit 30f3c70

Browse files
authored
Merge pull request #200 from pietroalbini/improve-ci
The great Travis speedup
2 parents c4a24cc + c0bd07e commit 30f3c70

File tree

6 files changed

+57
-42
lines changed

6 files changed

+57
-42
lines changed

.travis.yml

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,51 @@
11
sudo: false
22
dist: trusty
3+
34
language: rust
45
cache: cargo
5-
rust:
6-
- stable
7-
- nightly-2018-01-20
86

97
env:
108
global:
11-
# Versions known to work with pinned nightly.
12-
- CLIPPY_VERSION=0.0.180
13-
- RUSTFMT_VERSION=0.3.6
14-
15-
before_script:
16-
- export PATH=$HOME/.cargo/bin:$PATH
17-
- |
18-
if ! type -p cargo-install-update; then
19-
cargo install --force cargo-update
20-
else
21-
cargo install-update -i cargo-update
22-
fi
23-
- |
24-
if [[ $TRAVIS_RUST_VERSION =~ nightly-* ]]; then
25-
cargo install-update -i "clippy:$CLIPPY_VERSION"
26-
cargo install-update -i "rustfmt-nightly:$RUSTFMT_VERSION"
27-
fi
28-
script:
29-
- |
30-
RUSTFLAGS=-Dwarnings cargo build &&
31-
cargo test
32-
- |
33-
[[ ! $TRAVIS_RUST_VERSION =~ nightly-* ]] || RUSTFLAGS=-Dwarnings cargo fmt -- --write-mode diff
34-
- |
35-
[[ ! $TRAVIS_RUST_VERSION =~ nightly-* ]] || RUSTFLAGS=-Dwarnings cargo clippy
9+
- RUSTFLAGS=-Dwarnings
10+
11+
# Versions known to work with pinned nightly for lints.
12+
- CLIPPY_VERSION=0.0.187
13+
14+
matrix:
15+
include:
16+
# Tests on all the channels
17+
- env: TASK=test
18+
rust: stable
19+
- env: TASK=test
20+
rust: beta
21+
- env: TASK=test
22+
rust: nightly
23+
24+
# Execute lints with the pinned nightly we know works.
25+
- env: TASK=lint
26+
rust: nightly-2018-03-07
27+
28+
# Don't block CI if a nightly is faulty
29+
fast_finish: true
30+
allow_failures:
31+
- rust: nightly
32+
33+
before_script: |
34+
if [[ $TASK = "lint" ]]; then
35+
if ! type -p cargo-install-update; then
36+
cargo install --force cargo-update
37+
else
38+
cargo install-update -i cargo-update
39+
fi
40+
41+
rustup component add rustfmt-preview
42+
cargo install-update -i "clippy:$CLIPPY_VERSION"
43+
fi
44+
45+
script: |
46+
if [[ $TASK = "lint" ]]; then
47+
cargo fmt -- --write-mode diff
48+
cargo clippy
49+
elif [[ $TASK = "test" ]]; then
50+
cargo build && cargo test
51+
fi

src/cli.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ pub enum Crater {
7070
env: DockerEnv,
7171
},
7272

73-
#[structopt(name = "create-lists", about = "create all the lists of crates")] CreateLists,
73+
#[structopt(name = "create-lists", about = "create all the lists of crates")]
74+
CreateLists,
7475

7576
#[structopt(name = "define-ex", about = "define an experiment")]
7677
DefineEx {
@@ -107,10 +108,7 @@ pub enum Crater {
107108
},
108109

109110
#[structopt(name = "copy-ex", about = "copy all data from one experiment to another")]
110-
CopyEx {
111-
ex1: Ex,
112-
ex2: Ex,
113-
},
111+
CopyEx { ex1: Ex, ex2: Ex },
114112

115113
#[structopt(name = "delete-ex", about = "delete shared data for experiment")]
116114
DeleteEx {
@@ -174,7 +172,8 @@ pub enum Crater {
174172
s3_prefix: Option<report::S3Prefix>,
175173
},
176174

177-
#[structopt(name = "serve-report", about = "serve report")] Serve,
175+
#[structopt(name = "serve-report", about = "serve report")]
176+
Serve,
178177
}
179178

180179
impl Crater {

src/docker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ pub fn rust_container(config: RustEnv) -> ContainerConfig {
104104

105105
ContainerConfig {
106106
image_name: IMAGE_NAME,
107-
mounts: mounts,
108-
env: env,
107+
mounts,
108+
env,
109109
}
110110
}
111111

src/ex.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ pub fn define_(ex_name: &str, tcs: Vec<Toolchain>, crates: Vec<Crate>, mode: ExM
136136
);
137137
let ex = Experiment {
138138
name: ex_name.to_string(),
139-
crates: crates,
139+
crates,
140140
toolchains: tcs,
141-
mode: mode,
141+
mode,
142142
};
143143
fs::create_dir_all(&ex_dir(&ex.name))?;
144144
let json = serde_json::to_string(&ex)?;

src/report/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn generate_report(config: &Config, ex: &ex::Experiment) -> Result<TestResul
6363
let rel_log = writer.result_path_fragement();
6464

6565
Ok(BuildTestResult {
66-
res: res,
66+
res,
6767
log: format!("{}", rel_log.display()),
6868
})
6969
});

src/run.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ fn log_command(mut cmd: Command, capture: bool, quiet: bool) -> Result<ProcessOu
212212
}))?;
213213

214214
Ok(ProcessOutput {
215-
status: status,
216-
stdout: stdout,
217-
stderr: stderr,
215+
status,
216+
stdout,
217+
stderr,
218218
})
219219
}
220220

0 commit comments

Comments
 (0)