Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Commit ab5d38d

Browse files
committed
fix up things
1 parent 1c29bdc commit ab5d38d

File tree

7 files changed

+77
-35
lines changed

7 files changed

+77
-35
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.idea
2+
.tox

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.1.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ configuration when using [tox](https://tox.readthedocs.org) to drive your CI.
99

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

12-
You can find this in `Project Settings` => `Service connections` in the Azure Devops dashboard for your project.
12+
You can find this in `Project Settings` => `Service connections` in the Azure Devops dashboard for your project.
1313
Project settings is located in the bottom left corner of the UI as of 2019-04-30. Below I'm using the endpoint name
1414
`github`.
1515

@@ -30,7 +30,7 @@ this will make the templates in this repository available in the `tox` namespace
3030
# job templates
3131

3232
## `run-tox-env.yml`
33-
This job template will run tox for a given set of tox targets on given platform (new in `0.1`).
33+
This job template will run tox for a given set of tox targets on given platform (new in `0.1`).
3434
Features and functionality:
3535

3636
- each specified toxenv target maps to a single Azure Pipelines job
@@ -46,7 +46,7 @@ Features and functionality:
4646
The following example will run `py36` and `py37` on Windows, Linux and MacOs. It will also invoke
4747
`fix_lint` and `docs` target with `python3.7` on Linux. Note how the root level name can be used
4848
to automatically specify the target platform (defaults to Linux).
49-
49+
5050
```yaml
5151
jobs:
5252
- template: run-tox-env.yml@tox
@@ -75,9 +75,9 @@ jobs:
7575
### parameters
7676

7777
At root level you can control with `tox_version` the tox version specifier to install, this defaults to latest in PyPi
78-
(`tox`). Beside this at the root level we have the ``jobs`` key. Inside this you can enlist groups of targets as maps.
78+
(`tox`). Beside this at the root level we have the ``jobs`` key. Inside this you can enlist groups of targets as maps.
7979
The key is the name of the group. The values configure the target:
80-
80+
8181
- `toxenvs`: the list of `tox` environment names to run; must either:
8282
- be equal to: `py27`, `py34`, `py35`, `py36`, `py37`, `py38`, `jython`, `pypy`, `pypy3`
8383
- start with: `py27-`, `py34-`, `py35-`, `py36-`, `py37-`, `py38-`, `jython-`, `pypy-`, `pypy3`
@@ -101,7 +101,7 @@ Note, for now:
101101

102102
This job template will download coverage files attached to the build (uploaded by `run-tox-env.yml`)
103103
and use target tox environment configured to generate a unified report. This then will be uploaded
104-
to the Azure Pipelines coverage report.
104+
to the Azure Pipelines coverage report.
105105

106106
### example
107107

@@ -118,12 +118,12 @@ to the Azure Pipelines coverage report.
118118
### parameters
119119
- `coverage` - tox target that generates the unified coverage report (default `coverage`)
120120
- `dependsOn` - environments this job depends on
121-
- `tox_version` - the tox version specifier to use, defaults to latest
121+
- `tox_version` - the tox version specifier to use, defaults to latest
122122

123123
## `publish-pypi.yml`
124124

125125
This job template will publish the Python package in the current folder (both sdist and wheel)
126-
via the PEP-517/8 build mechanism and twine.
126+
via the PEP-517/8 build mechanism and twine.
127127

128128
### example
129129

@@ -140,5 +140,5 @@ via the PEP-517/8 build mechanism and twine.
140140

141141
### parameters
142142
- `external_feed` - the external feed to upload
143-
- `pypi_remote` - the pypi remote to upload to
144-
- `dependsOn` - environments this job depends on
143+
- `pypi_remote` - the pypi remote to upload to
144+
- `dependsOn` - environments this job depends on

azure-pipelines.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.rr)
2+
3+
trigger:
4+
batch: true
5+
branches:
6+
include:
7+
- master
8+
- refs/tags/*
9+
pr:
10+
branches:
11+
include:
12+
- master
13+
14+
jobs:
15+
- template: run-tox-env.yml
16+
parameters:
17+
jobs:
18+
fix_lint: null

merge-coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
parameters:
22
dependsOn: []
3-
coverage: 'coverage'
3+
toxenv: 'coverage'
44
tox_version: 'tox'
55

66
jobs:
@@ -11,7 +11,7 @@ jobs:
1111
variables:
1212
TMPDIR: $(Build.BinariesDirectory)
1313
PIP_NO_WARN_SCRIPT_LOCATION: '0'
14-
TOXENV: ${{ parameters.coverage }}
14+
TOXENV: ${{ parameters.toxenv }}
1515
steps:
1616
- task: DownloadBuildArtifacts@0
1717
displayName: download coverage files for run

run-tox-env.yml

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
parameters:
22
jobs: []
33
tox_version: 'tox'
4-
before: []
5-
env: []
4+
coverage:
5+
with_toxenv: ''
6+
for_envs: []
67

78
jobs:
89
- ${{ each job in parameters.jobs }}:
@@ -122,25 +123,26 @@ jobs:
122123
testRunTitle: 'junit-$(Agent.OS)-$(Agent.OSArchitecture)-$(TOXENV)'
123124

124125
# upload coverage artifacts if present
125-
- ${{ if job.value.coverage }}:
126-
- script: ${{ format('$(toxPython.pythonLocation)/python -m tox -e {0}', job.value.coverage) }}
126+
- ${{ if and(parameters.coverage.with_toxenv, containsValue(parameters.coverage.for_envs, job.key)) }}:
127+
- script: ${{ format('$(toxPython.pythonLocation)/python -m tox -e {0} --skip-missing-interpreters false', parameters.coverage.with_toxenv) }}
127128
displayName: create coverag report
128-
- bash: 'printf "##vso[task.setVariable variable=coverage]" && ([ -f coverage.xml -o -f .coverage ] && printf yes || printf no) && echo ""'
129-
displayName: check if coverage file present
130-
condition: always()
131-
workingDirectory: '$(System.DefaultWorkingDirectory)/.tox'
132-
- task: CopyFiles@2
133-
displayName: move coverage files into staging area
134-
condition: eq(variables.coverage, 'yes')
135-
inputs:
136-
sourceFolder: $(System.DefaultWorkingDirectory)/.tox
137-
contents: |
138-
.coverage
139-
coverage.xml
140-
targetFolder: $(Build.StagingDirectory)
141-
- task: PublishBuildArtifacts@1
142-
displayName: publish coverage file
143-
condition: eq(variables.coverage, 'yes')
144-
inputs:
145-
pathtoPublish: $(Build.ArtifactStagingDirectory)
146-
ArtifactName: 'coverage-$(Agent.OS)-$(Agent.OSArchitecture)-$(TOXENV)'
129+
- task: CopyFiles@2
130+
displayName: move coverage files into staging area
131+
inputs:
132+
sourceFolder: $(System.DefaultWorkingDirectory)/.tox
133+
contents: |
134+
.coverage
135+
coverage.xml
136+
targetFolder: $(Build.StagingDirectory)
137+
- task: PublishBuildArtifacts@1
138+
displayName: publish coverage file
139+
inputs:
140+
pathtoPublish: $(Build.ArtifactStagingDirectory)
141+
ArtifactName: 'coverage-$(Agent.OS)-$(Agent.OSArchitecture)-$(TOXENV)'
142+
143+
- ${{ if and(parameters.coverage.with_toxenv, parameters.coverage.for_envs) }}:
144+
- template: merge-coverage.yml@tox
145+
parameters:
146+
tox_version: ${{ parameters.tox_version }}
147+
toxenv: ${{ parameters.coverage.with_toxenv }}
148+
dependsOn: ${{ parameters.coverage.for_envs }}

tox.ini

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[tox]
2+
envlist = fix_lint
3+
skipsdist = true
4+
5+
[testenv:fix_lint]
6+
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
7+
basepython = python3.7
8+
passenv = # without PROGRAMDATA cloning using git for Windows will fail with an `error setting certificate verify locations` error
9+
PROGRAMDATA
10+
extras = lint
11+
deps = pre-commit >= 1.14.4, < 2
12+
skip_install = True
13+
commands = pre-commit run --all-files --show-diff-on-failure
14+
python -c 'import pathlib; print("hint: run \{\} install to add checks as pre-commit hook".format(pathlib.Path(r"{envdir}") / "bin" / "pre-commit"))'

0 commit comments

Comments
 (0)