Skip to content

Commit

Permalink
Set up CI with Azure Pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Jul 16, 2019
1 parent f4aca6d commit ce04a53
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 101 deletions.
75 changes: 0 additions & 75 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ Learn more at https://doc.rust-lang.org/cargo/

## Code Status

[![Build Status](https://travis-ci.com/rust-lang/cargo.svg?branch=master)](https://travis-ci.com/rust-lang/cargo)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-lang/cargo?branch=master&svg=true)](https://ci.appveyor.com/project/rust-lang-libs/cargo)
[![Build Status](https://dev.azure.com/rust-lang/cargo/_apis/build/status/rust-lang.cargo?branchName=master)](https://dev.azure.com/rust-lang/cargo/_build/latest?definitionId=18&branchName=master)

Code documentation: https://docs.rs/cargo/

Expand Down
22 changes: 0 additions & 22 deletions appveyor.yml

This file was deleted.

89 changes: 89 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
trigger:
branches:
exclude:
- master
pr:
- master

jobs:
- job: Linux
pool:
vmImage: ubuntu-16.04
steps:
- template: ci/azure-test-all.yml
strategy:
matrix:
stable:
TOOLCHAIN: stable
beta:
TOOLCHAIN: beta
nightly:
TOOLCHAIN: nightly
variables:
OTHER_TARGET: i686-unknown-linux-gnu

- job: macOS
pool:
vmImage: macos-10.13
steps:
- template: ci/azure-test-all.yml
variables:
TOOLCHAIN: stable
OTHER_TARGET: i686-apple-darwin

- job: Windows
pool:
vmImage: windows-2019
steps:
- template: ci/azure-test-all.yml
strategy:
matrix:
x86_64-msvc:
TOOLCHAIN: stable-x86_64-pc-windows-msvc
OTHER_TARGET: i686-pc-windows-msvc
- job: rustfmt
pool:
vmImage: ubuntu-16.04
steps:
- template: ci/azure-install-rust.yml
- bash: rustup component add rustfmt
displayName: "Install rustfmt"
- bash: cargo fmt --all -- --check
displayName: "Check rustfmt (cargo)"
- bash: cd crates/cargo-test-macro && cargo fmt --all -- --check
displayName: "Check rustfmt (cargo-test-macro)"
- bash: cd crates/crates-io && cargo fmt --all -- --check
displayName: "Check rustfmt (crates-io)"
- bash: cd crates/resolver-tests && cargo fmt --all -- --check
displayName: "Check rustfmt (resolver-tests)"
variables:
TOOLCHAIN: stable

- job: resolver
pool:
vmImage: ubuntu-16.04
steps:
- template: ci/azure-install-rust.yml
- bash: cargo test --manifest-path crates/resolver-tests/Cargo.toml
displayName: "Resolver tests"
variables:
TOOLCHAIN: stable

- job: docs
pool:
vmImage: ubuntu-16.04
steps:
- template: ci/azure-install-rust.yml
- bash: |
set -e
mkdir mdbook
curl -Lf https://github.com/rust-lang-nursery/mdBook/releases/download/v0.3.1/mdbook-v0.3.1-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo "##vso[task.prependpath]`pwd`/mdbook"
displayName: "Install mdbook"
- bash: cargo doc --no-deps
displayName: "Build documentation"
- bash: cd src/doc && mdbook build --dest-dir ../../target/doc
displayName: "Build mdbook documentation"
variables:
TOOLCHAIN: stable

28 changes: 28 additions & 0 deletions ci/azure-install-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
steps:
- bash: |
set -e
if command -v rustup; then
echo `command -v rustup` `rustup -V` already installed
rustup self update
elif [ "$AGENT_OS" = "Windows_NT" ]; then
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --default-toolchain $TOOLCHAIN
echo "##vso[task.prependpath]$USERPROFILE/.cargo/bin"
else
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TOOLCHAIN
echo "##vso[task.prependpath]$HOME/.cargo/bin"
fi
displayName: Install rustup
- bash: |
set -e
rustup update $TOOLCHAIN
rustup default $TOOLCHAIN
displayName: Install rust
- bash: |
set -ex
rustup -V
rustc -Vv
cargo -V
displayName: Query rust and cargo versions
25 changes: 25 additions & 0 deletions ci/azure-test-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
steps:
- checkout: self
fetchDepth: 1

- template: azure-install-rust.yml

- bash: rustup target add $OTHER_TARGET
displayName: "Install cross-compile target"

- bash: sudo apt install gcc-multilib
displayName: "Install gcc-multilib (linux)"
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))

# Some tests rely on a clippy command to run, so let's try to install clippy to
# we can be sure to run those tests.
- bash: rustup component add clippy || echo "clippy not available"
displayName: "Install clippy (maybe)"

# Deny warnings on CI to avoid warnings getting into the codebase, and note the
# `force-system-lib-on-osx` which is intended to fix compile issues on OSX where
# compiling curl from source on OSX yields linker errors on Azure. It's sort of
# unclear how to fix these linker errors and why it worked previously on Travis,
# but if you can remove the `curl` feature please do.
- bash: cargo test --features 'deny-warnings curl/force-system-lib-on-osx'
displayName: "cargo test"
15 changes: 13 additions & 2 deletions tests/testsuite/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,18 @@ impl Execs {
None => expected.to_string(),
Some(ref p) => match p.get_cwd() {
None => expected.to_string(),
Some(cwd) => expected.replace("[CWD]", &cwd.display().to_string()),
Some(cwd) => {
// Round-trip through `Url` and replace with that value.
// Most of the time `cwd` is byte-for-byte the same after
// round-tripping it through `Url`, but on
// Windows it might be the case that `cwd` looks like
// `c:\...` whereas after going through `Url` it looks like
// `C:\...`. To make sure our string assertions match what
// Cargo is doing internally we round-trip through `Url`.
let expected = expected.replace(&cwd.display().to_string(), "[CWD]");
let cwd_through_url = Url::from_file_path(cwd).unwrap().to_file_path().unwrap();
expected.replace("[CWD]", &cwd_through_url.display().to_string())
}
},
};

Expand Down Expand Up @@ -1740,7 +1751,7 @@ pub fn is_coarse_mtime() -> bool {
// This should actually be a test that `$CARGO_TARGET_DIR` is on an HFS
// filesystem, (or any filesystem with low-resolution mtimes). However,
// that's tricky to detect, so for now just deal with CI.
cfg!(target_os = "macos") && env::var("CI").is_ok()
cfg!(target_os = "macos") && env::var("TF_BUILD").is_ok()
}

/// Some CI setups are much slower then the equipment used by Cargo itself.
Expand Down

0 comments on commit ce04a53

Please sign in to comment.