Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jan 16, 2020
2 parents 33d74f8 + b07b273 commit 667a970
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 15 deletions.
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
repos:
- repo: https://github.com/psf/black
rev: 19.3b0
rev: 19.10b0
hooks:
- id: black

- repo: https://github.com/asottile/blacken-docs
rev: v1.4.0
hooks:
- id: blacken-docs
9 changes: 0 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ python:
- 3.6
- &latest_py3 3.8

jobs:
fast_finish: true
include:
- stage: deploy
if: tag IS present
python: *latest_py3
before_script: skip
script: tox -e release

cache: pip

install:
Expand Down
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

.. image:: https://img.shields.io/pypi/pyversions/irc.svg

.. image:: https://dev.azure.com/jaraco/irc/_apis/build/status/jaraco.irc?branchName=master
:target: https://dev.azure.com/jaraco/irc/_build/latest?definitionId=1&branchName=master

.. image:: https://img.shields.io/travis/jaraco/irc/master.svg
:target: https://travis-ci.org/jaraco/irc

Expand Down
71 changes: 71 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Create the project in Azure with:
# az devops project create --name $name --organization https://dev.azure.com/$org/ --visibility public
# then configure the pipelines (through web UI)

trigger:
branches:
include:
- '*'
tags:
include:
- '*'

pool:
vmimage: 'Ubuntu-18.04'

variables:
- group: Azure secrets

stages:
- stage: Test
jobs:

- job: 'Test'
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
maxParallel: 4

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'

- script: python -m pip install tox
displayName: 'Install tox'

- script: |
tox -- --junit-xml=test-results.xml
displayName: 'run tests'
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-results.xml'
testRunTitle: 'Python $(python.version)'
condition: succeededOrFailed()

- stage: Publish
dependsOn: Test
jobs:
- job: 'Publish'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
architecture: 'x64'

- script: python -m pip install tox
displayName: 'Install tox'

- script: |
tox -e release
env:
TWINE_PASSWORD: $(PyPI-token)
displayName: 'publish to PyPI'
condition: contains(variables['Build.SourceBranch'], 'tags')
34 changes: 29 additions & 5 deletions skeleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,47 @@ Relies a .flake8 file to correct some default behaviors:

## Continuous Integration

The project is pre-configured to run tests in [Travis-CI](https://travis-ci.org) (.travis.yml). Any new project must be enabled either through their web site or with the `travis enable` command.
The project is pre-configured to run tests through multiple CI providers.

### Azure Pipelines

[Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) are the preferred provider as they provide free, fast, multi-platform services. See azure-pipelines.yml for more details.

Features include:

- test against multiple Python versions
- run on Ubuntu Bionic

### Travis CI

[Travis-CI](https://travis-ci.org) is configured through .travis.yml. Any new project must be enabled either through their web site or with the `travis enable` command.

Features include:
- test against Python 2 and 3
- test against 3
- run on Ubuntu Xenial
- correct for broken IPv6

Also provided is a minimal template for running under Appveyor (Windows).
### Appveyor

A minimal template for running under Appveyor (Windows) is provided.

### Continuous Deployments

In addition to running tests, an additional deploy stage is configured to automatically release tagged commits to PyPI using [API tokens](https://pypi.org/help/#apitoken). The release process expects an authorized token to be configured with Travis as the TWINE_PASSWORD environment variable. After the Travis project is created, configure the token through the web UI or with a command like the following (bash syntax):
In addition to running tests, an additional deploy stage is configured to automatically release tagged commits to PyPI using [API tokens](https://pypi.org/help/#apitoken). The release process expects an authorized token to be configured with Azure as the `Azure secrets` variable group. This variable group needs to be created only once per organization. For example:

```
TWINE_PASSWORD={token} travis env copy TWINE_PASSWORD
# create a resource group if none exists
az group create --name main --location eastus2
# create the vault (try different names until something works)
az keyvault create --name secrets007 --resource-group main
# create the secret
az keyvault secret set --vault-name secrets007 --name PyPI-token --value $token
```

Then, in the web UI for the project's Pipelines Library, create the `Azure secrets` variable group referencing the key vault name.

For more details, see [this blog entry](https://blog.jaraco.com/configuring-azure-pipelines-with-secets/).

## Building Documentation

Documentation is automatically built by [Read the Docs](https://readthedocs.org) when the project is registered with it, by way of the .readthedocs.yml file. To test the docs build manually, a tox env may be invoked as `tox -e docs`. Both techniques rely on the dependencies declared in `setup.cfg/options.extras_require.docs`.
Expand Down

0 comments on commit 667a970

Please sign in to comment.