From e594728507715e6ba916effb95c655b8e53602f3 Mon Sep 17 00:00:00 2001 From: Colin Moore Date: Mon, 8 Jul 2019 17:00:00 -0400 Subject: [PATCH] chore(ci): add azure pipelines configuration Add a basic azure configuration that runs tests and benchmarks on linux, mac, and windows. Closes #1673 --- azure-pipelines.yml | 49 +++++++++++++++++++++++++++++++++++++++ ci/azure-install-rust.yml | 33 ++++++++++++++++++++++++++ ci/azure-test.yml | 36 ++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 azure-pipelines.yml create mode 100644 ci/azure-install-rust.yml create mode 100644 ci/azure-test.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000..8a78381dab --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,49 @@ +trigger: ["master"] +pr: ["master"] + +variables: + features: '' + bench: 'false' + +strategy: + matrix: + windows-nightly: + imageName: 'vs2017-win2016' + rust: nightly + mac-nightly: + imageName: 'macos-10.13' + rust: nightly + bench: 'true' + # linux-stable: + # imageName: 'ubuntu-16.04' + # rust: stable + # features: '--no-default-features --features runtime,__internal_happy_eyeballs_tests' + # linux-stable-no-features: + # imageName: 'ubuntu-16.04' + # rust: stable + # features: '--no-default-features' + # linux-beta: + # imageName: 'ubuntu-16.04' + # rust: beta + # features: '--no-default-features --features runtime,__internal_happy_eyeballs_tests' + linux-nightly: + imageName: 'ubuntu-16.04' + rust: nightly + features: '--no-default-features --features runtime,nightly' + bench: 'true' + # linux-minimum-supported-version: + # imageName: 'ubuntu-16.04' + # rust: stable + # features: '--no-default-features --features runtime' + +pool: + vmImage: $(imageName) + +steps: + - template: ci/azure-install-rust.yml + parameters: + rust_version: $(rust) + - template: ci/azure-test.yml + parameters: + features: $(features) + bench: $(bench) diff --git a/ci/azure-install-rust.yml b/ci/azure-install-rust.yml new file mode 100644 index 0000000000..e960b2f5da --- /dev/null +++ b/ci/azure-install-rust.yml @@ -0,0 +1,33 @@ +steps: + # Linux and macOS. + - script: | + set -e + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none + export PATH=$PATH:$HOME/.cargo/bin + rustup toolchain install $RUSTUP_TOOLCHAIN + rustup default $RUSTUP_TOOLCHAIN + echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" + env: + RUSTUP_TOOLCHAIN: ${{parameters.rust_version}} + displayName: "Install rust (*nix)" + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + + # Windows. + - script: | + curl -sSf -o rustup-init.exe https://win.rustup.rs + rustup-init.exe -y --default-toolchain none + set PATH=%PATH%;%USERPROFILE%\.cargo\bin + rustup toolchain install %RUSTUP_TOOLCHAIN% + rustup default %RUSTUP_TOOLCHAIN% + echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin" + env: + RUSTUP_TOOLCHAIN: ${{parameters.rust_version}} + displayName: "Install rust (Windows)" + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + + # All platforms. + - script: | + rustup toolchain list + rustc -Vv + cargo -V + displayName: Query rust and cargo versions diff --git a/ci/azure-test.yml b/ci/azure-test.yml new file mode 100644 index 0000000000..98d322069b --- /dev/null +++ b/ci/azure-test.yml @@ -0,0 +1,36 @@ +steps: + # Linux and macOS. + - script: | + set -e + cargo build $FEATURES + cargo test $FEATURES + env: + FEATURES: ${{parameters.features}} + displayName: "Build & Test (*nix)" + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + + # Windows. + - script: | + cargo build %FEATURES% + cargo test %FEATURES% + env: + FEATURES: ${{parameters.features}} + displayName: "Build & Test (Windows)" + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + + + # Linux and macOS. + - ${{ if eq(parameters.bench, 'true') }}: + - script: cargo bench $FEATURES + env: + FEATURES: ${{parameters.features}} + displayName: "Benchmark (*nix)" + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + + # Windows. + - ${{ if eq(parameters.bench, 'true') }}: + - script: cargo bench %FEATURES% + env: + FEATURES: ${{parameters.features}} + displayName: "Benchmark (Windows)" + condition: eq( variables['Agent.OS'], 'Windows_NT' )