|
| 1 | +parameters: |
| 2 | + min: false |
| 3 | + setup: [] |
| 4 | + services: {} |
| 5 | + env: {} |
| 6 | + cross: true |
| 7 | + dir: "." |
| 8 | + |
| 9 | +jobs: |
| 10 | + - job: style |
| 11 | + displayName: Style linting |
| 12 | + pool: |
| 13 | + vmImage: ubuntu-18.04 |
| 14 | + continueOnError: true |
| 15 | + steps: |
| 16 | + # latest nightly may not have rustfmt/clippy |
| 17 | + # we can't check for both: |
| 18 | + # https://github.com/rust-lang/rustup-components-history/issues/9 |
| 19 | + # but we at least check for one. |
| 20 | + # rustfmt _seems_ to break most often: |
| 21 | + - bash: | |
| 22 | + echo '##vso[task.setvariable variable=nightly]nightly-'$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/rustfmt) |
| 23 | + displayName: "Determine latest style nightly" |
| 24 | + - template: install-rust.yml |
| 25 | + parameters: |
| 26 | + rust: $(nightly) |
| 27 | + components: |
| 28 | + - rustfmt |
| 29 | + - clippy |
| 30 | + # Run any user-specific setup steps |
| 31 | + - ${{ parameters.setup }} |
| 32 | + - script: cargo fmt --all -- --check |
| 33 | + workingDirectory: ${{ parameters.dir }} |
| 34 | + displayName: cargo fmt --check |
| 35 | + - script: cargo clippy --all |
| 36 | + workingDirectory: ${{ parameters.dir }} |
| 37 | + displayName: cargo clippy -- -D warnings |
| 38 | + - job: main |
| 39 | + displayName: Compile and test |
| 40 | + dependsOn: [] |
| 41 | + ${{ if eq('true', parameters.cross) }}: |
| 42 | + strategy: |
| 43 | + matrix: |
| 44 | + Linux: |
| 45 | + vmImage: ubuntu-18.04 |
| 46 | + rust: nightly |
| 47 | + MacOS: |
| 48 | + vmImage: macOS-10.15 |
| 49 | + rust: nightly |
| 50 | + Windows: |
| 51 | + vmImage: windows-2019 |
| 52 | + rust: nightly |
| 53 | + ${{ if ne('true', parameters.cross) }}: |
| 54 | + strategy: |
| 55 | + matrix: |
| 56 | + Linux: |
| 57 | + vmImage: ubuntu-18.04 |
| 58 | + rust: nightly |
| 59 | + pool: |
| 60 | + vmImage: $(vmImage) |
| 61 | + services: |
| 62 | + ${{ insert }}: ${{ parameters.services }} |
| 63 | + steps: |
| 64 | + - template: install-rust.yml |
| 65 | + parameters: |
| 66 | + rust: $(rust) |
| 67 | + # Run any user-specific setup steps |
| 68 | + - ${{ parameters.setup }} |
| 69 | + - script: cargo check |
| 70 | + workingDirectory: ${{ parameters.dir }} |
| 71 | + displayName: cargo check |
| 72 | + - script: cargo check --no-default-features |
| 73 | + workingDirectory: ${{ parameters.dir }} |
| 74 | + displayName: cargo check --no-default-features |
| 75 | + - script: cargo check --all-features |
| 76 | + workingDirectory: ${{ parameters.dir }} |
| 77 | + displayName: cargo check --all-features |
| 78 | + - script: cargo test --all-features |
| 79 | + workingDirectory: ${{ parameters.dir }} |
| 80 | + displayName: cargo test |
| 81 | + env: |
| 82 | + ${{ insert }}: ${{ parameters.env }} |
| 83 | + - script: cargo doc --no-deps |
| 84 | + workingDirectory: ${{ parameters.dir }} |
| 85 | + displayName: cargo doc |
| 86 | + - ${{ if ne('false', parameters.min) }}: |
| 87 | + - job: msrv |
| 88 | + displayName: "${{ format('Minimum supported Rust nightly: {0}', parameters.min) }}" |
| 89 | + dependsOn: [] |
| 90 | + # This represents the minimum Rust version supported. |
| 91 | + # Tests are not run as tests may require newer versions of nightly. |
| 92 | + pool: |
| 93 | + vmImage: ubuntu-18.04 |
| 94 | + steps: |
| 95 | + - template: install-rust.yml |
| 96 | + parameters: |
| 97 | + rust: "${{ format('nightly-{0}', parameters.min) }}" |
| 98 | + # Run any user-specific setup steps |
| 99 | + - ${{ parameters.setup }} |
| 100 | + - script: cargo check |
| 101 | + workingDirectory: ${{ parameters.dir }} |
| 102 | + displayName: cargo check |
| 103 | + - script: cargo check --no-default-features |
| 104 | + workingDirectory: ${{ parameters.dir }} |
| 105 | + displayName: cargo check --no-default-features |
| 106 | + - script: cargo check --all-features |
| 107 | + workingDirectory: ${{ parameters.dir }} |
| 108 | + displayName: cargo check --all-features |
| 109 | + - ${{ if ne('', parameters.codecov_token) }}: |
| 110 | + - template: coverage.yml |
| 111 | + parameters: |
| 112 | + token: ${{ parameters.codecov_token }} |
| 113 | + setup: ${{ parameters.setup }} |
| 114 | + services: ${{ parameters.services }} |
| 115 | + env: ${{ parameters.env }} |
| 116 | + dir: ${{ parameters.dir }} |
| 117 | + nightly: true |
0 commit comments