Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

asottile-archive/azure-pipeline-templates

Repository files navigation

DEPRECATED

I moved my stuff to github actions using https://github.com/asottile/workflows


Build Status pre-commit.ci status

azure-pipeline-templates

usage

First configure a github service connection

It is suggested to use a generic name, such as github so forks can also configure the same.

You can find this in Project Settings => Service connections in the Azure Devops dashboard for your project. Project settings is located in the bottom left corner of the UI as of 2019-03-07.

Below I'm using the endpoint name github

Next add this to the beginning of your azure-pipelines.yml

resources:
  repositories:
    - repository: asottile
      type: github
      endpoint: github
      name: asottile/azure-pipeline-templates
      ref: refs/tags/v2.5.2

this will make the templates in this repository available in the asottile namespace.

job templates

job--python-tox.yml

new in v0.0.1

This job template will install python and invoke tox.

parameters

  • toxenvs: the list of tox environment names to run
  • os: choices (linux, windows, osx)
  • architectures: new in v2.0.0 list with choices (x64, x86), default [x64] (only affects windows)
  • coverage: new in v0.0.7 after the run publish coverage to azure pipelines, default true
  • wheel_tags: new in v0.0.10 after a run of a tag, build a wheel and publish it as an artifact, default false. the artifacts can be downloaded using the bin/download-wheels script included in this repository.
  • additional_variables: new in v0.0.13 additional pipeline variables
  • pre_test: new in v0.0.5 steps to run before running tox, such as installing tools, etc. default: []
  • name_postfix: new in v0.0.5 string to be appended to job name if you need to make it unique, default: ''

The tox environments must either:

  • be equal to: py37, py38, py39, py310, py311, py312, pypy3
  • start with: py37-, py38-, py39-, py310-, py311-, py312-, pypy3-

for now, python3.12 is only available on linux -- it is installed from deadsnakes

coverage information can be displayed using a shields.io badge

example

- template: job--python-tox.yml@asottile
  parameters:
    toxenvs: [py27, py37]
    os: windows

job--pre-commit.yml

new in v0.0.2

This job template will invoke pre-commit against all files.

parameters

  • ruby: the version of ruby to install to the system (used by some hooks), defaults to '>= 2.4'
  • python: the python version to run pre-commit with, defaults to '3.7'

example

- template: job--pre-commit.yml@asottile

job--go-test.yml

new in v0.0.6

This job checks out a go project, runs go get and then go test

parameters

  • go_versions: list of go versions to test against
  • os: choices (linux, windows, macos)
  • tests: what to go test ..., default ./...
  • pre_test: steps to run before running tox, such as installing tools, etc. default: []
  • name_postfix: string to be appended to job name if you need to make it unique, default: ''

example

- template: job--go-test.yml@asottile
  parameters:
    go_versions: ['1.11.5', '1.12']
    os: 'linux'

step templates

When referring to a step template as part of pre_test, omit the @asottile repository selector (as the template is included after job templating).

step--git-install.yml

new in v0.0.8

This step template will install git from source and put it on the PATH. This step is currently only supported on linux.

parameters

  • versions: ref to install at, default HEAD

example

  - template: step--install-git.yml