diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3f4a6d0de..4f52d9a6a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,59 +1,132 @@ -# A list of vmImage names can be found at: -# https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops#use-a-microsoft-hosted-agent -strategy: - matrix: - windows-stable: - imageName: 'vs2017-win2016' - rustup_toolchain: stable - mac-stable: - imageName: 'macos-10.14' - rustup_toolchain: stable - linux-stable: - imageName: 'ubuntu-16.04' - rustup_toolchain: stable - linux-beta: - imageName: 'ubuntu-16.04' - rustup_toolchain: beta - linux-nightly: - imageName: 'ubuntu-16.04' - rustup_toolchain: nightly +trigger: + branches: + include: ['*'] + tags: + include: ['*'] -pool: - vmImage: $(imageName) +jobs: + - job: 'Clippy' + pool: + vmImage: 'ubuntu-16.04' + container: 'rust:latest' + steps: + - script: rustup component add clippy + displayName: Install clippy + - script: cargo clippy --all + displayName: Run Clippy -steps: - - script: | - git submodule update --init - displayName: Update submodules - - script: | - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN - echo "##vso[task.setvariable variable=PATH;]$HOME/.cargo/bin:$PATH" - displayName: Install rust - condition: ne( variables['Agent.OS'], 'Windows_NT' ) - - script: | - curl -sSf -o rustup-init.exe https://win.rustup.rs - rustup-init.exe -yv --default-toolchain %RUSTUP_TOOLCHAIN% - echo "##vso[task.setvariable variable=PATH;]%USERPROFILE%\.cargo\bin;%PATH%" - displayName: Windows install rust - condition: eq( variables['Agent.OS'], 'Windows_NT' ) - - script: | - rustup update - rustup component add rustfmt - displayName: Update rust toolchains - - script: | - rustc -vV - cargo -vV - displayName: Show installed rust+cargo version - - script: | - sudo ./get-deps - displayName: Install system dependencies - condition: ne( variables['Agent.OS'], 'Windows_NT' ) - - script: cargo build --all - displayName: Cargo build - - script: cargo test --all - displayName: Cargo test - - script: cargo fmt --all -- --check - displayName: Run Rustfmt - - script: ci/deploy.sh - displayName: Packaging - condition: ne( variables['Agent.OS'], 'Windows_NT' ) + - job: 'Rustfmt' + pool: + vmImage: 'ubuntu-16.04' + container: 'rust:latest' + steps: + - script: rustup component add rustfmt + displayName: Install Rustfmt + - script: cargo fmt --all -- --check + displayName: Check formatting + + - job: 'Test' + # A list of vmImage names can be found at: + # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops#use-a-microsoft-hosted-agent + strategy: + matrix: + windows-stable: + imageName: 'vs2017-win2016' + rustup_toolchain: stable + mac-stable: + imageName: 'macos-10.14' + rustup_toolchain: stable + linux-stable: + imageName: 'ubuntu-16.04' + rustup_toolchain: stable + linux-beta: + imageName: 'ubuntu-16.04' + rustup_toolchain: beta + linux-nightly: + imageName: 'ubuntu-16.04' + rustup_toolchain: nightly + pool: + vmImage: $(imageName) + steps: + - checkout: self + submodules: true + #- script: | + # git submodule update --init + # displayName: Update submodules + - script: | + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN + echo "##vso[task.setvariable variable=PATH;]$HOME/.cargo/bin:$PATH" + displayName: Install rust + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + - script: | + curl -sSf -o rustup-init.exe https://win.rustup.rs + rustup-init.exe -yv --default-toolchain %RUSTUP_TOOLCHAIN% + echo "##vso[task.setvariable variable=PATH;]%USERPROFILE%\.cargo\bin;%PATH%" + displayName: Windows install rust + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + - script: | + rustup update + displayName: Update rust toolchains + - script: | + rustc -vV + cargo -vV + displayName: Show installed rust+cargo version + - script: | + sudo ./get-deps + displayName: Install system dependencies + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + - script: cargo build --all + displayName: Cargo build + - script: cargo test --all + displayName: Cargo test + - script: ci/deploy.sh + displayName: Packaging + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + + - job: 'Package' + strategy: + matrix: + windows-stable: + imageName: 'vs2017-win2016' + rustup_toolchain: stable + mac-stable: + imageName: 'macos-10.14' + rustup_toolchain: stable + linux-stable: + imageName: 'ubuntu-16.04' + rustup_toolchain: stable + pool: + vmImage: $(imageName) + steps: + - checkout: self + submodules: true + #- script: | + # git submodule update --init + # displayName: Update submodules + - script: | + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN + echo "##vso[task.setvariable variable=PATH;]$HOME/.cargo/bin:$PATH" + displayName: Install rust + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + - script: | + curl -sSf -o rustup-init.exe https://win.rustup.rs + rustup-init.exe -yv --default-toolchain %RUSTUP_TOOLCHAIN% + echo "##vso[task.setvariable variable=PATH;]%USERPROFILE%\.cargo\bin;%PATH%" + displayName: Windows install rust + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + - script: | + rustup update + displayName: Update rust toolchains + - script: | + rustc -vV + cargo -vV + displayName: Show installed rust+cargo version + - script: | + sudo ./get-deps + displayName: Install system dependencies + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + - script: cargo build --release --all + displayName: Cargo build + - script: ci/deploy.sh + displayName: Packaging + condition: ne( variables['Agent.OS'], 'Windows_NT' ) diff --git a/ci/deploy.sh b/ci/deploy.sh index 6982c3453..296d66f30 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -1,5 +1,6 @@ #!/bin/bash set -x +set -e if [[ "$TRAVIS" != "" ]] ; then DEPLOY_ENV_TYPE="travis" @@ -7,6 +8,8 @@ if [[ "$TRAVIS" != "" ]] ; then elif [[ "$APPVEYOR" != "" ]] ; then DEPLOY_ENV_TYPE="appveyor" TAG_NAME=$APPVEYOR_REPO_TAG_NAME +elif [[ "$TF_BUILD" != "" ]] ; then + DEPLOY_ENV_TYPE="azure" else DEPLOY_ENV_TYPE="adhoc" fi