Skip to content

Commit a2f5431

Browse files
committed
Auto merge of #7139 - rust-lang:azure-pipelines, r=alexcrichton
Set up CI with Azure Pipelines
2 parents c8fad5b + c2354b9 commit a2f5431

File tree

9 files changed

+220
-137
lines changed

9 files changed

+220
-137
lines changed

.travis.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ Learn more at https://doc.rust-lang.org/cargo/
66

77
## Code Status
88

9-
[![Build Status](https://travis-ci.com/rust-lang/cargo.svg?branch=master)](https://travis-ci.com/rust-lang/cargo)
10-
[![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)
9+
[![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)
1110

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

appveyor.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

azure-pipelines.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
trigger:
2+
branches:
3+
include:
4+
- '*'
5+
exclude:
6+
- master
7+
pr:
8+
- master
9+
10+
jobs:
11+
- job: Linux
12+
pool:
13+
vmImage: ubuntu-16.04
14+
steps:
15+
- template: ci/azure-test-all.yml
16+
strategy:
17+
matrix:
18+
stable:
19+
TOOLCHAIN: stable
20+
beta:
21+
TOOLCHAIN: beta
22+
nightly:
23+
TOOLCHAIN: nightly
24+
variables:
25+
OTHER_TARGET: i686-unknown-linux-gnu
26+
27+
- job: macOS
28+
pool:
29+
vmImage: macos-10.13
30+
steps:
31+
- template: ci/azure-test-all.yml
32+
variables:
33+
TOOLCHAIN: stable
34+
OTHER_TARGET: i686-apple-darwin
35+
36+
- job: Windows
37+
pool:
38+
vmImage: windows-2019
39+
steps:
40+
- template: ci/azure-test-all.yml
41+
strategy:
42+
matrix:
43+
x86_64-msvc:
44+
TOOLCHAIN: stable-x86_64-pc-windows-msvc
45+
OTHER_TARGET: i686-pc-windows-msvc
46+
- job: rustfmt
47+
pool:
48+
vmImage: ubuntu-16.04
49+
steps:
50+
- template: ci/azure-install-rust.yml
51+
- bash: rustup component add rustfmt
52+
displayName: "Install rustfmt"
53+
- bash: cargo fmt --all -- --check
54+
displayName: "Check rustfmt (cargo)"
55+
- bash: cd crates/cargo-test-macro && cargo fmt --all -- --check
56+
displayName: "Check rustfmt (cargo-test-macro)"
57+
- bash: cd crates/crates-io && cargo fmt --all -- --check
58+
displayName: "Check rustfmt (crates-io)"
59+
- bash: cd crates/resolver-tests && cargo fmt --all -- --check
60+
displayName: "Check rustfmt (resolver-tests)"
61+
variables:
62+
TOOLCHAIN: stable
63+
64+
- job: resolver
65+
pool:
66+
vmImage: ubuntu-16.04
67+
steps:
68+
- template: ci/azure-install-rust.yml
69+
- bash: cargo test --manifest-path crates/resolver-tests/Cargo.toml
70+
displayName: "Resolver tests"
71+
variables:
72+
TOOLCHAIN: stable
73+
74+
- job: docs
75+
pool:
76+
vmImage: ubuntu-16.04
77+
steps:
78+
- template: ci/azure-install-rust.yml
79+
- bash: |
80+
set -e
81+
mkdir mdbook
82+
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
83+
echo "##vso[task.prependpath]`pwd`/mdbook"
84+
displayName: "Install mdbook"
85+
- bash: cargo doc --no-deps
86+
displayName: "Build documentation"
87+
- bash: cd src/doc && mdbook build --dest-dir ../../target/doc
88+
displayName: "Build mdbook documentation"
89+
variables:
90+
TOOLCHAIN: stable
91+

ci/azure-install-rust.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
steps:
2+
- bash: |
3+
set -e
4+
if command -v rustup; then
5+
echo `command -v rustup` `rustup -V` already installed
6+
rustup self update
7+
elif [ "$AGENT_OS" = "Windows_NT" ]; then
8+
curl -sSf -o rustup-init.exe https://win.rustup.rs
9+
rustup-init.exe -y --default-toolchain $TOOLCHAIN
10+
echo "##vso[task.prependpath]$USERPROFILE/.cargo/bin"
11+
else
12+
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TOOLCHAIN
13+
echo "##vso[task.prependpath]$HOME/.cargo/bin"
14+
fi
15+
displayName: Install rustup
16+
17+
- bash: |
18+
set -e
19+
rustup update $TOOLCHAIN
20+
rustup default $TOOLCHAIN
21+
displayName: Install rust
22+
23+
- bash: |
24+
set -ex
25+
rustup -V
26+
rustc -Vv
27+
cargo -V
28+
displayName: Query rust and cargo versions

ci/azure-test-all.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
steps:
2+
- checkout: self
3+
fetchDepth: 1
4+
5+
- template: azure-install-rust.yml
6+
7+
- bash: rustup target add $OTHER_TARGET
8+
displayName: "Install cross-compile target"
9+
10+
- bash: sudo apt install gcc-multilib
11+
displayName: "Install gcc-multilib (linux)"
12+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
13+
14+
# Some tests rely on a clippy command to run, so let's try to install clippy to
15+
# we can be sure to run those tests.
16+
- bash: rustup component add clippy || echo "clippy not available"
17+
displayName: "Install clippy (maybe)"
18+
19+
# Deny warnings on CI to avoid warnings getting into the codebase, and note the
20+
# `force-system-lib-on-osx` which is intended to fix compile issues on OSX where
21+
# compiling curl from source on OSX yields linker errors on Azure.
22+
#
23+
# Note that the curl issue is traced back to alexcrichton/curl-rust#279 where it
24+
# looks like the OSX version we're actually running on is such that a symbol is
25+
# emitted that's never worked. For now force the system library to be used to
26+
# fix the link errors.
27+
- bash: cargo test --features 'deny-warnings curl/force-system-lib-on-osx'
28+
displayName: "cargo test"

tests/testsuite/config.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@ use std::borrow::Borrow;
22
use std::collections;
33
use std::fs;
44

5-
use crate::support::{lines_match, paths, project};
5+
use crate::support::{paths, project};
66
use cargo::core::{enable_nightly_features, Shell};
77
use cargo::util::config::{self, Config};
88
use cargo::util::toml::{self, VecStringOrBool as VSOB};
99
use serde::Deserialize;
1010

11+
fn lines_match(a: &str, b: &str) -> bool {
12+
// Perform a small amount of normalization for filesystem paths before we
13+
// send this to the `lines_match` function.
14+
crate::support::lines_match(&a.replace("\\", "/"), &b.replace("\\", "/"))
15+
}
16+
1117
#[cargo_test]
1218
fn read_env_vars_for_config() {
1319
let p = project()

0 commit comments

Comments
 (0)