├── .cargo └── config ├── .editorconfig ├── .gitignore ├── Cargo.toml ├── LICENSE ├── README.md ├── azure-pipelines.yml ├── ci ├── jobs │ ├── cargo-build.yml │ ├── cargo-check.yml │ ├── cargo-clippy.yml │ ├── cargo-doc.yml │ ├── cargo-test.yaml │ ├── cross-build.yml │ ├── cross-check.yml │ ├── cross-test.yml │ └── rustfmt.yml ├── scenarios │ ├── builds.yml │ ├── check.yml │ ├── embeeded.yml │ ├── github │ │ ├── deploy-doc.yml │ │ └── release.yml │ └── test.yml └── steps │ ├── artifacts.yml │ ├── install-cross-rust.yml │ └── install-rust.yml ├── img ├── doc_deploy1.png ├── doc_deploy2.png ├── doc_deploy3.png └── service_connection_pipelines.png └── src ├── lib.rs └── main.rs /.cargo/config: -------------------------------------------------------------------------------- 1 | [target.armv7-unknown-linux-gnueabihf] 2 | linker= "arm-linux-gnueabihf-gcc-4.7" 3 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.yml] 4 | indent_style = space 5 | indent_size = 2 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rust-azure-pipelines" 3 | version = "0.0.1-c" 4 | authors = ["Sylwester Rąpała "] 5 | edition = "2018" 6 | description = "This is just example hello-world crate to test azure pipelines with rust. You will not find anything useful here" 7 | 8 | [dependencies] 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Sylwester Rąpała 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | master: [![Build Status](https://dev.azure.com/sylwesterrapala/azure-piplines/_apis/build/status/xoac.rust-azure-pipelines?branchName=master)](https://dev.azure.com/sylwesterrapala/azure-piplines/_build/latest?definitionId=3&branchName=master) 2 | 3 | develop: [![Build Status](https://dev.azure.com/sylwesterrapala/azure-piplines/_apis/build/status/xoac.rust-azure-pipelines?branchName=develop)](https://dev.azure.com/sylwesterrapala/azure-piplines/_build/latest?definitionId=3&branchName=develop) 4 | 5 | # Status 6 | 7 | This project is no longer maintained. I recommended using github actions for CI/CD with github I work on my personal template that contains a good defaults for github-actions at [xoac/opinionated-rust-template](https://github.com/xoac/opinionated-rust-template) if you still looking for Azure Pipelines for rust [crates-ci/azure-pipelines](https://github.com/crate-ci/azure-pipelines) should be a correct place. 8 | 9 | # The idea 10 | 11 | The idea of using this CI/CD is create common templates for rust users. It should be ready to work in 5min with good default values. It allow you: 12 | - check and tests: 13 | - on Windows, Linux, MacOs natively and with quemu for other targets 14 | - with any rust version you want (nightly, stable, 1.31 etc) 15 | - check formatting 16 | - use lints (cargo clippy) 17 | - deploys to github (documentation and binaries) 18 | 19 | ## Copy past examples: 20 | 21 | If you just started using azure pipelines you can copy paste into `azure-pipelines.yml`. **Check and test** should be good default one 22 | 23 | 24 | #### Check and test 25 | This is the default and should be sufficiently. [How to create endpoint?](https://github.com/xoac/rust-azure-pipelines/tree/develop#how-to-use-run-azure-pipelines) 26 | ``` 27 | trigger: 28 | branches: 29 | include: ['*'] 30 | tags: 31 | include: ['*'] 32 | 33 | resources: 34 | repositories: 35 | - repository: rust_pipelines 36 | type: github 37 | name: xoac/rust-azure-pipelines 38 | ref: refs/tags/v0.1.0 39 | endpoint: PipelinesTemplates # TODO YOU NEED TO CHANGE THIS! 40 | 41 | stages: 42 | - stage: check 43 | displayName: "Quick checks" 44 | jobs: 45 | - template: ci/scenarios/check.yml@rust_pipelines 46 | 47 | - stage: test 48 | displayName: "Multi OS native tests" 49 | jobs: 50 | - template: ci/scenarios/test.yml@rust_pipelines 51 | parameters: 52 | min_rust_supported: 1.31 # Use first rust version you wanna support 53 | ``` 54 | 55 | **You are done! Everything else is optional!** 56 | 57 | ### More stages: 58 | 59 | #### Check and tests for embedded 60 |
61 | Just modify `checks` and `tests`. This step use [cross project](https://github.com/rust-embedded/cross) 62 | 63 | Check supported targets. 64 | [Supported targets](https://github.com/rust-embedded/cross#supported-targets) 65 | 66 | the name parameter is because we can't change automatically the name `mips-unknow-linux-musl` to `mips_unknow_linux_musl`. Name has to be unique in embedded stage. 67 | 68 | ``` 69 | # This stage allow to easy test your crate using cross project. 70 | # Supported targets: https://github.com/rust-embedded/cross#supported-targets 71 | - stage: embedded 72 | displayName: "Cross check and tests" 73 | dependsOn: 74 | - check 75 | jobs: 76 | - template: ci/scenarios/embeeded.yml@rust_pipelines 77 | parameters: 78 | checks: 79 | - target: mips-unknown-linux-musl 80 | name: cross_chcek_i686_unknown_freebsd 81 | - target: aarch64-unknown-linux-gnu 82 | name: cross_check_aarch64_unknown_linux_gnu 83 | tests: 84 | - target: i686-unknown-linux-gnu 85 | name: cross_test_i686_unknown_linux_gnu 86 | ``` 87 |
88 | 89 | #### Build and deploy to github 90 |
91 | Parameter `gitHubConnection` need to be changed. [More info](https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/github-release?view=azure-devops#prerequisites) 92 | 93 | ``` 94 | # This stage build binaries - you can deploy them in next stage 95 | - stage: build 96 | displayName: "Builds" 97 | condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) 98 | dependsOn: 99 | - test 100 | 101 | # Deploy binaries to github only if tags start with `v` for example `v0.1.5` 102 | - stage: deploy 103 | displayName: "Deploys" 104 | dependsOn: 105 | - build 106 | jobs: 107 | - template: ci/scenarios/github/release.yml@rust_pipelines 108 | parameters: 109 | job_condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) 110 | gitHubConnection: PipelinesTemplates # CHANGED THIS TO YOUR OWN VALUE 111 | ``` 112 |
113 | 114 | ## Add this repo templates to your project: 115 | If you already have `azure-piplines.yml` file add this to be able using templates: 116 | ``` 117 | resources: 118 | repositories: 119 | - repository: rust_pipelines 120 | type: github 121 | name: xoac/rust-azure-pipelines 122 | # ref: refs/heads/master ## TODO you may want to change it to refs/tags/TAG_NAME. 123 | ref: refs/tags/v0.1.0 124 | endpoint: YOU_NEED_TO_SET_THIS 125 | ``` 126 | More about [templates resources](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/templates?view=azure-devops#using-other-repositories) 127 | 128 | And now you can use it like this: 129 | ``` 130 | jobs: 131 | - template: ci/jobs/cargo-check.yml@rust_pipelines 132 | ``` 133 | Available items: 134 | ``` 135 | ci 136 | ├── jobs 137 | │   ├── cargo-build.yml 138 | │   ├── cargo-check.yml 139 | │   ├── cargo-clippy.yml 140 | │   ├── cargo-doc.yml 141 | │   ├── cargo-test.yaml 142 | │   ├── cross-build.yml 143 | │   ├── cross-check.yml 144 | │   ├── cross-test.yml 145 | │   └── rustfmt.yml 146 | ├── scenarios 147 | │   ├── builds.yml 148 | │   ├── check.yml 149 | │   ├── embeeded.yml 150 | │   ├── github 151 | │   │   ├── deploy-doc.yml 152 | │   │   └── release.yml 153 | │   └── test.yml 154 | └── steps 155 | ├── artifacts.yml 156 | ├── install-cross-rust.yml 157 | └── install-rust.yml 158 | ``` 159 | 160 | You can see `ci/scenarios` to get know how to use jobs. 161 | 162 | ### Intuitive: 163 | 164 | The `ci` is split into: 165 | - steps - common steps that are used in many jobs like install rust, publish artifacts etc. 166 | - jobs - here are defined jobs like rustfmt, cargo-\*, clippy etc. 167 | - scenarios - groups jobs with good defaults parameters to allow easy check, test, build and deploy. 168 | 169 | #### Using template jobs: 170 | Most of pepole know how to use `cargo`. If you know you know also how to use this CI templates! 171 | 172 | For example you wann use this: 173 | ``` 174 | cargo build --release --examples --target-dir "myTargetDir" 175 | ``` 176 | So you just need: 177 | ``` 178 | jobs: 179 | - template: ci/jobs/cargo-build.yml@rust_pipelines 180 | parameters: 181 | release: true 182 | examples: true 183 | target-dir: "myTargetDir" 184 | ``` 185 | 186 | How to check for more parameters? You can use just `--help` flag in cargo or see parameters in `cargo-build.yml` 187 | ``` 188 | cargo build --help 189 | ``` 190 | 191 | ### How to use run azure-pipelines? 192 | 1. Create `azure-pipelines.yml` in your reposiotry 193 | 2. Specify [service connection](https://docs.microsoft.com/pl-pl/azure/devops/pipelines/library/service-endpoints?view=azure-devops) 194 | ![](img/service_connection_pipelines.png) 195 | 3. Specify endpoint in resources. 196 | 197 | ### How to deploy doc to github pages? 198 | This is useful if u want to have a separate documentation for master branch. 199 | 200 |
201 | 202 | #### Github part 203 | 1. First you need to create a PAT (Personal Access Token) on Github. (recommended scopes for the token: `repo`, `user`, `admin:repo_hook`.) 204 | 2. Then create a branch `gh-pages` and us it as repo page. [Here you find how to do it](https://help.github.com/en/articles/configuring-a-publishing-source-for-github-pages#enabling-github-pages-to-publish-your-site-from-master-or-gh-pages) 205 | 206 | #### Azure part 207 | 1. Go to your azure dev-ops pipeline project and click edit. 208 | ![](img/doc_deploy1.png) 209 | 2. Go inside variables: 210 | ![](img/doc_deploy2.png) 211 | 3. Add variable called `DocPublishToken` with value of your PAT(Personal Access Token). Don't forget to mark it as secret. 212 | ![](img/doc_deploy3.png) 213 | 4. Edit azure-pipelines.yml section with doc deploy (parameters.git) and you are done. 214 | 215 | Example master doc generated for this example create. 216 | [master doc for this hello word app](https://xoac.github.io/rust-azure-pipelines/doc/rust_azure_pipelines/) 217 | 218 |
219 | 220 | ---- 221 | 222 | #### Sources: 223 | * [Azure Pipelines for Rust Projects](https://nbsoftsolutions.com/blog/azure-pipelines-for-rust-projects) 224 | * [tokio-rs](https://github.com/tokio-rs/tokio) 225 | 226 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | trigger: 2 | branches: 3 | include: ['*'] 4 | tags: 5 | include: ['*'] 6 | 7 | resources: 8 | repositories: 9 | - repository: rust_pipelines 10 | type: github 11 | name: xoac/rust-azure-pipelines 12 | # ref: refs/tags/v0.1.0-alpha.2 13 | ref: refs/heads/master # TODO you may want to change it to refs/tags/TAG_NAME. 14 | endpoint: PipelinesTemplates # TODO YOU NEED TO CHANGE THIS! 15 | 16 | stages: 17 | - stage: check 18 | displayName: "Quick checks" 19 | jobs: 20 | - template: ci/scenarios/check.yml@rust_pipelines 21 | parameters: # You can make conditions here. 22 | cargo-check: true 23 | cargo-check-nigtly: true # this can fail and stage check still succeed 24 | cargo-clippy: true 25 | rustfmt: true 26 | 27 | - stage: test 28 | displayName: "Multi OS native tests" 29 | jobs: 30 | - template: ci/scenarios/test.yml@rust_pipelines 31 | parameters: 32 | min_rust_supported: 1.31.1 # this is default setting for test 33 | 34 | # This stage allow to easy test your crate using cross project. 35 | # Supported targets: https://github.com/rust-embedded/cross#supported-targets 36 | - stage: embedded 37 | displayName: "Cross check and tests" 38 | dependsOn: 39 | - check 40 | jobs: 41 | - template: ci/scenarios/embeeded.yml@rust_pipelines 42 | parameters: 43 | checks: 44 | - target: mips-unknown-linux-musl 45 | name: cross_chcek_i686_unknown_freebsd 46 | - target: aarch64-unknown-linux-gnu 47 | name: cross_check_aarch64_unknown_linux_gnu 48 | tests: 49 | - target: i686-unknown-linux-gnu 50 | name: cross_test_i686_unknown_linux_gnu 51 | 52 | # This stage build binaries - you can deploy them in next stage 53 | - stage: build 54 | displayName: "Builds" 55 | condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) 56 | dependsOn: 57 | - embedded 58 | - test 59 | jobs: 60 | - template: ci/scenarios/builds.yml@rust_pipelines 61 | parameters: 62 | artifactName: target 63 | 64 | # This stage will be create github realese and upload binaries from build stage. It will also generate documentaion for master and upload it to gh-pages. 65 | - stage: deploy 66 | displayName: "Deploys" 67 | dependsOn: 68 | - build 69 | jobs: 70 | # Deploy doc 71 | - template: ci/scenarios/github/deploy-doc.yml@rust_pipelines 72 | parameters: 73 | branch: master 74 | job_name: github_deploy_doc 75 | github: # TODO You need modify this parameters to deploy doc 76 | user: xoac 77 | email: sylwesterrapala@outlook.com 78 | repo: https://github.com/xoac/rust-azure-pipelines/ 79 | 80 | # Create releases deploy binaries 81 | - template: ci/scenarios/github/release.yml@rust_pipelines 82 | parameters: 83 | job_condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) 84 | gitHubConnection: PipelinesTemplates # TODO This connection need write access to your repo! https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/github-release?view=azure-devops 85 | -------------------------------------------------------------------------------- /ci/jobs/cargo-build.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | # azure pipelines paramters 3 | job_name: cargo_build # Default job name 4 | job_displayName: Cargo build # Default displayName 5 | job_dependsOn: [] # Dependencies to for the job to start 6 | job_condition: true # Job condition 7 | job_post-steps: [] # Custom steps running after job 8 | job_pre-steps: [] # Custom steps before job start 9 | job_pool: 10 | vmImage: ubuntu-16.04 # Default vmImage 11 | 12 | # global parameters 13 | rust: stable # Version of rust. Could be [stable, beta, nightly, 1.31, nightly-2018-08-01 ... ] 14 | 15 | # parameters from `cargo check --help` 16 | quiet: false # No output printed to stdout 17 | package: [] # Package(s) to check 18 | all: false # Check all packages in the workspace 19 | exclude: [] # Exclude packages from the check 20 | lib: false # Check only this package's library 21 | bin: [] # Check only the specified binary 22 | bins: false # Check all binaries 23 | example: [] # Check only the specified example 24 | examples: false # Check all examples 25 | test: [] # Check only the specified test target 26 | tests: false # Check all tests 27 | benche: [] # Check only the specified bench target 28 | benches: false # Check all benches 29 | all-targets: false # Check all targets 30 | release: false # Check artifacts in release mode, with optimizations 31 | profile: "" # Profile to build the selected target for 32 | features: '' # Space-separated list of features to activate 33 | all-features: false # Activate all available features 34 | no-default-features: false # Do not activate the `default` feature 35 | target: '' # Check for the target triple 36 | target-dir: '' # Directory for all generated artifacts 37 | manifest-path: '' # Path to Cargo.toml 38 | message-format: '' # Error format [default: human] [possible values: human, json, short] 39 | verbose: false # Use verbose output 40 | color: '' # Coloring: auto, always, never 41 | frozen: false # Require Cargo.lock and cache are up to date 42 | locked: false # Require Cargo.lock is up to date 43 | Z: [] # Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details 44 | 45 | jobs: 46 | - job: ${{ parameters['job_name'] }} 47 | displayName: ${{ parameters['job_displayName'] }} 48 | condition: ${{ parameters['job_condition'] }} 49 | dependsOn: ${{ parameters['job_dependsOn'] }} 50 | pool: 51 | vmImage: ${{ parameters.job_pool['vmImage'] }} 52 | variables: 53 | check_flags: '' 54 | steps: 55 | # Custom pre steps: 56 | - ${{ if parameters['job_pre-steps'] }}: 57 | - ${{ parameters['job_pre-steps'] }} 58 | 59 | - template: ../steps/install-rust.yml 60 | parameters: 61 | rustup_toolchain: ${{ parameters['rust'] }} 62 | ${{ if ne(parameters['target'], '') }}: 63 | targets: 64 | - ${{ parameters['target'] }} 65 | 66 | # ########################################################################################## 67 | # Order of script modifying `check_flags` is the same as in paramters. 68 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --quiet' 69 | enabled: ${{ parameters['quiet'] }} 70 | displayName: "[cli flag modify]No output printed to stdout" 71 | 72 | - ${{ each pkg in parameters['package'] }}: 73 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --package ${{ pkg }}' 74 | displayName: "[cli flag modify]Add package to check '${{ pkg }}'" 75 | 76 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --all' 77 | enabled: ${{ parameters['all'] }} 78 | displayName: "[cli flag modify]Check all packages in the workspace" 79 | 80 | - ${{ each pkg in parameters['exclude'] }}: 81 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --exclude ${{ pkg }}' 82 | displayName: "[cli flag modify]Exclude package from check '${{ pkg }}'" 83 | 84 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --lib' 85 | enabled: ${{ parameters['lib'] }} 86 | displayName: "[cli flag modify]Check only this package's library" 87 | 88 | - ${{ each bin in parameters['bin'] }}: 89 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --bin ${{ bin }}' 90 | displayName: "[cli flag modify]Add binary '${{ bin }}' to check" 91 | 92 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --bins' 93 | enabled: ${{ parameters['bins'] }} 94 | displayName: "[cli flag modify]Check all binaries" 95 | 96 | - ${{ each exa in parameters['example'] }}: 97 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --example ${{ exa }}' 98 | displayName: "[cli flag modify]Add example '${{ exa }}' to check" 99 | 100 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --examples' 101 | enabled: ${{ parameters['examples'] }} 102 | displayName: "[cli flag modify]check all examples" 103 | 104 | - ${{ each tes in parameters['test'] }}: 105 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --test ${{ tes }}' 106 | displayName: "[cli flag modify]Add test '${{ tes }}' to check" 107 | 108 | - ${{ each ben in parameters['benche'] }}: 109 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --benche ${{ ben }}' 110 | displayName: "[cli flag modify]Add benche '${{ ben }}' to check" 111 | 112 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --benches' 113 | enabled: ${{ parameters['benches'] }} 114 | displayName: "[cli flag modify]check all benches" 115 | 116 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --release' 117 | enabled: ${{ parameters['release'] }} 118 | displayName: "[cli flag modify]Set using release mode" 119 | 120 | - bash: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --profile ${{ parameters['profile'] }}" 121 | enabled: ${{ ne(parameters['profile'], '') }} 122 | displayName: "[cli flag modify]Set profile ('${{ parameters['profile'] }}') to build the selected target for" 123 | 124 | - bash: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --features ${{ parameters['features'] }}" 125 | enabled: ${{ ne(parameters['features'], '') }} 126 | displayName: "[cli flag modify]Space-separated list of features to activate: ${{ parameters['features'] }}" 127 | 128 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --all-features' 129 | enabled: ${{ parameters['all-features'] }} 130 | displayName: "[cli flag modify]Activate all available features" 131 | 132 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --no-default-features' 133 | enabled: ${{ parameters['no-default-features'] }} 134 | displayName: "[cli flag modify]Do not activate the `default` feature" 135 | 136 | - bash: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --target ${{ parameters['target'] }}" 137 | enabled: ${{ ne(parameters['target'], '') }} 138 | displayName: "[cli flag modify]Check for the target triple" 139 | 140 | - bash: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --target-dir ${{ parameters['target-dir'] }}" 141 | enabled: ${{ ne(parameters['target-dir'], '') }} 142 | displayName: "[cli flag modify]Directory for all generated artifacts" 143 | 144 | - bash: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --manifest-path ${{ parameters['manifest-path'] }}" 145 | enabled: ${{ ne(parameters['manifest-path'], '') }} 146 | displayName: "[cli flag modify]Set custom path to Cargo.toml" 147 | 148 | - bash: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --message-format ${{ parameters['message-format'] }}" 149 | enabled: ${{ ne(parameters['message-format'], '') }} 150 | displayName: "[cli flag modify]Set error format to ${{ parameters['message-format'] }}" 151 | 152 | - bash: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --verbose }}" 153 | enabled: ${{ parameters['verbose'] }} 154 | displayName: "[cli flag modify]use verbose output" 155 | 156 | - bash: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --color ${{ parameters['color'] }}" 157 | enabled: ${{ ne(parameters['color'], '') }} 158 | displayName: "[cli flag modify]Coloring: ${{ parameters['color'] }}" 159 | 160 | - bash: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --frozen }}" 161 | enabled: ${{ parameters['frozen'] }} 162 | displayName: "[cli flag modify]Require Cargo.lock and cache are up to date" 163 | 164 | - bash: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --locked }}" 165 | enabled: ${{ parameters['locked'] }} 166 | displayName: "[cli flag modify]Require Cargo.lock is up to date" 167 | 168 | - ${{ each z in parameters['Z'] }}: 169 | - bash: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --Z ${{ z }}' 170 | displayName: "[cli flag modify]Add Z flag ${{ z }}" 171 | # ########################################################################################## 172 | 173 | # Final run 174 | - bash: cargo build $(check_flags) 175 | displayName: Run cargo build with defined flags 176 | 177 | # Custom steps: 178 | - ${{ if parameters['job_post-steps'] }}: 179 | - ${{ parameters['job_post-steps'] }} 180 | 181 | -------------------------------------------------------------------------------- /ci/jobs/cargo-check.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | # azure pipelines paramters 3 | job_name: cargo_check # Default job name 4 | job_displayName: Cargo check # Default displayName 5 | job_dependsOn: [] # Dependencies to for the job to start 6 | job_condition: true # Job condition 7 | job_continueOnError: false # Should other job still run even if this fail 8 | job_post-steps: [] # Custom steps running after job 9 | 10 | # global parameters 11 | rust: stable # Version of rust. Could be [stable, beta, nightly, 1.31, nightly-2018-08-01 ... ] 12 | 13 | # parameters from `cargo check --help` 14 | quiet: false # No output printed to stdout 15 | package: [] # Package(s) to check 16 | all: false # Check all packages in the workspace 17 | exclude: [] # Exclude packages from the check 18 | lib: false # Check only this package's library 19 | bin: [] # Check only the specified binary 20 | bins: false # Check all binaries 21 | example: [] # Check only the specified example 22 | examples: false # Check all examples 23 | test: [] # Check only the specified test target 24 | tests: false # Check all tests 25 | benche: [] # Check only the specified bench target 26 | benches: false # Check all benches 27 | all-targets: false # Check all targets 28 | release: false # Check artifacts in release mode, with optimizations 29 | profile: "" # Profile to build the selected target for 30 | features: '' # Space-separated list of features to activate 31 | all-features: false # Activate all available features 32 | no-default-features: false # Do not activate the `default` feature 33 | target: '' # Check for the target triple 34 | target-dir: '' # Directory for all generated artifacts 35 | manifest-path: '' # Path to Cargo.toml 36 | message-format: '' # Error format [default: human] [possible values: human, json, short] 37 | verbose: false # Use verbose output 38 | color: '' # Coloring: auto, always, never 39 | frozen: false # Require Cargo.lock and cache are up to date 40 | locked: false # Require Cargo.lock is up to date 41 | Z: [] # Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details 42 | 43 | jobs: 44 | - job: ${{ parameters['job_name'] }} 45 | displayName: ${{ parameters['job_displayName'] }} 46 | condition: ${{ parameters['job_condition'] }} 47 | dependsOn: ${{ parameters['job_dependsOn'] }} 48 | continueOnError: ${{ parameters['job_continueOnError'] }} 49 | pool: 50 | vmImage: ubuntu-16.04 51 | variables: 52 | check_flags: '' 53 | steps: 54 | - template: ../steps/install-rust.yml 55 | parameters: 56 | rustup_toolchain: ${{ parameters['rust'] }} 57 | 58 | # ########################################################################################## 59 | # Order of script modifying `check_flags` is the same as in paramters. 60 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --quiet' 61 | enabled: ${{ parameters['quiet'] }} 62 | displayName: "[cli flag modify]No output printed to stdout" 63 | 64 | - ${{ each pkg in parameters['package'] }}: 65 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --package ${{ pkg }}' 66 | displayName: "[cli flag modify]Add package to check '${{ pkg }}'" 67 | 68 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --all' 69 | enabled: ${{ parameters['all'] }} 70 | displayName: "[cli flag modify]Check all packages in the workspace" 71 | 72 | - ${{ each pkg in parameters['exclude'] }}: 73 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --exclude ${{ pkg }}' 74 | displayName: "[cli flag modify]Exclude package from check '${{ pkg }}'" 75 | 76 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --lib' 77 | enabled: ${{ parameters['lib'] }} 78 | displayName: "[cli flag modify]Check only this package's library" 79 | 80 | - ${{ each bin in parameters['bin'] }}: 81 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --bin ${{ bin }}' 82 | displayName: "[cli flag modify]Add binary '${{ bin }}' to check" 83 | 84 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --bins' 85 | enabled: ${{ parameters['bins'] }} 86 | displayName: "[cli flag modify]Check all binaries" 87 | 88 | - ${{ each exa in parameters['example'] }}: 89 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --example ${{ exa }}' 90 | displayName: "[cli flag modify]Add example '${{ exa }}' to check" 91 | 92 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --examples' 93 | enabled: ${{ parameters['examples'] }} 94 | displayName: "[cli flag modify]check all examples" 95 | 96 | - ${{ each tes in parameters['test'] }}: 97 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --test ${{ tes }}' 98 | displayName: "[cli flag modify]Add test '${{ tes }}' to check" 99 | 100 | - ${{ each ben in parameters['benche'] }}: 101 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --benche ${{ ben }}' 102 | displayName: "[cli flag modify]Add benche '${{ ben }}' to check" 103 | 104 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --benches' 105 | enabled: ${{ parameters['benches'] }} 106 | displayName: "[cli flag modify]check all benches" 107 | 108 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --release' 109 | enabled: ${{ parameters['release'] }} 110 | displayName: "[cli flag modify]Set using release mode" 111 | 112 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --profile ${{ parameters['profile'] }}" 113 | enabled: ${{ ne(parameters['profile'], '') }} 114 | displayName: "[cli flag modify]Set profile ('${{ parameters['profile'] }}') to build the selected target for" 115 | 116 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --features ${{ parameters['features'] }}" 117 | enabled: ${{ ne(parameters['features'], '') }} 118 | displayName: "[cli flag modify]Space-separated list of features to activate: ${{ parameters['features'] }}" 119 | 120 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --all-features' 121 | enabled: ${{ parameters['all-features'] }} 122 | displayName: "[cli flag modify]Activate all available features" 123 | 124 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --no-default-features' 125 | enabled: ${{ parameters['no-default-features'] }} 126 | displayName: "[cli flag modify]Do not activate the `default` feature" 127 | 128 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --target ${{ parameters['target'] }}" 129 | enabled: ${{ ne(parameters['target'], '') }} 130 | displayName: "[cli flag modify]Check for the target triple" 131 | 132 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --target-dir ${{ parameters['target-dir'] }}" 133 | enabled: ${{ ne(parameters['target-dir'], '') }} 134 | displayName: "[cli flag modify]Directory for all generated artifacts" 135 | 136 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --manifest-path ${{ parameters['manifest-path'] }}" 137 | enabled: ${{ ne(parameters['manifest-path'], '') }} 138 | displayName: "[cli flag modify]Set custom path to Cargo.toml" 139 | 140 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --message-format ${{ parameters['message-format'] }}" 141 | enabled: ${{ ne(parameters['message-format'], '') }} 142 | displayName: "[cli flag modify]Set error format to ${{ parameters['message-format'] }}" 143 | 144 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --verbose }}" 145 | enabled: ${{ parameters['verbose'] }} 146 | displayName: "[cli flag modify]use verbose output" 147 | 148 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --color ${{ parameters['color'] }}" 149 | enabled: ${{ ne(parameters['color'], '') }} 150 | displayName: "[cli flag modify]Coloring: ${{ parameters['color'] }}" 151 | 152 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --frozen }}" 153 | enabled: ${{ parameters['frozen'] }} 154 | displayName: "[cli flag modify]Require Cargo.lock and cache are up to date" 155 | 156 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --locked }}" 157 | enabled: ${{ parameters['locked'] }} 158 | displayName: "[cli flag modify]Require Cargo.lock is up to date" 159 | 160 | - ${{ each z in parameters['Z'] }}: 161 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --Z ${{ z }}' 162 | displayName: "[cli flag modify]Add Z flag ${{ z }}" 163 | # ########################################################################################## 164 | 165 | # Final run 166 | - script: cargo check $(check_flags) 167 | displayName: Run Cargo check with defined flags 168 | 169 | # Custom steps: 170 | - ${{ if parameters['job_post-steps'] }}: 171 | - ${{ parameters['job_post-steps'] }} 172 | 173 | -------------------------------------------------------------------------------- /ci/jobs/cargo-clippy.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | # azure pipelines paramters 3 | job_name: cargo_clippy # Default job name 4 | job_displayName: Cargo clippy # Default displayName 5 | job_dependsOn: [] # Dependencies to for the job to start 6 | job_condition: true # Job condition 7 | job_continueOnError: false # Treat error as warings? 8 | job_post-steps: [] # Custom steps running after job 9 | 10 | # global parameters 11 | rust: stable # Version of rust. Could be [stable, beta, nightly, 1.31, nightly-2018-08-01 ... ] 12 | 13 | # parameters for cargo clippy --help 14 | warn: [] # Set lint warnings 15 | allow: [] # Set lint allowed 16 | deny: [] # Set lint denied 17 | forbid: [] # Set lint forbidden 18 | 19 | # the copy of parameters from `cargo check` as suggest `cargo clippy --help` 20 | quiet: false # No output printed to stdout 21 | package: [] # Package(s) to check 22 | all: false # Check all packages in the workspace 23 | exclude: [] # Exclude packages from the check 24 | lib: false # Check only this package's library 25 | bin: [] # Check only the specified binary 26 | bins: false # Check all binaries 27 | example: [] # Check only the specified example 28 | examples: false # Check all examples 29 | test: [] # Check only the specified test target 30 | tests: false # Check all tests 31 | benche: [] # Check only the specified bench target 32 | benches: false # Check all benches 33 | all-targets: false # Check all targets 34 | release: false # Check artifacts in release mode, with optimizations 35 | profile: "" # Profile to build the selected target for 36 | features: '' # Space-separated list of features to activate 37 | all-features: false # Activate all available features 38 | no-default-features: false # Do not activate the `default` feature 39 | target: '' # Check for the target triple 40 | target-dir: '' # Directory for all generated artifacts 41 | manifest-path: '' # Path to Cargo.toml 42 | message-format: '' # Error format [default: human] [possible values: human, json, short] 43 | verbose: false # Use verbose output 44 | color: '' # Coloring: auto, always, never 45 | frozen: false # Require Cargo.lock and cache are up to date 46 | locked: false # Require Cargo.lock is up to date 47 | Z: [] # Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details 48 | 49 | jobs: 50 | - job: ${{ parameters['job_name'] }} 51 | displayName: ${{ parameters['job_displayName'] }} 52 | condition: ${{ parameters['job_condition'] }} 53 | continueOnError: ${{ parameters['job_continueOnError'] }} 54 | dependsOn: ${{ parameters['job_dependsOn'] }} 55 | pool: 56 | vmImage: ubuntu-16.04 57 | variables: 58 | clippy_flags: '' 59 | check_flags: '' 60 | steps: 61 | - template: ../steps/install-rust.yml 62 | parameters: 63 | rust_toolchain: ${{ parameters.rust }} 64 | components: 65 | - clippy 66 | 67 | - ${{ each w in parameters['warn'] }}: 68 | - script: echo '##vso[task.setvariable variable=clippy_flags]$(clippy_flags) --warn ${{ w }}' 69 | displayName: "[cli flag modify] Add warning lint: ${{ w }}" 70 | 71 | - ${{ each a in parameters['allow'] }}: 72 | - script: echo '##vso[task.setvariable variable=clippy_flags]$(clippy_flags) --allow ${{ a }}' 73 | displayName: "[cli flag modify] Add lint allowed: ${{ a }}" 74 | 75 | - ${{ each d in parameters['deny'] }}: 76 | - script: echo '##vso[task.setvariable variable=clippy_flags]$(clippy_flags) --deny ${{ d }}' 77 | displayName: "[cli flag modify] Add lint denied: ${{ d }}" 78 | 79 | - ${{ each f in parameters['forbid'] }}: 80 | - script: echo '##vso[task.setvariable variable=clippy_flags]$(clippy_flags) --forbid ${{ f }}' 81 | displayName: "[cli flag modify] Add lint forbidden: ${{ f }}" 82 | 83 | # ########################################################################################## 84 | # Order of script modifying `check_flags` is the same as in paramters. 85 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --quiet' 86 | enabled: ${{ parameters['quiet'] }} 87 | displayName: "[cli flag modify]No output printed to stdout" 88 | 89 | - ${{ each pkg in parameters['package'] }}: 90 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --package ${{ pkg }}' 91 | displayName: "[cli flag modify]Add package to check '${{ pkg }}'" 92 | 93 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --all' 94 | enabled: ${{ parameters['all'] }} 95 | displayName: "[cli flag modify]Check all packages in the workspace" 96 | 97 | - ${{ each pkg in parameters['exclude'] }}: 98 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --exclude ${{ pkg }}' 99 | displayName: "[cli flag modify]Exclude package from check '${{ pkg }}'" 100 | 101 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --lib' 102 | enabled: ${{ parameters['lib'] }} 103 | displayName: "[cli flag modify]Check only this package's library" 104 | 105 | - ${{ each bin in parameters['bin'] }}: 106 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --bin ${{ bin }}' 107 | displayName: "[cli flag modify]Add binary '${{ bin }}' to check" 108 | 109 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --bins' 110 | enabled: ${{ parameters['bins'] }} 111 | displayName: "[cli flag modify]Check all binaries" 112 | 113 | - ${{ each exa in parameters['example'] }}: 114 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --example ${{ exa }}' 115 | displayName: "[cli flag modify]Add example '${{ exa }}' to check" 116 | 117 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --examples' 118 | enabled: ${{ parameters['examples'] }} 119 | displayName: "[cli flag modify]check all examples" 120 | 121 | - ${{ each tes in parameters['test'] }}: 122 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --test ${{ tes }}' 123 | displayName: "[cli flag modify]Add test '${{ tes }}' to check" 124 | 125 | - ${{ each ben in parameters['benche'] }}: 126 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --benche ${{ ben }}' 127 | displayName: "[cli flag modify]Add benche '${{ ben }}' to check" 128 | 129 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --benches' 130 | enabled: ${{ parameters['benches'] }} 131 | displayName: "[cli flag modify]check all benches" 132 | 133 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --release' 134 | enabled: ${{ parameters['release'] }} 135 | displayName: "[cli flag modify]Set using release mode" 136 | 137 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --profile ${{ parameters['profile'] }}" 138 | enabled: ${{ ne(parameters['profile'], '') }} 139 | displayName: "[cli flag modify]Set profile ('${{ parameters['profile'] }}') to build the selected target for" 140 | 141 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --features ${{ parameters['features'] }}" 142 | enabled: ${{ ne(parameters['features'], '') }} 143 | displayName: "[cli flag modify]Space-separated list of features to activate: ${{ parameters['features'] }}" 144 | 145 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --all-features' 146 | enabled: ${{ parameters['all-features'] }} 147 | displayName: "[cli flag modify]Activate all available features" 148 | 149 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --no-default-features' 150 | enabled: ${{ parameters['no-default-features'] }} 151 | displayName: "[cli flag modify]Do not activate the `default` feature" 152 | 153 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --target ${{ parameters['target'] }}" 154 | enabled: ${{ ne(parameters['target'], '') }} 155 | displayName: "[cli flag modify]Check for the target triple" 156 | 157 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --target-dir ${{ parameters['target-dir'] }}" 158 | enabled: ${{ ne(parameters['target-dir'], '') }} 159 | displayName: "[cli flag modify]Directory for all generated artifacts" 160 | 161 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --manifest-path ${{ parameters['manifest-path'] }}" 162 | enabled: ${{ ne(parameters['manifest-path'], '') }} 163 | displayName: "[cli flag modify]Set custom path to Cargo.toml" 164 | 165 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --message-format ${{ parameters['message-format'] }}" 166 | enabled: ${{ ne(parameters['message-format'], '') }} 167 | displayName: "[cli flag modify]Set error format to ${{ parameters['message-format'] }}" 168 | 169 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --verbose }}" 170 | enabled: ${{ parameters['verbose'] }} 171 | displayName: "[cli flag modify]use verbose output" 172 | 173 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --color ${{ parameters['color'] }}" 174 | enabled: ${{ ne(parameters['color'], '') }} 175 | displayName: "[cli flag modify]Coloring: ${{ parameters['color'] }}" 176 | 177 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --frozen }}" 178 | enabled: ${{ parameters['frozen'] }} 179 | displayName: "[cli flag modify]Require Cargo.lock and cache are up to date" 180 | 181 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --locked }}" 182 | enabled: ${{ parameters['locked'] }} 183 | displayName: "[cli flag modify]Require Cargo.lock is up to date" 184 | 185 | - ${{ each z in parameters['Z'] }}: 186 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --Z ${{ z }}' 187 | displayName: "[cli flag modify]Add Z flag ${{ z }}" 188 | # ########################################################################################## 189 | 190 | - script: cargo clippy $(check_flags) -- $(clippy_flags) 191 | displayName: Run clippy with custom flags 192 | 193 | # Custom steps: 194 | - ${{ if parameters['job_post-steps'] }}: 195 | - ${{ parameters['job_post-steps'] }} 196 | 197 | -------------------------------------------------------------------------------- /ci/jobs/cargo-doc.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | # azure pipelines paramters 3 | job_name: cargo_doc # Default job name 4 | job_displayName: Cargo doc # Default displayName 5 | job_dependsOn: [] # Dependencies to for the job to start 6 | job_condition: true # Job condition 7 | job_post-steps: [] # Custom steps running after job 8 | 9 | # global parameters 10 | rust: stable # Version of rust. Could be [stable, beta, nightly, 1.31, nightly-2018-08-01 ... ] 11 | 12 | # parameters from `cargo doc --help` 13 | quiet: false # No output printed to stdout 14 | # open Opens the docs in a browser after the operation (no sense in CI) 15 | package: [] # Package(s) to check 16 | all: false # Check all packages in the workspace 17 | exclude: [] # Exclude packages from the check 18 | no-deps: false # Don't build documentation for dependencies 19 | document-private-items: false # Document private items 20 | lib: false # Check only this package's library 21 | bin: [] # Check only the specified binary 22 | bins: false # Check all binaries 23 | release: false # Check artifacts in release mode, with optimizations 24 | features: '' # Space-separated list of features to activate 25 | all-features: false # Activate all available features 26 | no-default-features: false # Do not activate the `default` feature 27 | target: '' # Check for the target triple 28 | target-dir: '' # Directory for all generated artifacts 29 | manifest-path: '' # Path to Cargo.toml 30 | message-format: '' # Error format [default: human] [possible values: human, json, short] 31 | verbose: false # Use verbose output 32 | color: '' # Coloring: auto, always, never 33 | frozen: false # Require Cargo.lock and cache are up to date 34 | locked: false # Require Cargo.lock is up to date 35 | Z: [] # Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details 36 | 37 | jobs: 38 | - job: ${{ parameters['job_name'] }} 39 | displayName: ${{ parameters['job_displayName'] }} 40 | condition: ${{ parameters['job_condition'] }} 41 | dependsOn: ${{ parameters['job_dependsOn'] }} 42 | pool: 43 | vmImage: ubuntu-16.04 44 | variables: 45 | doc_flags: '' 46 | steps: 47 | - template: ../steps/install-rust.yml 48 | parameters: 49 | rustup_toolchain: ${{ parameters['rust'] }} 50 | 51 | # ########################################################################################## 52 | # Order of script modifying `doc_flags` is the same as in paramters. 53 | - script: echo '##vso[task.setvariable variable=doc_flags]$(doc_flags) --quiet' 54 | enabled: ${{ parameters['quiet'] }} 55 | displayName: "[cli flag modify]No output printed to stdout" 56 | 57 | - ${{ each pkg in parameters['package'] }}: 58 | - script: echo '##vso[task.setvariable variable=doc_flags]$(doc_flags) --package ${{ pkg }}' 59 | displayName: "[cli flag modify]Add package to check '${{ pkg }}'" 60 | 61 | - script: echo '##vso[task.setvariable variable=doc_flags]$(doc_flags) --all' 62 | enabled: ${{ parameters['all'] }} 63 | displayName: "[cli flag modify]Check all packages in the workspace" 64 | 65 | - ${{ each pkg in parameters['exclude'] }}: 66 | - script: echo '##vso[task.setvariable variable=doc_flags]$(doc_flags) --exclude ${{ pkg }}' 67 | displayName: "[cli flag modify]Exclude package from check '${{ pkg }}'" 68 | 69 | - script: echo '##vso[task.setvariable variable=doc_flags]$(doc_flags) --no-deps' 70 | enabled: ${{ parameters['no-deps'] }} 71 | displayName: "[cli flag modify]Don't build documentation for dependencies" 72 | 73 | - script: echo '##vso[task.setvariable variable=doc_flags]$(doc_flags) --document-private-items' 74 | enabled: ${{ parameters['document-private-items'] }} 75 | displayName: "[cli flag modify]Document private items" 76 | 77 | - script: echo '##vso[task.setvariable variable=doc_flags]$(doc_flags) --lib' 78 | enabled: ${{ parameters['lib'] }} 79 | displayName: "[cli flag modify]Check only this package's library" 80 | 81 | - ${{ each bin in parameters['bin'] }}: 82 | - script: echo '##vso[task.setvariable variable=doc_flags]$(doc_flags) --bin ${{ bin }}' 83 | displayName: "[cli flag modify]Add binary '${{ bin }}' to check" 84 | 85 | - script: echo '##vso[task.setvariable variable=doc_flags]$(doc_flags) --bins' 86 | enabled: ${{ parameters['bins'] }} 87 | displayName: "[cli flag modify]Check all binaries" 88 | 89 | - script: echo '##vso[task.setvariable variable=doc_flags]$(doc_flags) --release' 90 | enabled: ${{ parameters['release'] }} 91 | displayName: "[cli flag modify]Set using release mode" 92 | 93 | - script: echo "##vso[task.setvariable variable=doc_flags]$(doc_flags) --features ${{ parameters['features'] }}" 94 | enabled: ${{ ne(parameters['features'], '') }} 95 | displayName: "[cli flag modify]Space-separated list of features to activate: ${{ parameters['features'] }}" 96 | 97 | - script: echo '##vso[task.setvariable variable=doc_flags]$(doc_flags) --all-features' 98 | enabled: ${{ parameters['all-features'] }} 99 | displayName: "[cli flag modify]Activate all available features" 100 | 101 | - script: echo '##vso[task.setvariable variable=doc_flags]$(doc_flags) --no-default-features' 102 | enabled: ${{ parameters['no-default-features'] }} 103 | displayName: "[cli flag modify]Do not activate the `default` feature" 104 | 105 | - script: echo "##vso[task.setvariable variable=doc_flags]$(doc_flags) --target ${{ parameters['target'] }}" 106 | enabled: ${{ ne(parameters['target'], '') }} 107 | displayName: "[cli flag modify]Check for the target triple" 108 | 109 | - script: echo "##vso[task.setvariable variable=doc_flags]$(doc_flags) --target-dir ${{ parameters['target-dir'] }}" 110 | enabled: ${{ ne(parameters['target-dir'], '') }} 111 | displayName: "[cli flag modify]Directory for all generated artifacts" 112 | 113 | - script: echo "##vso[task.setvariable variable=doc_flags]$(doc_flags) --manifest-path ${{ parameters['manifest-path'] }}" 114 | enabled: ${{ ne(parameters['manifest-path'], '') }} 115 | displayName: "[cli flag modify]Set custom path to Cargo.toml" 116 | 117 | - script: echo "##vso[task.setvariable variable=doc_flags]$(doc_flags) --message-format ${{ parameters['message-format'] }}" 118 | enabled: ${{ ne(parameters['message-format'], '') }} 119 | displayName: "[cli flag modify]Set error format to ${{ parameters['message-format'] }}" 120 | 121 | - script: echo "##vso[task.setvariable variable=doc_flags]$(doc_flags) --verbose }}" 122 | enabled: ${{ parameters['verbose'] }} 123 | displayName: "[cli flag modify]use verbose output" 124 | 125 | - script: echo "##vso[task.setvariable variable=doc_flags]$(doc_flags) --color ${{ parameters['color'] }}" 126 | enabled: ${{ ne(parameters['color'], '') }} 127 | displayName: "[cli flag modify]Coloring: ${{ parameters['color'] }}" 128 | 129 | - script: echo "##vso[task.setvariable variable=doc_flags]$(doc_flags) --frozen }}" 130 | enabled: ${{ parameters['frozen'] }} 131 | displayName: "[cli flag modify]Require Cargo.lock and cache are up to date" 132 | 133 | - script: echo "##vso[task.setvariable variable=doc_flags]$(doc_flags) --locked }}" 134 | enabled: ${{ parameters['locked'] }} 135 | displayName: "[cli flag modify]Require Cargo.lock is up to date" 136 | 137 | - ${{ each z in parameters['Z'] }}: 138 | - script: echo '##vso[task.setvariable variable=doc_flags]$(doc_flags) --Z ${{ z }}' 139 | displayName: "[cli flag modify]Add Z flag ${{ z }}" 140 | # ########################################################################################## 141 | 142 | # Final run 143 | - script: cargo doc $(doc_flags) 144 | displayName: Run cargo doc with defined flags 145 | 146 | # Custom steps: 147 | - ${{ if parameters['job_post-steps'] }}: 148 | - ${{ parameters['job_post-steps'] }} 149 | -------------------------------------------------------------------------------- /ci/jobs/cargo-test.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | job_name: cargo_test # Default job name 3 | job_displayName: Cargo test # Default displayName 4 | job_dependsOn: [] # Dependencies to for the job to start 5 | job_condition: true # Job condition 6 | job_continueOnError: false # Should other job still run even if this fail 7 | job_post-steps: [] # Custom steps running after job 8 | job_strategy: # Default strategy to test on Windows, MacOs and Linux. 9 | matrix: 10 | Linux: 11 | vmImage: ubuntu-16.04 12 | MacOS: 13 | vmImage: macOS-10.15 14 | Windows: 15 | vmImage: vs2017-win2016 16 | # global parameters 17 | rust: stable # Version of rust. Could be [stable, beta, nightly, 1.31, nightly-2018-08-01 ... ] 18 | 19 | # parameters from `cargo test --help` 20 | # TODO 21 | 22 | # parameters from libtest `cargo test -- --help` 23 | test_flags: 24 | include-ignored: false # Run ignored and not ignored tests 25 | ignored: false # Run only ignored tests 26 | exclude-should-panic: false # Excludes tests marked as should_panic 27 | test: false # Run tests and not benchmarks 28 | bench: false # Run benchmarks instead of tests 29 | list: false # List all tests and benchmarks 30 | logfile: '' # Write logs to the specified file instead of stdout 31 | nocapture: false # don't capture stdout/stderr of each task, allow 32 | # printing directly 33 | test-threads: 0 # Number of threads used for running tests in parallel 34 | skip: [] # Skip tests whose names contain FILTER (this flag can 35 | # be used multiple times) 36 | quite: false # Display one character per test instead of one line. 37 | # Alias to --format=terse 38 | exact: false # Exactly match filters rather than by substring 39 | color: '' # auto|always|never 40 | # Configure coloring of output: auto = colorize if 41 | # stdout is a tty and tests are run on serially 42 | # (default); always = always colorize output; never = 43 | # never colorize output; 44 | format: '' # pretty|terse|json 45 | # Configure formatting of output: pretty = Print verbose 46 | # output; terse = Display one character per test; json = 47 | # Output a json document 48 | Z: [] # unstable-options Enable nightly-only flags: unstable-options = Allow 49 | # use of experimental features 50 | 51 | 52 | jobs: 53 | - job: ${{ parameters['job_name'] }} 54 | displayName: ${{ parameters['job_displayName'] }} 55 | condition: ${{ parameters['job_condition'] }} 56 | continueOnError: ${{ parameters['job_continueOnError'] }} 57 | dependsOn: ${{ parameters['job_dependsOn'] }} 58 | strategy: ${{ parameters['job_strategy'] }} 59 | pool: 60 | vmImage: $(vmImage) 61 | variables: 62 | check_flags: '' 63 | steps: 64 | - template: ../steps/install-rust.yml 65 | parameters: 66 | rustup_toolchain: ${{ parameters.rust }} 67 | 68 | # ********************************************************************************************* 69 | # parameters from libtest `cargo test -- --help` 70 | 71 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --include-ignored' 72 | enabled: ${{ parameters.test_flags['include-ignored'] }} 73 | displayName: "[cli flag modify]Run ignored and not ignored tests" 74 | 75 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --ignored' 76 | enabled: ${{ parameters.test_flags['ignored'] }} 77 | displayName: "[cli flag modify]Run only ignored tests" 78 | 79 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --exclude-should-panic' 80 | enabled: ${{ parameters.test_flags['exclude-should-panic'] }} 81 | displayName: "[cli flag modify]Excludes tests marked as should_panic" 82 | 83 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --test' 84 | enabled: ${{ parameters.test_flags['test'] }} 85 | displayName: "[cli flag modify]Run tests and not benchmarks" 86 | 87 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --bench' 88 | enabled: ${{ parameters.test_flags['bench'] }} 89 | displayName: "[cli flag modify]Run benchmarks instead of tests" 90 | 91 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --list' 92 | enabled: ${{ parameters.test_flags['list'] }} 93 | displayName: "[cli flag modify]List all tests and benchmarks" 94 | 95 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --logfile ${{ parameters.test_flags['logfile'] }}" 96 | enabled: ${{ ne(parameters.test_flags['logfile'], '') }} 97 | displayName: "[cli flag modify] Write logs to the specified file ${{ parameters.test_flags['logfile'] }}" 98 | 99 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --nocapture' 100 | enabled: ${{ parameters.test_flags['nocapture'] }} 101 | displayName: "[cli flag modify]don't capture stdout/stderr of each task, allow printing it directly" 102 | 103 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --test-threads ${{ parameters.test_flags['test-threads'] }}" 104 | enabled: ${{ ne(parameters.test_flags['test-threads'], 0) }} 105 | displayName: "[cli flag modify]Set number of threads used for running tests in parallel to ${{ parameters.test_flags['test-threads'] }}" 106 | 107 | - ${{ each s in parameters.test_flags['skip'] }}: 108 | - script: echo '##vso[task.setvariableV variable=check_flags]$(check_flags) --skip ${{ s }}' 109 | displayName: "[cli flag modify]Skip test using filter ${{ s }}" 110 | 111 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --quite' 112 | enabled: ${{ parameters.test_flags['quite'] }} 113 | displayName: "[cli flag modify]Display one character per test instead of one line." 114 | 115 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --exact' 116 | enabled: ${{ parameters.test_flags['exact'] }} 117 | displayName: "[cli flag modify]Exactly match filters rather than by substring" 118 | 119 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --color ${{ parameters.test_flags['color'] }}" 120 | enabled: ${{ ne(parameters.test_flags['color'], '') }} 121 | displayName: "[cli flag modify] Configure coloring of output: ${{ parameters.test_flags['color'] }}" 122 | 123 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --format ${{ parameters.test_flags['format'] }}" 124 | enabled: ${{ ne(parameters.test_flags['format'], '') }} 125 | displayName: "[cli flag modify] Configure formatting of output: ${{ parameters.test_flags['format'] }}" 126 | 127 | - ${{ each z in parameters.test_flags['Z'] }}: 128 | - script: echo '##vso[task.setvariableV variable=check_flags]$(check_flags) --Z ${{ z }}' 129 | displayName: "[cli flag modify] unstable-option: ${{ z }}" 130 | 131 | # ********************************************************************************************* 132 | - script: cargo test -- $(check_flags) 133 | displayName: cargo test 134 | 135 | # Custom steps: 136 | - ${{ if parameters['job_post-steps'] }}: 137 | - ${{ parameters['job_post-steps'] }} 138 | 139 | -------------------------------------------------------------------------------- /ci/jobs/cross-build.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | # azure pipelines paramters 3 | job_name: cross_build # Default job name 4 | job_displayName: Cross build # Default displayName 5 | job_dependsOn: [] # Dependencies to for the job to start 6 | job_condition: true # Job condition 7 | job_post-steps: [] # Custom steps running after job 8 | 9 | # global parameters 10 | rust: stable # Version of rust. Could be [stable, beta, nightly, 1.31, nightly-2018-08-01 ... ] 11 | 12 | # parameters from `cargo check --help` 13 | quiet: false # No output printed to stdout 14 | package: [] # Package(s) to check 15 | all: false # Check all packages in the workspace 16 | exclude: [] # Exclude packages from the check 17 | lib: false # Check only this package's library 18 | bin: [] # Check only the specified binary 19 | bins: false # Check all binaries 20 | example: [] # Check only the specified example 21 | examples: false # Check all examples 22 | test: [] # Check only the specified test target 23 | tests: false # Check all tests 24 | benche: [] # Check only the specified bench target 25 | benches: false # Check all benches 26 | all-targets: false # Check all targets 27 | release: false # Check artifacts in release mode, with optimizations 28 | profile: "" # Profile to build the selected target for 29 | features: '' # Space-separated list of features to activate 30 | all-features: false # Activate all available features 31 | no-default-features: false # Do not activate the `default` feature 32 | target: '' # Check for the target triple 33 | target-dir: '' # Directory for all generated artifacts 34 | manifest-path: '' # Path to Cargo.toml 35 | message-format: '' # Error format [default: human] [possible values: human, json, short] 36 | verbose: false # Use verbose output 37 | color: '' # Coloring: auto, always, never 38 | frozen: false # Require Cargo.lock and cache are up to date 39 | locked: false # Require Cargo.lock is up to date 40 | Z: [] # Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details 41 | 42 | jobs: 43 | - job: ${{ parameters['job_name'] }} 44 | displayName: ${{ parameters['job_displayName'] }} 45 | condition: ${{ parameters['job_condition'] }} 46 | dependsOn: ${{ parameters['job_dependsOn'] }} 47 | pool: 48 | vmImage: ubuntu-16.04 49 | variables: 50 | check_flags: '' 51 | steps: 52 | - template: ../steps/install-cross-rust.yml 53 | parameters: 54 | rustup_toolchain: ${{ parameters['rust'] }} 55 | 56 | # ########################################################################################## 57 | # Order of script modifying `check_flags` is the same as in paramters. 58 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --quiet' 59 | enabled: ${{ parameters['quiet'] }} 60 | displayName: "[cli flag modify]No output printed to stdout" 61 | 62 | - ${{ each pkg in parameters['package'] }}: 63 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --package ${{ pkg }}' 64 | displayName: "[cli flag modify]Add package to check '${{ pkg }}'" 65 | 66 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --all' 67 | enabled: ${{ parameters['all'] }} 68 | displayName: "[cli flag modify]Check all packages in the workspace" 69 | 70 | - ${{ each pkg in parameters['exclude'] }}: 71 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --exclude ${{ pkg }}' 72 | displayName: "[cli flag modify]Exclude package from check '${{ pkg }}'" 73 | 74 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --lib' 75 | enabled: ${{ parameters['lib'] }} 76 | displayName: "[cli flag modify]Check only this package's library" 77 | 78 | - ${{ each bin in parameters['bin'] }}: 79 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --bin ${{ bin }}' 80 | displayName: "[cli flag modify]Add binary '${{ bin }}' to check" 81 | 82 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --bins' 83 | enabled: ${{ parameters['bins'] }} 84 | displayName: "[cli flag modify]Check all binaries" 85 | 86 | - ${{ each exa in parameters['example'] }}: 87 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --example ${{ exa }}' 88 | displayName: "[cli flag modify]Add example '${{ exa }}' to check" 89 | 90 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --examples' 91 | enabled: ${{ parameters['examples'] }} 92 | displayName: "[cli flag modify]check all examples" 93 | 94 | - ${{ each tes in parameters['test'] }}: 95 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --test ${{ tes }}' 96 | displayName: "[cli flag modify]Add test '${{ tes }}' to check" 97 | 98 | - ${{ each ben in parameters['benche'] }}: 99 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --benche ${{ ben }}' 100 | displayName: "[cli flag modify]Add benche '${{ ben }}' to check" 101 | 102 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --benches' 103 | enabled: ${{ parameters['benches'] }} 104 | displayName: "[cli flag modify]check all benches" 105 | 106 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --release' 107 | enabled: ${{ parameters['release'] }} 108 | displayName: "[cli flag modify]Set using release mode" 109 | 110 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --profile ${{ parameters['profile'] }}" 111 | enabled: ${{ ne(parameters['profile'], '') }} 112 | displayName: "[cli flag modify]Set profile ('${{ parameters['profile'] }}') to build the selected target for" 113 | 114 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --features ${{ parameters['features'] }}" 115 | enabled: ${{ ne(parameters['features'], '') }} 116 | displayName: "[cli flag modify]Space-separated list of features to activate: ${{ parameters['features'] }}" 117 | 118 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --all-features' 119 | enabled: ${{ parameters['all-features'] }} 120 | displayName: "[cli flag modify]Activate all available features" 121 | 122 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --no-default-features' 123 | enabled: ${{ parameters['no-default-features'] }} 124 | displayName: "[cli flag modify]Do not activate the `default` feature" 125 | 126 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --target ${{ parameters['target'] }}" 127 | enabled: ${{ ne(parameters['target'], '') }} 128 | displayName: "[cli flag modify]Check for the target triple" 129 | 130 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --target-dir ${{ parameters['target-dir'] }}" 131 | enabled: ${{ ne(parameters['target-dir'], '') }} 132 | displayName: "[cli flag modify]Directory for all generated artifacts" 133 | 134 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --manifest-path ${{ parameters['manifest-path'] }}" 135 | enabled: ${{ ne(parameters['manifest-path'], '') }} 136 | displayName: "[cli flag modify]Set custom path to Cargo.toml" 137 | 138 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --message-format ${{ parameters['message-format'] }}" 139 | enabled: ${{ ne(parameters['message-format'], '') }} 140 | displayName: "[cli flag modify]Set error format to ${{ parameters['message-format'] }}" 141 | 142 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --verbose }}" 143 | enabled: ${{ parameters['verbose'] }} 144 | displayName: "[cli flag modify]use verbose output" 145 | 146 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --color ${{ parameters['color'] }}" 147 | enabled: ${{ ne(parameters['color'], '') }} 148 | displayName: "[cli flag modify]Coloring: ${{ parameters['color'] }}" 149 | 150 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --frozen }}" 151 | enabled: ${{ parameters['frozen'] }} 152 | displayName: "[cli flag modify]Require Cargo.lock and cache are up to date" 153 | 154 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --locked }}" 155 | enabled: ${{ parameters['locked'] }} 156 | displayName: "[cli flag modify]Require Cargo.lock is up to date" 157 | 158 | - ${{ each z in parameters['Z'] }}: 159 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --Z ${{ z }}' 160 | displayName: "[cli flag modify]Add Z flag ${{ z }}" 161 | # ########################################################################################## 162 | 163 | # Final run 164 | - script: cross build $(check_flags) 165 | displayName: Run Cargo check with defined flags 166 | 167 | # Custom steps: 168 | - ${{ if parameters['job_post-steps'] }}: 169 | - ${{ parameters['job_post-steps'] }} 170 | 171 | -------------------------------------------------------------------------------- /ci/jobs/cross-check.yml: -------------------------------------------------------------------------------- 1 | # Supported targets: https://github.com/rust-embedded/cross#supported-targets 2 | # Configuration https://github.com/rust-embedded/cross#configuration 3 | 4 | parameters: 5 | # azure pipelines paramters 6 | job_name: cross_check # Default job name 7 | job_displayName: Cross check # Default displayName 8 | job_dependsOn: [] # Dependencies to for the job to start 9 | job_condition: true # Job condition 10 | job_post-steps: [] # Custom steps running after job 11 | 12 | # parameters to pass to task 13 | rust: stable # Version of rust. Could be [stable, beta, nightly, 1.31, nightly-2018-08-01 ... ] 14 | 15 | # parameters from `cargo check --help` 16 | quiet: false # No output printed to stdout 17 | package: [] # Package(s) to check 18 | all: false # Check all packages in the workspace 19 | exclude: [] # Exclude packages from the check 20 | lib: false # Check only this package's library 21 | bin: [] # Check only the specified binary 22 | bins: false # Check all binaries 23 | example: [] # Check only the specified example 24 | examples: false # Check all examples 25 | test: [] # Check only the specified test target 26 | tests: false # Check all tests 27 | benche: [] # Check only the specified bench target 28 | benches: false # Check all benches 29 | all-targets: false # Check all targets 30 | release: false # Check artifacts in release mode, with optimizations 31 | profile: "" # Profile to build the selected target for 32 | features: '' # Space-separated list of features to activate 33 | all-features: false # Activate all available features 34 | no-default-features: false # Do not activate the `default` feature 35 | target: '' # Check for the target triple 36 | target-dir: '' # Directory for all generated artifacts 37 | manifest-path: '' # Path to Cargo.toml 38 | message-format: '' # Error format [default: human] [possible values: human, json, short] 39 | verbose: false # Use verbose output 40 | color: '' # Coloring: auto, always, never 41 | frozen: false # Require Cargo.lock and cache are up to date 42 | locked: false # Require Cargo.lock is up to date 43 | Z: [] # Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details 44 | 45 | 46 | jobs: 47 | - job: ${{ parameters['job_name'] }} 48 | displayName: ${{ parameters['job_displayName'] }} 49 | condition: ${{ parameters['job_condition'] }} 50 | dependsOn: ${{ parameters['job_dependsOn'] }} 51 | pool: 52 | vmImage: ubuntu-16.04 53 | variables: 54 | check_flags: '' 55 | steps: 56 | - template: ../steps/install-cross-rust.yml 57 | parameters: 58 | rustup_toolchain: ${{ parameters['rust'] }} 59 | 60 | # ########################################################################################## 61 | # Order of script modifying `check_flags` is the same as in paramters. 62 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --quiet' 63 | enabled: ${{ parameters['quiet'] }} 64 | displayName: "[cli flag modify]No output printed to stdout" 65 | 66 | - ${{ each pkg in parameters['package'] }}: 67 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --package ${{ pkg }}' 68 | displayName: "[cli flag modify]Add package to check '${{ pkg }}'" 69 | 70 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --all' 71 | enabled: ${{ parameters['all'] }} 72 | displayName: "[cli flag modify]Check all packages in the workspace" 73 | 74 | - ${{ each pkg in parameters['exclude'] }}: 75 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --exclude ${{ pkg }}' 76 | displayName: "[cli flag modify]Exclude package from check '${{ pkg }}'" 77 | 78 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --lib' 79 | enabled: ${{ parameters['lib'] }} 80 | displayName: "[cli flag modify]Check only this package's library" 81 | 82 | - ${{ each bin in parameters['bin'] }}: 83 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --bin ${{ bin }}' 84 | displayName: "[cli flag modify]Add binary '${{ bin }}' to check" 85 | 86 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --bins' 87 | enabled: ${{ parameters['bins'] }} 88 | displayName: "[cli flag modify]Check all binaries" 89 | 90 | - ${{ each exa in parameters['example'] }}: 91 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --example ${{ exa }}' 92 | displayName: "[cli flag modify]Add example '${{ exa }}' to check" 93 | 94 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --examples' 95 | enabled: ${{ parameters['examples'] }} 96 | displayName: "[cli flag modify]check all examples" 97 | 98 | - ${{ each tes in parameters['test'] }}: 99 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --test ${{ tes }}' 100 | displayName: "[cli flag modify]Add test '${{ tes }}' to check" 101 | 102 | - ${{ each ben in parameters['benche'] }}: 103 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --benche ${{ ben }}' 104 | displayName: "[cli flag modify]Add benche '${{ ben }}' to check" 105 | 106 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --benches' 107 | enabled: ${{ parameters['benches'] }} 108 | displayName: "[cli flag modify]check all benches" 109 | 110 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --release' 111 | enabled: ${{ parameters['release'] }} 112 | displayName: "[cli flag modify]Set using release mode" 113 | 114 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --profile ${{ parameters['profile'] }}" 115 | enabled: ${{ ne(parameters['profile'], '') }} 116 | displayName: "[cli flag modify]Set profile ('${{ parameters['profile'] }}') to build the selected target for" 117 | 118 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --features ${{ parameters['features'] }}" 119 | enabled: ${{ ne(parameters['features'], '') }} 120 | displayName: "[cli flag modify]Space-separated list of features to activate: ${{ parameters['features'] }}" 121 | 122 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --all-features' 123 | enabled: ${{ parameters['all-features'] }} 124 | displayName: "[cli flag modify]Activate all available features" 125 | 126 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --no-default-features' 127 | enabled: ${{ parameters['no-default-features'] }} 128 | displayName: "[cli flag modify]Do not activate the `default` feature" 129 | 130 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --target ${{ parameters['target'] }}" 131 | enabled: ${{ ne(parameters['target'], '') }} 132 | displayName: "[cli flag modify]Check for the target triple" 133 | 134 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --target-dir ${{ parameters['target-dir'] }}" 135 | enabled: ${{ ne(parameters['target-dir'], '') }} 136 | displayName: "[cli flag modify]Directory for all generated artifacts" 137 | 138 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --manifest-path ${{ parameters['manifest-path'] }}" 139 | enabled: ${{ ne(parameters['manifest-path'], '') }} 140 | displayName: "[cli flag modify]Set custom path to Cargo.toml" 141 | 142 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --message-format ${{ parameters['message-format'] }}" 143 | enabled: ${{ ne(parameters['message-format'], '') }} 144 | displayName: "[cli flag modify]Set error format to ${{ parameters['message-format'] }}" 145 | 146 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --verbose }}" 147 | enabled: ${{ parameters['verbose'] }} 148 | displayName: "[cli flag modify]use verbose output" 149 | 150 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --color ${{ parameters['color'] }}" 151 | enabled: ${{ ne(parameters['color'], '') }} 152 | displayName: "[cli flag modify]Coloring: ${{ parameters['color'] }}" 153 | 154 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --frozen }}" 155 | enabled: ${{ parameters['frozen'] }} 156 | displayName: "[cli flag modify]Require Cargo.lock and cache are up to date" 157 | 158 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --locked }}" 159 | enabled: ${{ parameters['locked'] }} 160 | displayName: "[cli flag modify]Require Cargo.lock is up to date" 161 | 162 | - ${{ each z in parameters['Z'] }}: 163 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --Z ${{ z }}' 164 | displayName: "[cli flag modify]Add Z flag ${{ z }}" 165 | # ########################################################################################## 166 | 167 | # Final run 168 | - script: cross check $(check_flags) 169 | displayName: Run cross check with defined flags 170 | 171 | # Custom steps: 172 | - ${{ if parameters['job_post-steps'] }}: 173 | - ${{ parameters['job_post-steps'] }} 174 | 175 | -------------------------------------------------------------------------------- /ci/jobs/cross-test.yml: -------------------------------------------------------------------------------- 1 | # Supported targets: https://github.com/rust-embedded/cross#supported-targets 2 | # Configuration https://github.com/rust-embedded/cross#configuration 3 | 4 | parameters: 5 | # azure pipelines paramters 6 | job_name: cross_test # Default job name 7 | job_displayName: Cross test # Default displayName 8 | job_dependsOn: [] # Dependencies to for the job to start 9 | job_condition: true # Job condition 10 | job_post-steps: [] # Custom steps running after job 11 | 12 | # parameters to pass to task 13 | rust: stable # Version of rust. Could be [stable, beta, nightly, 1.31, nightly-2018-08-01 ... ] 14 | 15 | # parameters from `cargo check --help` 16 | quiet: false # No output printed to stdout 17 | package: [] # Package(s) to check 18 | all: false # Check all packages in the workspace 19 | exclude: [] # Exclude packages from the check 20 | lib: false # Check only this package's library 21 | bin: [] # Check only the specified binary 22 | bins: false # Check all binaries 23 | example: [] # Check only the specified example 24 | examples: false # Check all examples 25 | test: [] # Check only the specified test target 26 | tests: false # Check all tests 27 | benche: [] # Check only the specified bench target 28 | benches: false # Check all benches 29 | all-targets: false # Check all targets 30 | release: false # Check artifacts in release mode, with optimizations 31 | profile: "" # Profile to build the selected target for 32 | features: '' # Space-separated list of features to activate 33 | all-features: false # Activate all available features 34 | no-default-features: false # Do not activate the `default` feature 35 | target: '' # Check for the target triple 36 | target-dir: '' # Directory for all generated artifacts 37 | manifest-path: '' # Path to Cargo.toml 38 | message-format: '' # Error format [default: human] [possible values: human, json, short] 39 | verbose: false # Use verbose output 40 | color: '' # Coloring: auto, always, never 41 | frozen: false # Require Cargo.lock and cache are up to date 42 | locked: false # Require Cargo.lock is up to date 43 | Z: [] # Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details 44 | 45 | 46 | jobs: 47 | - job: ${{ parameters['job_name'] }} 48 | displayName: ${{ parameters['job_displayName'] }} 49 | condition: ${{ parameters['job_condition'] }} 50 | dependsOn: ${{ parameters['job_dependsOn'] }} 51 | pool: 52 | vmImage: ubuntu-16.04 53 | variables: 54 | check_flags: '' 55 | steps: 56 | - template: ../steps/install-cross-rust.yml 57 | parameters: 58 | rustup_toolchain: ${{ parameters['rust'] }} 59 | 60 | # ########################################################################################## 61 | # Order of script modifying `check_flags` is the same as in paramters. 62 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --quiet' 63 | enabled: ${{ parameters['quiet'] }} 64 | displayName: "[cli flag modify]No output printed to stdout" 65 | 66 | - ${{ each pkg in parameters['package'] }}: 67 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --package ${{ pkg }}' 68 | displayName: "[cli flag modify]Add package to check '${{ pkg }}'" 69 | 70 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --all' 71 | enabled: ${{ parameters['all'] }} 72 | displayName: "[cli flag modify]Check all packages in the workspace" 73 | 74 | - ${{ each pkg in parameters['exclude'] }}: 75 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --exclude ${{ pkg }}' 76 | displayName: "[cli flag modify]Exclude package from check '${{ pkg }}'" 77 | 78 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --lib' 79 | enabled: ${{ parameters['lib'] }} 80 | displayName: "[cli flag modify]Check only this package's library" 81 | 82 | - ${{ each bin in parameters['bin'] }}: 83 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --bin ${{ bin }}' 84 | displayName: "[cli flag modify]Add binary '${{ bin }}' to check" 85 | 86 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --bins' 87 | enabled: ${{ parameters['bins'] }} 88 | displayName: "[cli flag modify]Check all binaries" 89 | 90 | - ${{ each exa in parameters['example'] }}: 91 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --example ${{ exa }}' 92 | displayName: "[cli flag modify]Add example '${{ exa }}' to check" 93 | 94 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --examples' 95 | enabled: ${{ parameters['examples'] }} 96 | displayName: "[cli flag modify]check all examples" 97 | 98 | - ${{ each tes in parameters['test'] }}: 99 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --test ${{ tes }}' 100 | displayName: "[cli flag modify]Add test '${{ tes }}' to check" 101 | 102 | - ${{ each ben in parameters['benche'] }}: 103 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --benche ${{ ben }}' 104 | displayName: "[cli flag modify]Add benche '${{ ben }}' to check" 105 | 106 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --benches' 107 | enabled: ${{ parameters['benches'] }} 108 | displayName: "[cli flag modify]check all benches" 109 | 110 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --release' 111 | enabled: ${{ parameters['release'] }} 112 | displayName: "[cli flag modify]Set using release mode" 113 | 114 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --profile ${{ parameters['profile'] }}" 115 | enabled: ${{ ne(parameters['profile'], '') }} 116 | displayName: "[cli flag modify]Set profile ('${{ parameters['profile'] }}') to build the selected target for" 117 | 118 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --features ${{ parameters['features'] }}" 119 | enabled: ${{ ne(parameters['features'], '') }} 120 | displayName: "[cli flag modify]Space-separated list of features to activate: ${{ parameters['features'] }}" 121 | 122 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --all-features' 123 | enabled: ${{ parameters['all-features'] }} 124 | displayName: "[cli flag modify]Activate all available features" 125 | 126 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --no-default-features' 127 | enabled: ${{ parameters['no-default-features'] }} 128 | displayName: "[cli flag modify]Do not activate the `default` feature" 129 | 130 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --target ${{ parameters['target'] }}" 131 | enabled: ${{ ne(parameters['target'], '') }} 132 | displayName: "[cli flag modify]Check for the target triple" 133 | 134 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --target-dir ${{ parameters['target-dir'] }}" 135 | enabled: ${{ ne(parameters['target-dir'], '') }} 136 | displayName: "[cli flag modify]Directory for all generated artifacts" 137 | 138 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --manifest-path ${{ parameters['manifest-path'] }}" 139 | enabled: ${{ ne(parameters['manifest-path'], '') }} 140 | displayName: "[cli flag modify]Set custom path to Cargo.toml" 141 | 142 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --message-format ${{ parameters['message-format'] }}" 143 | enabled: ${{ ne(parameters['message-format'], '') }} 144 | displayName: "[cli flag modify]Set error format to ${{ parameters['message-format'] }}" 145 | 146 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --verbose }}" 147 | enabled: ${{ parameters['verbose'] }} 148 | displayName: "[cli flag modify]use verbose output" 149 | 150 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --color ${{ parameters['color'] }}" 151 | enabled: ${{ ne(parameters['color'], '') }} 152 | displayName: "[cli flag modify]Coloring: ${{ parameters['color'] }}" 153 | 154 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --frozen }}" 155 | enabled: ${{ parameters['frozen'] }} 156 | displayName: "[cli flag modify]Require Cargo.lock and cache are up to date" 157 | 158 | - script: echo "##vso[task.setvariable variable=check_flags]$(check_flags) --locked }}" 159 | enabled: ${{ parameters['locked'] }} 160 | displayName: "[cli flag modify]Require Cargo.lock is up to date" 161 | 162 | - ${{ each z in parameters['Z'] }}: 163 | - script: echo '##vso[task.setvariable variable=check_flags]$(check_flags) --Z ${{ z }}' 164 | displayName: "[cli flag modify]Add Z flag ${{ z }}" 165 | # ########################################################################################## 166 | 167 | # Final run 168 | - script: cross test $(check_flags) 169 | displayName: Run cross check with defined flags 170 | 171 | # Custom steps: 172 | - ${{ if parameters['job_post-steps'] }}: 173 | - ${{ parameters['job_post-steps'] }} 174 | 175 | -------------------------------------------------------------------------------- /ci/jobs/rustfmt.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | # azure pipelines paramters 3 | job_name: rustfmt # Default job name 4 | job_displayName: Check formatting # Default displayName 5 | job_dependsOn: [] # Dependencies to for the job to start 6 | job_condition: true # Job condition 7 | job_continueOnError: false 8 | job_post-steps: [] # Custom steps running after job 9 | 10 | # global parameters 11 | rust: stable # Version of rust. Could be [stable, beta, nightly, 1.31, nightly-2018-08-01 ... ] 12 | 13 | # parameters from `cargo fmt --help` 14 | all: true # format all packages (only usable in workspaces) 15 | 16 | # parameters from `rustfmt --help` 17 | check: true # Run in 'check' mode. Exits with 0 if input is 18 | # formatted correctly. Exits with 1 and prints a diff if 19 | # formatting is required. 20 | emit: '' # [files|stdout] What data to emit and how 21 | backup: false # Backup any modified files. 22 | config-path: '' # [Path for the configuration file] 23 | # Recursively searches the given path for the 24 | # rustfmt.toml config file. If not found reverts to the 25 | # input file path 26 | edition: '' # [2015|2018] 27 | # Rust edition to use 28 | color: '' # [always|never|auto] 29 | # Use colored output (if supported) 30 | print-config: '' # [minimal|default] PATH 31 | # Dumps a default or minimal config to PATH. A minimal 32 | # config is the subset of the current config file used 33 | # for formatting the current program. 34 | 35 | jobs: 36 | - job: ${{ parameters['job_name'] }} 37 | displayName: ${{ parameters['job_displayName'] }} 38 | condition: ${{ parameters['job_condition'] }} 39 | continueOnError: ${{ parameters['job_continueOnError'] }} 40 | dependsOn: ${{ parameters['job_dependsOn'] }} 41 | pool: 42 | vmImage: ubuntu-16.04 43 | variables: 44 | fmt_flags: '' 45 | rustfmt_flags: '' 46 | steps: 47 | - template: ../steps/install-rust.yml 48 | parameters: 49 | rust_toolchain: ${{ parameters.rust }} 50 | components: 51 | - rustfmt 52 | 53 | - script: echo "##vso[task.setvariable variable=fmt_flags]$(fmt_flags) --all" 54 | enabled: ${{ parameters['all'] }} 55 | displayName: "format all packages (only usable in workspaces)" 56 | 57 | - script: echo "##vso[task.setvariable variable=rustfmt_flags]$(rustfmt_flags) --check" 58 | enabled: ${{ parameters['check'] }} 59 | displayName: "Run in 'check' mode." 60 | 61 | - script: echo "##vso[task.setvariable variable=rustfmt_flags]$(rustfmt_flags) --emit ${{ parameters['emit'] }}" 62 | enabled: ${{ ne(parameters['emit'], '') }} 63 | displayName: "Set what data to emit and how to ${{ parameters['emit'] }}" 64 | 65 | - script: echo "##vso[task.setvariable variable=rustfmt_flags]$(rustfmt_flags) --backup" 66 | enabled: ${{ parameters['backup'] }} 67 | displayName: "Backup any modified files." 68 | 69 | - script: echo "##vso[task.setvariable variable=rustfmt_flags]$(rustfmt_flags) --config-path ${{ parameters['config-path'] }}" 70 | enabled: ${{ ne(parameters['config-path'], '') }} 71 | displayName: "Path for the configuration file (rustfmt.toml) ${{ parameters['config-path'] }}" 72 | 73 | - script: echo "##vso[task.setvariable variable=rustfmt_flags]$(rustfmt_flags) --edition ${{ parameters['edition'] }}" 74 | enabled: ${{ ne(parameters['edition'], '') }} 75 | displayName: "Set rust edition to: ${{ parameters['edition'] }}" 76 | 77 | - script: echo "##vso[task.setvariable variable=rustfmt_flags]$(rustfmt_flags) --color ${{ parameters['color'] }}" 78 | enabled: ${{ ne(parameters['color'], '') }} 79 | displayName: "Use colored output ${{ parameters['color'] }}" 80 | 81 | - script: echo "##vso[task.setvariable variable=rustfmt_flags]$(rustfmt_flags) --print-config ${{ parameters['print-config'] }}" 82 | enabled: ${{ ne(parameters['print-config'], '') }} 83 | displayName: "Dump config: ${{ parameters['color'] }}" 84 | 85 | - script: | 86 | cargo fmt $(fmt_flags) -- $(rustfmt_flags) 87 | displayName: Check formatting 88 | 89 | # Custom steps: 90 | - ${{ if parameters['job_post-steps'] }}: 91 | - ${{ parameters['job_post-steps'] }} 92 | 93 | -------------------------------------------------------------------------------- /ci/scenarios/builds.yml: -------------------------------------------------------------------------------- 1 | # This template helps build cross binarries 2 | # All targets contains world windows are build on windows agent 3 | # linux are build on ubunut agnet 4 | # apple are build on mac OS agent 5 | 6 | parameters: 7 | # global parameters 8 | rust: stable # Version of rust. Could be [stable, beta, nightly, 1.31, nightly-2018-08-01 ... ] 9 | 10 | release: true # build with release flag 11 | artifactName: target 12 | builds: 13 | - target: x86_64-unknown-linux-gnu 14 | name: x86_64_unknown_linux_gnu 15 | pre-steps: [] # pre steps. You can install here for example linker. Be aware that depends on architecture and agent is switching for diffrent target. 16 | - target: x86_64-apple-darwin 17 | name: x86_64_apple_darwin 18 | pre-steps: [] 19 | - target: x86_64-pc-windows-msvc 20 | name: x86_64_pc_windows_msvc 21 | pre-steps: [] 22 | 23 | jobs: 24 | - ${{ each build in parameters['builds'] }}: 25 | - ${{ if contains(build.target, 'linux') }}: 26 | - template: ../jobs/cargo-build.yml 27 | parameters: 28 | rust: ${{ parameters['rust'] }} 29 | job_name: ${{ build.name }} 30 | job_displayName: "target ${{ build.target }}" 31 | job_pool: 32 | vmImage: ubuntu-16.04 33 | release: ${{ parameters['release'] }} 34 | target: "${{ build.target }}" 35 | job_pre-steps: ${{ build['pre-steps'] }} 36 | job_post-steps: 37 | - bash: | 38 | REPO_BASE_NAME="$(basename $(Build.Repository.Name))" 39 | echo "##vso[task.setvariable variable=repo_base_name]$REPO_BASE_NAME" 40 | - template: ../steps/artifacts.yml 41 | parameters: 42 | archiveName: "$(REPO_BASE_NAME) - ${{ build.target }}" 43 | artifactName: ${{ parameters['artifactName'] }} 44 | 45 | - ${{ if contains(build.target, 'apple') }}: 46 | - template: ../jobs/cargo-build.yml 47 | parameters: 48 | rust: ${{ parameters['rust'] }} 49 | job_name: ${{ build.name }} 50 | job_displayName: "target ${{ build.target }}" 51 | job_pool: 52 | vmImage: macOS-10.15 53 | release: ${{ parameters['release'] }} 54 | target: "${{ build.target }}" 55 | job_pre-steps: ${{ build['pre-steps'] }} 56 | job_post-steps: 57 | - bash: | 58 | REPO_BASE_NAME="$(basename $(Build.Repository.Name))" 59 | echo "##vso[task.setvariable variable=repo_base_name]$REPO_BASE_NAME" 60 | - template: ../steps/artifacts.yml 61 | parameters: 62 | archiveName: "$(REPO_BASE_NAME) - ${{ build.target }}" 63 | artifactName: ${{ parameters['artifactName'] }} 64 | 65 | - ${{ if contains(build.target, 'windows') }}: 66 | - template: ../jobs/cargo-build.yml 67 | parameters: 68 | rust: ${{ parameters['rust'] }} 69 | job_name: ${{ build.name }} 70 | job_displayName: "target ${{ build.target }}" 71 | job_pool: 72 | vmImage: vs2017-win2016 73 | release: ${{ parameters['release'] }} 74 | target: "${{ build.target }}" 75 | job_pre-steps: ${{ build['pre-steps'] }} 76 | job_post-steps: 77 | - bash: | 78 | REPO_BASE_NAME="$(basename $(Build.Repository.Name))" 79 | echo "##vso[task.setvariable variable=repo_base_name]$REPO_BASE_NAME" 80 | - template: ../steps/artifacts.yml 81 | parameters: 82 | archiveName: "$(REPO_BASE_NAME) - ${{ build.target }}" 83 | artifactName: ${{ parameters['artifactName'] }} 84 | -------------------------------------------------------------------------------- /ci/scenarios/check.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | cargo-clippy: true 3 | cargo-check: true 4 | cargo-check-nightly: true 5 | rustfmt: true 6 | 7 | jobs: 8 | - template: ../jobs/cargo-check.yml 9 | parameters: 10 | job_name: check_stable 11 | job_condition: ${{ parameters['cargo-check'] }} 12 | job_displayName: Cargo check (stable) 13 | all: true 14 | benches: true 15 | 16 | - template: ../jobs/cargo-check.yml 17 | parameters: 18 | # all azure job parameters start with `job_` prefix 19 | job_name: check_nightly 20 | job_condition: ${{ parameters['cargo-check-nightly'] }} 21 | job_displayName: Cargo check (nightly) 22 | job_continueOnError: true 23 | 24 | rust: nightly 25 | all: true 26 | benches: true 27 | 28 | # Check formating 29 | - template: ../jobs/rustfmt.yml 30 | parameters: 31 | job_condition: ${{ parameters['rustfmt'] }} 32 | job_continueOnError: true 33 | 34 | # Clippy 35 | - template: ../jobs/cargo-clippy.yml 36 | parameters: 37 | job_condition: ${{ parameters['cargo-clippy'] }} 38 | job_continueOnError: true 39 | all: true 40 | deny: 41 | - warnings 42 | 43 | -------------------------------------------------------------------------------- /ci/scenarios/embeeded.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | checks: [] 3 | tests: [] 4 | 5 | # Cross check 6 | # List of supported targets is available here: https://github.com/rust-embedded/cross#supported-targets 7 | jobs: 8 | - ${{ each check in parameters['checks'] }}: 9 | - template: ../jobs/cross-check.yml 10 | parameters: 11 | job_name: cargo_check_${{ check.name }} 12 | job_displayName: Check target ${{ check.target }} (cross) 13 | target: ${{ check.target }} 14 | 15 | # Cross test 16 | # List of supported targets is available here: https://github.com/rust-embedded/cross#supported-targets 17 | - ${{ each test in parameters['tests'] }}: 18 | - template: ../jobs/cross-test.yml 19 | parameters: 20 | job_name: cargo_test_${{ test.name }} 21 | job_displayName: Test target ${{ test.target }} (cross) 22 | target: ${{ test.target }} 23 | -------------------------------------------------------------------------------- /ci/scenarios/github/deploy-doc.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | # azure pipelines paramters 3 | job_name: github_deploy_doc # Default job name 4 | job_displayName: Deply doc to Github # Default displayName 5 | job_dependsOn: [] # Dependencies to for the job to start 6 | job_condition: 'null' # Job condition 7 | job_post-steps: [] # Custom steps running after job 8 | 9 | branch: master # Branch on witch documentaion is generated. 10 | github: 11 | user: OverwriteItWithYouGithubUsername 12 | repo: OverwriteWithYouGithubRepository 13 | email: OverwriteWithYourGithubEmail 14 | 15 | jobs: 16 | - template: ../../jobs/cargo-doc.yml 17 | parameters: 18 | job_name: ${{ parameters['job_name'] }} 19 | job_displayName: ${{ parameters['job_displayName'] }} 20 | job_dependsOn: ${{ parameters['job_dependsOn'] }} 21 | ${{ if eq(parameters['job_condition'], 'null') }}: 22 | job_condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/${{ parameters.branch }}')) 23 | ${{ if ne(parameters['job_condition'], 'null') }}: 24 | job_condition: ${{ parameters['job_condition'] }} 25 | 26 | all: true 27 | no-deps: true 28 | 29 | job_post-steps: 30 | - script: | 31 | cp -R target/doc '$(Build.BinariesDirectory)' 32 | displayName: Copy generated documentaion to build directory 33 | 34 | - script: | 35 | set -e 36 | git --version 37 | ls -la 38 | git init 39 | git config user.name 'Deployment Bot (from Azure Pipelines)' 40 | git config user.email '${{ parameters.github.email }}' 41 | git config --global credential.helper 'store --file ~/.my-credentials' 42 | printf "protocol=https\nhost=github.com\nusername=$USER\npassword=%s\n\n" "$GITHUB_TOKEN" | git credential-store --file ~/.my-credentials store 43 | git remote add origin ${{ parameters.github.repo }} 44 | git checkout -b gh-pages 45 | git add . 46 | git commit -m 'Deploy API documentation' 47 | git push -f origin gh-pages 48 | env: 49 | GITHUB_TOKEN: $(DocPublishToken) 50 | USER: ${{ parameters.github.user }} 51 | workingDirectory: '$(Build.BinariesDirectory)' 52 | displayName: 'Deploy Documentation' 53 | 54 | - ${{ if parameters['job_post-steps'] }}: 55 | - ${{ parameters['job_post-steps'] }} 56 | 57 | 58 | -------------------------------------------------------------------------------- /ci/scenarios/github/release.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | gitHubConnection: "" # Enter the service connection name for your GitHub connection. More: https://aka.ms/AA3am5s 3 | 4 | job_condition: false # Default is false since gitHubConnection need to be set manually. Example: `and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))` 5 | job_displayName: Deploy asserts to github 6 | job_name: github_deploy 7 | 8 | artifactName: target 9 | assetUploadMode: replace 10 | action: edit 11 | isPreRelease: true 12 | repositoryName: '$(Build.Repository.Name)' 13 | 14 | jobs: 15 | - job: ${{ parameters['job_name'] }} 16 | displayName: ${{ parameters['job_displayName'] }} 17 | condition: ${{ parameters['job_condition'] }} 18 | steps: 19 | - task: DownloadPipelineArtifact@2 20 | inputs: 21 | artifactName: ${{ parameters['artifactName'] }} 22 | targetPath: "$(Pipeline.Workspace)/${{parameters['artifactName']}}" 23 | - bash: | 24 | MY_TAG="$(Build.SourceBranch)" 25 | MY_TAG=${MY_TAG#refs/tags/} 26 | echo $MY_TAG 27 | echo "##vso[task.setvariable variable=build.my_tag]$MY_TAG" 28 | DATE="$(date +%Y-%m-%d)" 29 | echo "##vso[task.setvariable variable=build.date]$DATE" 30 | displayName: "Create date and tag variables" 31 | 32 | - task: GitHubRelease@0 33 | displayName: "GithubRelease@0 '$(build.my_tag) - $(build.date)'" 34 | inputs: 35 | gitHubConnection: ${{ parameters['githubConnection'] }} 36 | tagSource: manual 37 | title: '$(build.my_tag) - $(build.date)' 38 | tag: '$(build.my_tag)' 39 | assetUploadMode: ${{ parameters['assetUploadMode'] }} 40 | action: ${{ parameters['action'] }} 41 | assets: "$(Pipeline.Workspace)/${{parameters['artifactName']}}/*" # target is the same what artifactName in download step 42 | repositoryName: ${{ parameters['repositoryName'] }} 43 | isPreRelease: ${{ parameters['isPreRelease'] }} 44 | 45 | -------------------------------------------------------------------------------- /ci/scenarios/test.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | min_rust_supported: 1.31.1 # First version of Rust 2018 edition 3 | 4 | jobs: 5 | # Cargo test min rust version 6 | - template: ../jobs/cargo-test.yaml 7 | parameters: 8 | job_name: cargo_test_min_ver 9 | job_displayName: Test min supported version 10 | test-flags: 11 | nocapture: true 12 | rust: ${{ parameters['min_rust_supported'] }} 13 | 14 | # Cargo test last stable version of rust 15 | - template: ../jobs/cargo-test.yaml 16 | parameters: 17 | test-flags: 18 | nocapture: true 19 | 20 | - template: ../jobs/cargo-test.yaml 21 | parameters: 22 | rust: nightly 23 | job_name: cargo_test_nightly 24 | job_displayName: Cargo test (nightly) 25 | job_continueOnError: true 26 | test-flags: 27 | nocapture: true 28 | -------------------------------------------------------------------------------- /ci/steps/artifacts.yml: -------------------------------------------------------------------------------- 1 | # This step help publish targets folder 2 | parameters: 3 | contents: | 4 | ** 5 | !**/.fingerprint/** 6 | !**/deps/** 7 | !**/*.rlib 8 | !**/*.d 9 | !**/.* 10 | !.* 11 | sourceFolder: "$(Build.SourcesDirectory)/target/" 12 | artifactName: target 13 | archiveName: "$(Build.Repository.Name)" 14 | archiveType: zip 15 | 16 | steps: 17 | - task: CopyFiles@2 18 | displayName: "Copy files to $(Build.BinariesDirectory)" 19 | inputs: 20 | sourceFolder: ${{ parameters['sourceFolder'] }} 21 | contents: ${{ parameters['contents'] }} 22 | targetFolder: "$(Build.BinariesDirectory)" 23 | - ${{ if parameters.archiveType }}: 24 | - task: ArchiveFiles@2 25 | displayName: Archive files 26 | inputs: 27 | rootFolderOrFile: "$(Build.BinariesDirectory)" 28 | archiveType: ${{ parameters['archiveType'] }} 29 | tarCompression: none 30 | archiveFile: "$(Build.ArtifactStagingDirectory)/${{ parameters['archiveName'] }}.zip" 31 | - task: PublishBuildArtifacts@1 32 | displayName: "Publish: $(Build.ArtifactStagingDirectory)" 33 | inputs: 34 | artifactName: ${{ parameters['artifactName'] }} 35 | 36 | -------------------------------------------------------------------------------- /ci/steps/install-cross-rust.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | rust_toolchain: stable 3 | 4 | steps: 5 | - template: install-rust.yml 6 | parameters: 7 | rust_toolchain: ${{ parameters.rust_toolchain }} 8 | steps: 9 | - script: | 10 | cargo install --git https://github.com/rust-embedded/cross --rev 13500f7b4d6af0fccbbdcf016d92c86b6a336736 11 | displayName: Instaling cross support 12 | -------------------------------------------------------------------------------- /ci/steps/install-rust.yml: -------------------------------------------------------------------------------- 1 | # defaults for any parameters that aren't specified 2 | parameters: 3 | rustup_toolchain: stable # Could be [stable, beta, nightly, 1.31, nightly-2018-08-01 ... ] 4 | components: [] # Rust commponents to be installed 5 | targets: [] # Rust targets to be installed 6 | steps: [] # Custom steps 7 | 8 | steps: 9 | # Linux and macOS. 10 | - script: | 11 | set -e 12 | curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN 13 | echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" 14 | env: 15 | RUSTUP_TOOLCHAIN: ${{parameters.rustup_toolchain}} 16 | displayName: "Install rust (*nix)" 17 | condition: not(eq(variables['Agent.OS'], 'Windows_NT')) 18 | 19 | # Windows. 20 | - script: | 21 | curl -sSf -o rustup-init.exe https://win.rustup.rs 22 | rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN% --default-host x86_64-pc-windows-msvc 23 | set PATH=%PATH%;%USERPROFILE%\.cargo\bin 24 | echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin" 25 | env: 26 | RUSTUP_TOOLCHAIN: ${{parameters.rustup_toolchain}} 27 | displayName: "Install rust (windows)" 28 | condition: eq(variables['Agent.OS'], 'Windows_NT') 29 | 30 | # Install additional components: 31 | - ${{ each component in parameters.components }}: 32 | - script: rustup component add ${{ component }} 33 | displayName: "Adding commponent ${{ component }}" 34 | 35 | # Install additional targets: 36 | - ${{ each target in parameters.targets }}: 37 | - script: rustup target add ${{ target }} 38 | displayName: "Adding target '${{ target }}'" 39 | 40 | # Set correct rustup_toolchain 41 | - bash: | 42 | rustup default $RUSTUP_TOOLCHAIN 43 | rustup update $RUSTUP_TOOLCHAIN 44 | env: 45 | RUSTUP_TOOLCHAIN: ${{parameters.rustup_toolchain}} 46 | displayName: "Set correct Rust version" 47 | 48 | - ${{ parameters.steps }} 49 | 50 | # All platforms. 51 | - script: | 52 | set -e 53 | echo "Rust up version" 54 | rustup -V 55 | echo "rustup installed commponents list" 56 | rustup component list --installed 57 | echo "rustup show:" 58 | rustup show 59 | echo "rustc -Vv" 60 | rustc -Vv 61 | echo "cargo -V" 62 | cargo -V 63 | displayName: Query rustup, rust and cargo versions 64 | -------------------------------------------------------------------------------- /img/doc_deploy1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xoac/rust-azure-pipelines/784c1a058f4ecdd675cf1460f80ad636f23e8510/img/doc_deploy1.png -------------------------------------------------------------------------------- /img/doc_deploy2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xoac/rust-azure-pipelines/784c1a058f4ecdd675cf1460f80ad636f23e8510/img/doc_deploy2.png -------------------------------------------------------------------------------- /img/doc_deploy3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xoac/rust-azure-pipelines/784c1a058f4ecdd675cf1460f80ad636f23e8510/img/doc_deploy3.png -------------------------------------------------------------------------------- /img/service_connection_pipelines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xoac/rust-azure-pipelines/784c1a058f4ecdd675cf1460f80ad636f23e8510/img/service_connection_pipelines.png -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | //! This is just an example project to test templates for azure-pipelines. 2 | //! Repository can be found here: https://github.com/xoac/rust-azure-pipelines 3 | 4 | #[cfg(test)] 5 | mod tests { 6 | 7 | #[test] 8 | fn simple_test() { 9 | assert_eq!(2 + 2, 4); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!("Hello, world!"); 3 | } 4 | --------------------------------------------------------------------------------