blob: 32e148d623a5d5db4b2cccc85c18d5d47fff4969 [file] [log] [blame]
trigger:
branches:
include: ['master']
tags:
include: ['v*']
pr:
branches:
include:
- master
paths:
exclude:
- "*.md"
- "docs/*"
- "LICENSE-*"
schedules:
- cron: "16 16 16 * *"
displayName: Monthly Build
branches:
include:
- master
variables:
minrust: 1.40.0
codecov_token: $(CODECOV_TOKEN_SECRET)
windows_vm: vs2017-win2016
mac_vm: macos-10.14
linux_vm: ubuntu-16.04
stages:
- stage: check
displayName: Compilation Check
jobs:
- job: cargo_check
displayName: cargo check
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
parameters:
rust: stable
- script: cargo check --workspace --all-targets
displayName: Default features
- script: cargo check --workspace --all-targets --no-default-features
displayName: No-default features
- stage: test
displayName: Test
jobs:
- job: test
displayName: Test
strategy:
matrix:
windows:
imageName: ${{ variables.windows_vm }}
target: 'x86_64-pc-windows-msvc'
channel: stable
mac:
imageName: ${{ variables.mac_vm }}
target: 'x86_64-apple-darwin'
channel: stable
linux:
imageName: ${{ variables.linux_vm }}
target: 'x86_64-unknown-linux-gnu'
channel: stable
# Check for upcoming platform-specific compiler breakages
windows_beta:
imageName: ${{ variables.windows_vm }}
target: 'x86_64-pc-windows-msvc'
channel: beta
mac_beta:
imageName: ${{ variables.mac_vm }}
target: 'x86_64-apple-darwin'
channel: beta
linux_beta:
imageName: ${{ variables.linux_vm }}
target: 'x86_64-unknown-linux-gnu'
channel: beta
# Check for compiler breakages
linux_nightly:
imageName: ${{ variables.linux_vm }}
target: 'x86_64-unknown-linux-gnu'
channel: nightly
continueOnError: $[ne(variables.rust, 'stable')]
pool:
vmImage: $(imageName)
steps:
- template: install-rust.yml@templates
parameters:
rust: $(channel)
targets: ["$(TARGET)"]
- script: cargo test --target $(TARGET) --workspace
displayName: cargo test
- script: cargo doc --target $(TARGET) --workspace --no-deps
displayName: cargo doc
- job: msrv
displayName: "${{ format('Minimum supported Rust version: {0}', variables.minrust) }}"
dependsOn: []
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
parameters:
rust: ${{ variables.minrust }}
- script: cargo check --all --bins --examples --tests
displayName: cargo check
- stage: style
displayName: Style checks
dependsOn: []
jobs:
- job: "Committed"
displayName: Linting commit history
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- checkout: self
- template: v1/azdo-step.yml@gh-install
parameters:
git: crate-ci/committed
target: 'x86_64-unknown-linux-gnu'
to: $(Build.StagingDirectory)/tools
# The extra verbosity is to help verify the example we're giving works and doesn't need to be copied
- script: |
echo "Linting commits:"
git log --graph --oneline HEAD~..HEAD^2
echo "Against 'committed.toml':"
$(Build.StagingDirectory)/tools/committed --dump-config -
echo ""
echo "If this fails, don't sweat it. We're trying to encourage clear communication and not hinder contributions."
echo "If it is a reasonable issue and you lack time or feel uncomfortable fixing it yourself,"
echo "let us know and we can mentor or fix it."
$(Build.StagingDirectory)/tools/committed HEAD~..HEAD^2 --no-merge-commit -vvvv
displayName: Lint commit history
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
- job: style
displayName: Style checking
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
parameters:
rust: stable
components:
- rustfmt
- script: cargo fmt --all -- --check
displayName: rustfmt
- job: lint
displayName: Linting
strategy:
matrix:
current:
channel: ${{ variables.minrust }}
next:
channel: stable
continueOnError: $[eq(variables.channel, 'stable')]
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
parameters:
rust: $(channel)
components:
- clippy
- script: cargo check --workspace --all-targets --all-features
displayName: Warnings
env:
RUSTFLAGS: "-D warnings"
- script: cargo clippy --workspace --all-features --all-targets -- -D warnings
displayName: clippy
- ${{ if ne('', variables.codecov_token) }}:
- stage: coverage
displayName: Code coverage
dependsOn: test
jobs:
- template: coverage.yml@templates
parameters:
token: ${{ variables.codecov_token }}
resources:
repositories:
- repository: templates
type: github
name: crate-ci/azure-pipelines
endpoint: crate-ci
- repository: gh-install
type: github
name: crate-ci/gh-install
endpoint: crate-ci