Collection of azure pipelines templates for rust
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 if you still looking for Azure Pipelines for rust crates-ci/azure-pipelines should be a correct place.
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:
If you just started using azure pipelines you can copy paste into azure-pipelines.yml
. Check and test should be good default one
This is the default and should be sufficiently. How to create endpoint?
trigger:
branches:
include: ['*']
tags:
include: ['*']
resources:
repositories:
- repository: rust_pipelines
type: github
name: xoac/rust-azure-pipelines
ref: refs/tags/v0.1.0
endpoint: PipelinesTemplates # TODO YOU NEED TO CHANGE THIS!
stages:
- stage: check
displayName: "Quick checks"
jobs:
- template: ci/scenarios/check.yml@rust_pipelines
- stage: test
displayName: "Multi OS native tests"
jobs:
- template: ci/scenarios/test.yml@rust_pipelines
parameters:
min_rust_supported: 1.31 # Use first rust version you wanna support
You are done! Everything else is optional!
Check supported targets. Supported targets
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.
# This stage allow to easy test your crate using cross project.
# Supported targets: https://github.com/rust-embedded/cross#supported-targets
- stage: embedded
displayName: "Cross check and tests"
dependsOn:
- check
jobs:
- template: ci/scenarios/embeeded.yml@rust_pipelines
parameters:
checks:
- target: mips-unknown-linux-musl
name: cross_chcek_i686_unknown_freebsd
- target: aarch64-unknown-linux-gnu
name: cross_check_aarch64_unknown_linux_gnu
tests:
- target: i686-unknown-linux-gnu
name: cross_test_i686_unknown_linux_gnu
# This stage build binaries - you can deploy them in next stage
- stage: build
displayName: "Builds"
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
dependsOn:
- test
# Deploy binaries to github only if tags start with `v` for example `v0.1.5`
- stage: deploy
displayName: "Deploys"
dependsOn:
- build
jobs:
- template: ci/scenarios/github/release.yml@rust_pipelines
parameters:
job_condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
gitHubConnection: PipelinesTemplates # CHANGED THIS TO YOUR OWN VALUE
If you already have azure-piplines.yml
file add this to be able using templates:
resources:
repositories:
- repository: rust_pipelines
type: github
name: xoac/rust-azure-pipelines
# ref: refs/heads/master ## TODO you may want to change it to refs/tags/TAG_NAME.
ref: refs/tags/v0.1.0
endpoint: YOU_NEED_TO_SET_THIS
More about templates resources
And now you can use it like this:
jobs:
- template: ci/jobs/cargo-check.yml@rust_pipelines
Available items:
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
You can see ci/scenarios
to get know how to use jobs.
The ci
is split into:
Most of pepole know how to use cargo
. If you know you know also how to use this CI templates!
For example you wann use this:
cargo build --release --examples --target-dir "myTargetDir"
So you just need:
jobs:
- template: ci/jobs/cargo-build.yml@rust_pipelines
parameters:
release: true
examples: true
target-dir: "myTargetDir"
How to check for more parameters? You can use just --help
flag in cargo or see parameters in cargo-build.yml
cargo build --help
azure-pipelines.yml
in your reposiotryThis is useful if u want to have a separate documentation for master branch.
repo
, user
, admin:repo_hook
.)gh-pages
and us it as repo page. Here you find how to do it
DocPublishToken
with value of your PAT(Personal Access Token). Don't forget to mark it as secret.Example master doc generated for this example create. master doc for this hello word app