Skip to content

Commit

Permalink
Merge pull request #200 from pietroalbini/improve-ci
Browse files Browse the repository at this point in the history
The great Travis speedup
  • Loading branch information
aidanhs committed Mar 21, 2018
2 parents c4a24cc + c0bd07e commit 30f3c70
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 42 deletions.
72 changes: 44 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,51 @@
sudo: false
dist: trusty

language: rust
cache: cargo
rust:
- stable
- nightly-2018-01-20

env:
global:
# Versions known to work with pinned nightly.
- CLIPPY_VERSION=0.0.180
- RUSTFMT_VERSION=0.3.6

before_script:
- export PATH=$HOME/.cargo/bin:$PATH
- |
if ! type -p cargo-install-update; then
cargo install --force cargo-update
else
cargo install-update -i cargo-update
fi
- |
if [[ $TRAVIS_RUST_VERSION =~ nightly-* ]]; then
cargo install-update -i "clippy:$CLIPPY_VERSION"
cargo install-update -i "rustfmt-nightly:$RUSTFMT_VERSION"
fi
script:
- |
RUSTFLAGS=-Dwarnings cargo build &&
cargo test
- |
[[ ! $TRAVIS_RUST_VERSION =~ nightly-* ]] || RUSTFLAGS=-Dwarnings cargo fmt -- --write-mode diff
- |
[[ ! $TRAVIS_RUST_VERSION =~ nightly-* ]] || RUSTFLAGS=-Dwarnings cargo clippy
- RUSTFLAGS=-Dwarnings

# Versions known to work with pinned nightly for lints.
- CLIPPY_VERSION=0.0.187

matrix:
include:
# Tests on all the channels
- env: TASK=test
rust: stable
- env: TASK=test
rust: beta
- env: TASK=test
rust: nightly

# Execute lints with the pinned nightly we know works.
- env: TASK=lint
rust: nightly-2018-03-07

# Don't block CI if a nightly is faulty
fast_finish: true
allow_failures:
- rust: nightly

before_script: |
if [[ $TASK = "lint" ]]; then
if ! type -p cargo-install-update; then
cargo install --force cargo-update
else
cargo install-update -i cargo-update
fi
rustup component add rustfmt-preview
cargo install-update -i "clippy:$CLIPPY_VERSION"
fi
script: |
if [[ $TASK = "lint" ]]; then
cargo fmt -- --write-mode diff
cargo clippy
elif [[ $TASK = "test" ]]; then
cargo build && cargo test
fi
11 changes: 5 additions & 6 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ pub enum Crater {
env: DockerEnv,
},

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

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

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

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

#[structopt(name = "serve-report", about = "serve report")] Serve,
#[structopt(name = "serve-report", about = "serve report")]
Serve,
}

impl Crater {
Expand Down
4 changes: 2 additions & 2 deletions src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ pub fn rust_container(config: RustEnv) -> ContainerConfig {

ContainerConfig {
image_name: IMAGE_NAME,
mounts: mounts,
env: env,
mounts,
env,
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ pub fn define_(ex_name: &str, tcs: Vec<Toolchain>, crates: Vec<Crate>, mode: ExM
);
let ex = Experiment {
name: ex_name.to_string(),
crates: crates,
crates,
toolchains: tcs,
mode: mode,
mode,
};
fs::create_dir_all(&ex_dir(&ex.name))?;
let json = serde_json::to_string(&ex)?;
Expand Down
2 changes: 1 addition & 1 deletion src/report/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn generate_report(config: &Config, ex: &ex::Experiment) -> Result<TestResul
let rel_log = writer.result_path_fragement();

Ok(BuildTestResult {
res: res,
res,
log: format!("{}", rel_log.display()),
})
});
Expand Down
6 changes: 3 additions & 3 deletions src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ fn log_command(mut cmd: Command, capture: bool, quiet: bool) -> Result<ProcessOu
}))?;

Ok(ProcessOutput {
status: status,
stdout: stdout,
stderr: stderr,
status,
stdout,
stderr,
})
}

Expand Down

0 comments on commit 30f3c70

Please sign in to comment.