Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up CI with Azure Pipelines #7139

Merged
merged 1 commit into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

91 changes: 91 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
trigger:
branches:
include:
- '*'
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
28 changes: 28 additions & 0 deletions ci/azure-test-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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.
#
# Note that the curl issue is traced back to alexcrichton/curl-rust#279 where it
# looks like the OSX version we're actually running on is such that a symbol is
# emitted that's never worked. For now force the system library to be used to
# fix the link errors.
- bash: cargo test --features 'deny-warnings curl/force-system-lib-on-osx'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some investigation and my results are at alexcrichton/curl-rust#279.

The reason it works on Travis is because it is using the real system curl, with the HTTP2 feature built-in. It looks like azure installs their own curl (/usr/local/opt/curl) which does not have HTTP2 enabled which fails this test, which causes it to be built statically, which hits the bug listed above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! I've updated the comment here to reflect the results of what you found.

FWIW I think that's why things worked by default on Travis but IIRC the curl-rust crate still tested compiling libcurl statically and it ended up working out, but it may have used different surface areas than Cargo itself.

displayName: "cargo test"
8 changes: 7 additions & 1 deletion tests/testsuite/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ use std::borrow::Borrow;
use std::collections;
use std::fs;

use crate::support::{lines_match, paths, project};
use crate::support::{paths, project};
use cargo::core::{enable_nightly_features, Shell};
use cargo::util::config::{self, Config};
use cargo::util::toml::{self, VecStringOrBool as VSOB};
use serde::Deserialize;

fn lines_match(a: &str, b: &str) -> bool {
// Perform a small amount of normalization for filesystem paths before we
// send this to the `lines_match` function.
crate::support::lines_match(&a.replace("\\", "/"), &b.replace("\\", "/"))
}

#[cargo_test]
fn read_env_vars_for_config() {
let p = project()
Expand Down
Loading