Giter VIP home page Giter VIP logo

azure-pipelines-templates's Introduction

azure-pipelines-templates

Azure Pipelines templates for my repos.

Note: for my personal use only. I do not guarantee any stability around here. In other words: please don't use this.

Setup

First, add a service connection named github:

Project settings
  > Service connections
    > New service connection
      > GitHub

Add this at the beginning of azure-pipelines.yml:

resources:
  repositories:
    - repository: templates
      type: github
      endpoint: github
      name: florimondmanca/azure-pipelines-templates
      ref: refs/tags/6.0

Then reference templates as <template>.yml@templates.

Jobs

job--python-test.yml

Expected scripts: make install-python, make test.

Parameters:

  • jobs - Mapping
    • Key: a job name. The Python version is inferred from the start, eg py311_pg -> Python 3.11.
    • Value: job configuration. Accepts os, services, variables, coverage.
  • before_steps : a list of steps to run before running step--python-test.yml.

Example:

jobs:
  - template: job--python-test.yml@templates
    parameters:
      jobs:
        # Minimal definition:
        py311: null

        # Complete definition:
        py311_dj30_windows_pg:
          coverage: true
          os: windows
          services:
            postgres: pg11
          variables:
            DJANGO_VERSION: "3.0"

job--python-check.yml

Expected scripts: make install-python, make check.

Example:

jobs:
  - template: job--python-check.yml@templates
    parameters:
      pythonVersion: "3.11"

job--python-docs-build.yml

Build docs under a Python environment.

Expected scripts: make install-python, make docs.

Example:

jobs:
  - template: job--python-docs-build.yml@templates
    parameters:
      pythonVersion: "3.11"

job--python-publish.yml

Publish a Python package to PyPI.

Assumptions

  • make install-python, make build, make publish must exist.
  • twine and wheel must be installed.
  • token refers to a PyPI API token set via a Python upload service connection (Project settings > Service connection > New... > Python package upload). It may be provided through a variable group (Library > Variable group...), as shown below.

Example

This example assumes you want to publish on tags.

trigger:
  - master
  - refs/tags/*

variables:
  # ...
  - group: pypi-credentials  # Sets $(pypiToken)

stages:
  - stage: test
    jobs: # ...
  - stage: publish
    condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
    jobs:
      - template: job--python-publish--tag.yml@templates
        parameters:
          token: $(pypiToken)
          pythonVersion: "3.11"

Steps

step--python-provision.yml

Setup a Python runtime and a cache for pip dependencies.

Example:

variables:
  PIP_CACHE_DIR: $(Pipeline.Workspace)/.cache/pip

steps:
  - template: step--python-provision.yml@templates
    parameters:
      pythonVersion: "3.11"

step--python-install.yml

Expected scripts: make install-python.

Example:

variables:
  PIP_CACHE_DIR: $(Pipeline.Workspace)/.cache/pip

steps:
  - template: step--python-install.yml@templates
    parameters:
      pythonVersion: "3.11"

step--python-test.yml

Expected scripts: make install-python, make test.

Example:

steps:
  - template: step--python-test.yml@templates
    parameters:
      pythonVersion: "3.11"
      coverage: true # optional

step--node-provision.yml

Expected scripts: make install-node.

Setup a Node.js runtime and a cache for NPM dependencies.

Example:

variables:
  NODE_CACHE_FOLDER: $(Build.SourcesDirectory)/node_modules

steps:
  - template: step--node-provision.yml@templates
    parameters:
      nodeVersion: "18.x"

step--node-install.yml

Expected scripts: make install-node.

Setup a Node.js runtime, a cache for NPM dependencies, and install NPM dependencies.

Example:

variables:
  NODE_CACHE_FOLDER: $(Build.SourcesDirectory)/node_modules

steps:
  - template: step--node-install.yml@templates
    parameters:
      nodeVersion: "18.x"

azure-pipelines-templates's People

Contributors

florimondmanca avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.