Skip to content

Commit deef0f8

Browse files
committed
Setup CI with Azure Pipelines
1 parent f227776 commit deef0f8

File tree

9 files changed

+215
-137
lines changed

9 files changed

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

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: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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. It's sort of
22+
# unclear how to fix these linker errors and why it worked previously on Travis,
23+
# but if you can remove the `curl` feature please do.
24+
- bash: cargo test --features 'deny-warnings curl/force-system-lib-on-osx'
25+
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)