diff options
author | Carl Lerche <me@carllerche.com> | 2019-03-01 09:12:21 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-01 09:12:21 -0800 |
commit | 43d69d77e2b01322a5d2a378be02108e302d1bbf (patch) | |
tree | 2539c38871bc03fa24295c3a7771e4990fc7047c | |
parent | dbb04e310c061612a1bc585776c23400299e7ad0 (diff) |
Set up CI with Azure Pipelines (#926)
Use Azure Pipelines for CI. This migrates away from Travis and
Appveyor.
-rw-r--r-- | .appveyor.yml | 22 | ||||
-rw-r--r-- | .travis.yml | 136 | ||||
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | azure-pipelines.yml | 115 | ||||
-rw-r--r-- | ci/azure-cargo-check.yml | 27 | ||||
-rw-r--r-- | ci/azure-check-minrust.yml | 12 | ||||
-rw-r--r-- | ci/azure-cross-compile.yml | 21 | ||||
-rw-r--r-- | ci/azure-deploy-docs.yml | 38 | ||||
-rw-r--r-- | ci/azure-install-rust.yml | 27 | ||||
-rw-r--r-- | ci/azure-rustfmt.yml | 16 | ||||
-rw-r--r-- | ci/azure-test-stable.yml | 36 | ||||
-rw-r--r-- | ci/azure-tsan.yml | 34 | ||||
-rw-r--r-- | tokio-tls/tests/smoke.rs | 2 |
13 files changed, 330 insertions, 165 deletions
diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index d04ab464..00000000 --- a/.appveyor.yml +++ /dev/null @@ -1,22 +0,0 @@ -image: Visual Studio 2017 -environment: - matrix: - - TARGET: x86_64-pc-windows-msvc - platform: x64 - - TARGET: i686-pc-windows-msvc - platform: x86 - -install: - - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - - rustup-init.exe -y --default-host %TARGET% - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - set RUST_BACKTRACE=1 - - set LOOM_MAX_DURATION=10 - - - rustc -V - - cargo -V - -build: false - -test_script: - - cargo test --all --no-fail-fast --target %TARGET% diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 58ebdf5b..00000000 --- a/.travis.yml +++ /dev/null @@ -1,136 +0,0 @@ ---- -language: rust -sudo: false -addons: - apt: - packages: - # to x-compile miniz-sys from sources - - gcc-multilib - -matrix: - include: - - rust: stable - - rust: beta - - rust: nightly - env: ALLOW_FAILURES=true - - os: osx - - env: TARGET=i686-unknown-linux-gnu - - # This represents the minimum Rust version supported by Tokio. Updating this - # should be done in a dedicated PR and cannot be greater than two 0.x - # releases prior to the current stable. - # - # Tests are not run as tests may require newer versions of rust. - - rust: 1.26.0 - script: | - cargo check --all - - # Test combinations of enabled features and rustfmt - - rust: stable - before_script: | - rustup component add rustfmt - script: | - set -e - - cargo fmt --all -- --check - shopt -s expand_aliases - alias check="cargo check --no-default-features" - check - check --features codec - check --features fs - check --features io - check --features reactor - check --features rt-full - check --features tcp - check --features timer - check --features udp - check --features uds - - # Test the async / await preview. We don't want to block PRs on this failing - # though. - - rust: nightly - env: ALLOW_FAILURES=true - script: | - cd tokio-async-await - cargo check --all - cargo check --features async-await-preview - - # This runs TSAN against nightly and allows failures to propagate up. - - rust: nightly-2018-11-18 - env: TSAN=yes - script: | - set -e - # Make sure the benchmarks compile - cargo build --benches --all - - export ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0" - export TSAN_OPTIONS="suppressions=`pwd`/ci/tsan" - export RUST_BACKTRACE=1 - - # === tokio-timer ==== - - # Run address sanitizer - RUSTFLAGS="-Z sanitizer=address" \ - cargo test -p tokio-timer --test hammer --target x86_64-unknown-linux-gnu - - # Run thread sanitizer - RUSTFLAGS="-Z sanitizer=thread" \ - cargo test -p tokio-timer --test hammer --target x86_64-unknown-linux-gnu - - # === tokio-threadpool ==== - - # Run address sanitizer - RUSTFLAGS="-Z sanitizer=address" \ - cargo test -p tokio-threadpool --tests --target x86_64-unknown-linux-gnu - - # Run thread sanitizer - RUSTFLAGS="-Z sanitizer=thread" \ - cargo test -p tokio-threadpool --tests --target x86_64-unknown-linux-gnu - - # This runs cargo +nightly doc - - name: nightly_docs - rust: nightly - env: ALLOW_FAILURES=true - script: cargo doc - - allow_failures: - - rust: nightly - env: ALLOW_FAILURES=true - -script: | - set -e - if [[ "$TARGET" ]] - then - rustup target add $TARGET - cargo check --all --exclude tokio-tls --target $TARGET - cargo check --tests --all --exclude tokio-tls --target $TARGET - else - # Limit the execution time of loom tests. - export LOOM_MAX_DURATION=10 - cargo test --all --no-fail-fast - cargo test -p tokio-buf --no-default-features - cargo doc --all - fi - -before_deploy: - - cargo doc --all --no-deps - -deploy: - provider: pages - skip_cleanup: true - github_token: $GH_TOKEN - target_branch: gh-pages - local_dir: target/doc - on: - branch: master - repo: tokio-rs/tokio - rust: stable - condition: $TRAVIS_OS_NAME = "linux" && $TARGET = "" - -env: - global: - - secure: iwlN1zfUCp/5BAAheqIRSFIqiM9zSwfIGcVDw/V7jHveqXyNzmCs7H58/cd90WLqonqpPX0t5GF66oTjms4v0DFjgXr/k4358qeSZaV082V3baNrVpCDHeCQV0SvKsfiYxDDJGSUL1WIUP+tqqDm4+ksZQP3LnwZojkABjWz5CBNt4kX+Wz5ZbYqtQoxyuZba5UyPY2CXJtubvCVPGMJULuUpklYxXZ4dWM2olzGgVJ8rE8udhSZ4ER4JgxB0KUx3/5TwHHzgyPEsWR4bKN6JzBjIczQofXUcUXXdoZBs23H/VhCpzKcn3/oJ8btVYPzwtdj5FmVB1aVR/gjPo2bSGi/sofq+LwL/1HJXkM+kjl8m2dLLcDBKqNYNERtVA1++LhkMWAFRgGYe8v8Ryxjiue1NF5LgAIA/fjK0uI1DELTzTf/TKrM+AtPDNTvhOft4/YD+hoImjwk6nv6PBb2TiTYnc79Qf4AZ65tv1qtsAUPuw4plLaccHQAO4ldYVXn4u9c+iisJwvovs6jo06bF3U3qtdI5gXsrI9+T25TrXvYb+IREo0MHzYEM0KlPFnscEArzC3eajuSd36ARFP3lDc+gp2RPs89iJjowms0eRyepp7Cu6XO3Cd2pfAX8AqvnmttZf4Nm51ONeiBPXPXItUkJm49MCpMJywU1IZcWZg= - -notifications: - email: - on_success: never @@ -14,18 +14,15 @@ the Rust programming language. It is: [![Crates.io][crates-badge]][crates-url] [![MIT licensed][mit-badge]][mit-url] -[![Travis Build Status][travis-badge]][travis-url] -[![Appveyor Build Status][appveyor-badge]][appveyor-url] +[![Build Status][azure-badge]][azure-url] [![Gitter chat][gitter-badge]][gitter-url] [crates-badge]: https://img.shields.io/crates/v/tokio.svg [crates-url]: https://crates.io/crates/tokio [mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg [mit-url]: LICENSE-MIT -[travis-badge]: https://travis-ci.org/tokio-rs/tokio.svg?branch=master -[travis-url]: https://travis-ci.org/tokio-rs/tokio -[appveyor-badge]: https://ci.appveyor.com/api/projects/status/s83yxhy9qeb58va7/branch/master?svg=true -[appveyor-url]: https://ci.appveyor.com/project/carllerche/tokio/branch/master +[azure-badge]: https://dev.azure.com/tokio-rs/Tokio/_apis/build/status/tokio-rs.tokio?branchName=master +[azure-url]: https://dev.azure.com/tokio-rs/Tokio/_build/latest?definitionId=1&branchName=master [gitter-badge]: https://img.shields.io/gitter/room/tokio-rs/tokio.svg [gitter-url]: https://gitter.im/tokio-rs/tokio diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..c900012c --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,115 @@ +trigger: ["master"] +pr: ["master"] + +jobs: +# Check formatting +- template: ci/azure-rustfmt.yml + parameters: + name: rustfmt + +# Test top level crate +- template: ci/azure-test-stable.yml + parameters: + name: test_tokio + displayName: Test tokio + cross: true + crates: + - tokio + +# Test crates that are platform specific +- template: ci/azure-test-stable.yml + parameters: + name: test_sub_cross + displayName: Test sub crates - + cross: true + crates: + - tokio-fs + - tokio-reactor + - tokio-signal + - tokio-tcp + - tokio-tls + - tokio-udp + - tokio-uds + +# Test crates that are NOT platform specific +- template: ci/azure-test-stable.yml + parameters: + name: test_linux + displayName: Test sub crates - Any + crates: + - tokio-buf + - tokio-codec + - tokio-current-thread + - tokio-executor + - tokio-io + - tokio-sync + - tokio-threadpool + - tokio-timer + - tokio-trace + - tokio-trace/tokio-trace-core + +- template: ci/azure-cargo-check.yml + parameters: + name: features + displayName: Check feature permtuations + rust: stable + crates: + tokio: + - codec + - fs + - io + - reactor + - rt-full + - tcp + - timer + - udp + - uds + tokio-buf: + - util + +# Check async / await +- template: ci/azure-cargo-check.yml + parameters: + name: async_await + displayName: Async / Await + rust: nightly-2019-02-22 + noDefaultFeatures: '' + benches: true + crates: + tokio: + - async-await-preview + +# Try cross compiling +- template: ci/azure-cross-compile.yml + parameters: + name: cross_32bit_linux + target: i686-unknown-linux-gnu + +# This represents the minimum Rust version supported by +# Tokio. Updating this should be done in a dedicated PR and +# cannot be greater than two 0.x releases prior to the +# current stable. +# +# Tests are not run as tests may require newer versions of +# rust. +- template: ci/azure-check-minrust.yml + parameters: + name: minrust + rust_version: 1.26.0 + +- template: ci/azure-tsan.yml + parameters: + name: tsan + +- template: ci/azure-deploy-docs.yml + parameters: + dependsOn: + - rustfmt + - test_tokio + - test_sub_cross + - test_linux + - features + - async_await + - cross_32bit_linux + - minrust + - tsan diff --git a/ci/azure-cargo-check.yml b/ci/azure-cargo-check.yml new file mode 100644 index 00000000..5a29376e --- /dev/null +++ b/ci/azure-cargo-check.yml @@ -0,0 +1,27 @@ +parameters: + noDefaultFeatures: '--no-default-features' + +jobs: +- job: ${{ parameters.name }} + displayName: ${{ parameters.displayName }} + pool: + vmImage: ubuntu-16.04 + steps: + - template: azure-install-rust.yml + parameters: + rust_version: ${{ parameters.rust }} + + - ${{ each crate in parameters.crates }}: + - ${{ each feature in crate.value }}: + - ${{ if eq(crate.key, 'tokio') }}: + - script: cargo check ${{ parameters.noDefaultFeatures }} --features ${{ feature }} + displayName: Check features = ${{ feature }} + + - ${{ if not(eq(crate.key, 'tokio')) }}: + - script: cargo check ${{ parameters.noDefaultFeatures }} --features ${{ feature }} + displayName: Check `${{ crate.key }}`, features = ${{ feature }} + workingDirectory: $(Build.SourcesDirectory)/${{ crate.key }} + + - ${{ if parameters.benches }}: + - script: cargo check --benches --all + displayName: Check benchmarks diff --git a/ci/azure-check-minrust.yml b/ci/azure-check-minrust.yml new file mode 100644 index 00000000..de6313c2 --- /dev/null +++ b/ci/azure-check-minrust.yml @@ -0,0 +1,12 @@ +jobs: +- job: ${{ parameters.name }} + displayName: Min supported Rust version + pool: + vmImage: ubuntu-16.04 + steps: + - template: azure-install-rust.yml + parameters: + rust_version: ${{ parameters.rust_version }} + + - script: cargo check --all + displayName: cargo check --all diff --git a/ci/azure-cross-compile.yml b/ci/azure-cross-compile.yml new file mode 100644 index 00000000..79606bb4 --- /dev/null +++ b/ci/azure-cross-compile.yml @@ -0,0 +1,21 @@ +jobs: +- job: ${{ parameters.name }} + displayName: ${{ parameters.displayName }} + pool: + vmImage: ubuntu-16.04 + steps: + - template: azure-install-rust.yml + parameters: + rust_version: stable + + - script: sudo apt-get install gcc-multilib + displayName: "Install gcc-multilib" + + - script: rustup target add ${{ parameters.target }} + displayName: "Add target" + + - script: cargo check --all --exclude tokio-tls --target ${{ parameters.target }} + displayName: Check source + + - script: cargo check --tests --all --exclude tokio-tls --target ${{ parameters.target }} + displayName: Check tests diff --git a/ci/azure-deploy-docs.yml b/ci/azure-deploy-docs.yml new file mode 100644 index 00000000..ebd067b3 --- /dev/null +++ b/ci/azure-deploy-docs.yml @@ -0,0 +1,38 @@ +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: + rust_version: stable + - script: | + cargo doc --all --no-deps + cp -R target/doc '$(Build.BinariesDirectory)' + displayName: 'Generate Documentation' + - script: | + set -e + + git --version + ls -la + git init + git config user.name 'Deployment Bot (from Azure Pipelines)' + git config user.email 'deploy@tokio-rs.com' + git config --global credential.helper 'store --file ~/.my-credentials' + printf "protocol=https\nhost=github.com\nusername=carllerche\npassword=%s\n\n" "$GITHUB_TOKEN" | git credential-store --file ~/.my-credentials store + git remote add origin https://github.com/tokio-rs/tokio + git checkout -b gh-pages + git add . + git commit -m 'Deploy Tokio API documentation' + git push -f origin gh-pages + env: + GITHUB_TOKEN: $(githubPersonalToken) + workingDirectory: '$(Build.BinariesDirectory)' + displayName: 'Deploy Documentation' diff --git a/ci/azure-install-rust.yml b/ci/azure-install-rust.yml new file mode 100644 index 00000000..654db473 --- /dev/null +++ b/ci/azure-install-rust.yml @@ -0,0 +1,27 @@ +steps: + # 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 (*nix)" + condition: not(eq(variables['Agent.OS'], 'Windows_NT')) + + # Windows. + - script: | + 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)" + condition: eq(variables['Agent.OS'], 'Windows_NT') + + # All platforms. + - script: | + rustc -Vv + cargo -V + displayName: Query rust and cargo versions diff --git a/ci/azure-rustfmt.yml b/ci/azure-rustfmt.yml new file mode 100644 index 00000000..60bb51aa --- /dev/null +++ b/ci/azure-rustfmt.yml @@ -0,0 +1,16 @@ +jobs: +# Check formatting +- job: ${{ parameters.name }} + displayName: Check rustfmt + pool: + vmImage: ubuntu-16.04 + steps: + - template: azure-install-rust.yml + parameters: + rust_version: stable + - script: | + rustup component add rustfmt + displayName: Install rustfmt + - script: | + cargo fmt --all -- --check + displayName: Check formatting diff --git a/ci/azure-test-stable.yml b/ci/azure-test-stable.yml new file mode 100644 index 00000000..718d618b --- /dev/null +++ b/ci/azure-test-stable.yml @@ -0,0 +1,36 @@ +jobs: +- job: ${{ parameters.name }} + displayName: ${{ parameters.displayName }} + strategy: + matrix: + Linux: + vmImage: ubuntu-16.04 + + ${{ if parameters.cross }}: + MacOS: + vmImage: macOS-10.13 + Windows: + vmImage: vs2017-win2016 + pool: + vmImage: $(vmImage) + + steps: + - template: azure-install-rust.yml + parameters: + rust_version: stable + + - ${{ each crate in parameters.crates }}: + - ${{ if eq(crate, 'tokio') }}: + - script: cargo test + env: + LOOM_MAX_DURATION: 10 + CI: 'True' + displayName: cargo test + + - ${{ if not(eq(crate, 'tokio')) }}: + - script: cargo test + env: + LOOM_MAX_DURATION: 10 + CI: 'True' + displayName: cargo test -p ${{ crate }} + workingDirectory: $(Build.SourcesDirectory)/${{ crate }} diff --git a/ci/azure-tsan.yml b/ci/azure-tsan.yml new file mode 100644 index 00000000..f785ab2d --- /dev/null +++ b/ci/azure-tsan.yml @@ -0,0 +1,34 @@ +jobs: +- job: ${{ parameters.name }} + displayName: TSAN + strategy: + matrix: + Timer: + cmd: cargo test -p tokio-timer --test hammer + Threadpool: + cmd: cargo test -p tokio-threadpool --tests + pool: + vmImage: ubuntu-16.04 + steps: + - template: azure-install-rust.yml + parameters: + rust_version: nightly-2018-11-18 + + - script: | + set -e + # Make sure the benchmarks compile + export ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0" + export TSAN_OPTIONS="suppressions=`pwd`/ci/tsan" + export RUST_BACKTRACE=1 + + # Run address sanitizer + RUSTFLAGS="-Z sanitizer=address" \ + $(cmd) --target x86_64-unknown-linux-gnu + + # Run thread sanitizer + RUSTFLAGS="-Z sanitizer=thread" \ + $(cmd) --target x86_64-unknown-linux-gnu + displayName: TSAN / MSAN + env: + TSAN: yes + diff --git a/tokio-tls/tests/smoke.rs b/tokio-tls/tests/smoke.rs index a617d4d5..b251cd1e 100644 --- a/tokio-tls/tests/smoke.rs +++ b/tokio-tls/tests/smoke.rs @@ -364,7 +364,7 @@ description should mention "tokio-tls". } fn local_root_store() -> CertStore { - if env::var("APPVEYOR").is_ok() { + if env::var("CI").is_ok() { CertStore::open_local_machine("Root").unwrap() } else { CertStore::open_current_user("Root").unwrap() |