Switch CI to Azure Pipelines (#171)

This commit is contained in:
Carl Lerche 2019-02-28 12:08:29 -08:00 committed by GitHub
parent c5d70481bd
commit de799582fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 143 additions and 38 deletions

View File

@ -1,36 +0,0 @@
---
language: rust
sudo: false
before_script:
- rustup component add rustfmt
matrix:
include:
- rust: nightly
- rust: stable
before_deploy: cargo doc --all --no-deps
allow_failures:
- rust: nightly
script:
- cargo fmt --all -- --check
- cargo test --all
deploy:
provider: pages
skip_cleanup: true
github_token: $GH_TOKEN
target_branch: gh-pages
local_dir: target/doc
on:
branch: master
repo: tower-rs/tower
rust: stable
env:
global:
secure: e3Rw+pE2XE5N9q/irDo4Od9K1+mGg1HZmanNjDW2abA0m+FaxpqmtSxDcPvsHEpms/vLVLg5AGN+nP7EDhNwHhm8gPjwdaNJi3v60+p3+oQz3bhR53t+8KFR35C3XuP17mXOLYbvM7zhFieQiRwknxcVh+oTHejZk7/tY511JfhQV4R72M9LGgfUCN+mvOTwyCuZ+UuTnxkklVQ2RzlzkZ8XTbfIw7P4DoHEbWCf1vV2D/sSdb73bU26Y9GggCHb+VFDlX+Xtu8BTAB+NHzNXlGcWqzvg0yAqepGUyFO9hbUjN1jj28IEdKeGRJi3lw50i+ZeX5a8+OBjzbFuGEtmBO1dfCMJxLNIWsLu5bd3t65pBHMzXIipJ5x6SfDtAREn8uK1GbP44bhTp+USDDaoUaZujlF8u1R7RJtbeUwYHZj3qDdeqSIVawDMPcWeR5lulUZu/Qna13PJtXAiM6oVy0HmRlqlDT5HvXyYX+vm8MGji8z+LL6eBim8MzSD93aEJhA/bBpkLTbpFGFtiypzx95DxSoNhogo2dhUE9noM+gKEDoSUDBdmUNiYdSIZKFaSej8DrLjwqDKAuDJlWzfYxNVe8CAjBsf3PB22MRTGAGTOt/70pUJOQjJ4Ec2wwJxAJu1mFGMprJ41nen5th3GwQO6Y7eFF67s7uI8R8rto=
notifications:
email:
on_success: never

View File

@ -3,8 +3,13 @@
Tower is a library of modular and reusable components for building robust
networking clients and servers.
[![Build Status](https://travis-ci.org/tower-rs/tower.svg?branch=master)](https://travis-ci.org/tower-rs/tower)
[![Gitter](https://badges.gitter.im/tower-rs/tower.svg)](https://gitter.im/tower-rs/tower)
[![Build Status][azure-badge]][azure-url]
[![Gitter][gitter-badge]][gitter-url]
[azure-badge]: https://dev.azure.com/tower-rs/Tower/_apis/build/status/tower-rs.tower?branchName=master
[azure-url]: https://dev.azure.com/tower-rs/Tower/_build/latest?definitionId=1&branchName=master
[gitter-badge]: https://badges.gitter.im/tower-rs/tower.svg
[gitter-url]: https://gitter.im/tower-rs/tower
## Overview

35
azure-pipelines.yml Normal file
View File

@ -0,0 +1,35 @@
trigger: ["master"]
pr: ["master"]
jobs:
- template: ci/azure-rustfmt.yml
parameters:
name: rustfmt
# Basic test run on all platforms
- template: ci/azure-test-stable.yml
parameters:
name: Linux_Stable
displayName: Test
vmImage: ubuntu-16.04
crates:
- balance
- buffer
- discover
- filter
- in-flight-limit
- layer
- mock
- rate-limit
- reconnect
- retry
- service
- timeout
- util
- watch
- template: ci/azure-deploy-docs.yml
parameters:
dependsOn:
- rustfmt
- Linux_Stable

40
ci/azure-deploy-docs.yml Normal file
View File

@ -0,0 +1,40 @@
parameters:
dependsOn: []
jobs:
- job: documentation
displayName: 'Deploy API Documentation'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
pool:
vmImage: 'Ubuntu 16.04'
dependsOn:
- ${{ parameters.dependsOn }}
steps:
- template: azure-install-rust.yml
parameters:
platform: ${{parameters.name}}
rust_version: stable
- script: |
cargo doc --all --no-deps
cp -R target/doc '$(Build.BinariesDirectory)'
displayName: 'Generate Documentation'
- script: |
set -e
ls -la
git init
git config user.name 'Deployment Bot (from Azure Pipelines)'
git config user.email 'deploy@tower-rs.com'
echo 'machine github.com' > ~/.netrc
echo 'login carllerche' >> ~/.netrc
echo 'password $(GITHUB_TOKEN)' >> ~/.netrc
git remote add origin https://github.com/tower-rs/tower
git branch gh-pages origin/gh-pages
git checkout gh-pages
git add .
git commit -m 'Deploy Tower API documentation'
git push origin gh-pages
env:
GITHUB_TOKEN: $(githubPersonalToken)
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Deploy Documentation'

26
ci/azure-install-rust.yml Normal file
View File

@ -0,0 +1,26 @@
steps:
- ${{ if not(startsWith(parameters.platform, 'Windows')) }}:
# Linux and macOS.
- script: |
set -e
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
env:
RUSTUP_TOOLCHAIN: ${{parameters.rust_version}}
displayName: Install rust
- ${{ if startsWith(parameters.platform, 'Windows') }}:
# Windows.
- script: |
echo "windows"
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN%
set PATH=%PATH%;%USERPROFILE%\.cargo\bin
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
env:
RUSTUP_TOOLCHAIN: ${{parameters.rust_version}}
displayName: Install rust (windows)
# All platforms.
- bash: |
rustc -Vv
cargo -V
displayName: Query rust and cargo versions

18
ci/azure-rustfmt.yml Normal file
View File

@ -0,0 +1,18 @@
jobs:
# Check formatting
- job: ${{ parameters.name }}
displayName: Check rustfmt
pool:
vmImage: ubuntu-16.04
steps:
- template: azure-install-rust.yml
parameters:
platform: Linux
# Pin the version of Rust in case rustfmt changes.
rust_version: 1.32.0
- bash: |
rustup component add rustfmt
displayName: Install rustfmt
- bash: |
cargo fmt --all -- --check
displayName: Check formatting

17
ci/azure-test-stable.yml Normal file
View File

@ -0,0 +1,17 @@
parameters:
crates: []
jobs:
- job: ${{ parameters.name }}
displayName: ${{ parameters.displayName }}
pool:
vmImage: ${{ parameters.vmImage }}
steps:
- template: azure-install-rust.yml
parameters:
platform: ${{parameters.name}}
rust_version: stable
- ${{ each crate in parameters.crates }}:
- script: cargo test -p tower-${{ crate }}
displayName: cargo test -p tower-${{ crate }}