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

Commit 93808cf

Browse files
committed
add badge fix help
1 parent ab5d38d commit 93808cf

File tree

4 files changed

+38
-27
lines changed

4 files changed

+38
-27
lines changed

README.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# tox azure-pipeline-template
22

3+
[![Build Status](https://dev.azure.com/toxdev/azure-pipelines-template/_apis/build/status/tox-dev.azure-pipelines-template?branchName=master)](https://dev.azure.com/toxdev/azure-pipelines-template/_build/latest?definitionId=11&branchName=master)
4+
35
This a template that will help simplify the [Azure Pipelines](https://azure.microsoft.com/en-gb/services/devops/pipelines/)
46
configuration when using [tox](https://tox.readthedocs.org) to drive your CI.
57

@@ -34,41 +36,35 @@ This job template will run tox for a given set of tox targets on given platform
3436
Features and functionality:
3537

3638
- each specified toxenv target maps to a single Azure Pipelines job
37-
- provision a python for the job
38-
- install tox into that python
39+
- make tox available in the job: provision a python (``3.7``) and install a specified tox into that
40+
- provision a python needed for the target tox environment
3941
- provision the target tox environment (create environment, install dependencies)
4042
- invoke the tox target
4143
- if a junit file is found under `.tox\junit.{toxenv}.xml` upload it as test report
42-
- if a coverage file is found under `.tox\coverage.xml` or `.tox\.coverage` upload it as build artifact
44+
- if coverage is requested, run a tox target that should generate the `.tox\coverage.xml` or `.tox\.coverage`
45+
and upload those as a build artifact
46+
- if coverage was requested queue a job that post all toxenv runs will merge all the coverages via a tox target
4347

4448
### example
4549

4650
The following example will run `py36` and `py37` on Windows, Linux and MacOs. It will also invoke
47-
`fix_lint` and `docs` target with `python3.7` on Linux. Note how the root level name can be used
48-
to automatically specify the target platform (defaults to Linux).
51+
`fix_lint` and `docs` target with `python3.7` on Linux.
4952

5053
```yaml
5154
jobs:
5255
- template: run-tox-env.yml@tox
5356
parameters:
57+
tox_version: ''
5458
jobs:
55-
windows:
56-
toxenvs:
57-
- py37
58-
- py36
59-
linux:
60-
toxenvs:
61-
- py37
62-
- py36
63-
macOs:
64-
toxenvs:
65-
- py37
66-
- py27
67-
check:
68-
py: '3.7'
69-
toxenvs:
70-
- fix_lint
71-
- docs
59+
fix_lint: null
60+
docs: null
61+
py37:
62+
image: [linux, windows, macOs]
63+
py36:
64+
image: [linux, windows, macOs]
65+
coverage:
66+
with_toxenv: 'coverage' # generate .tox/.coverage, .tox/coverage.xml after test run
67+
for_envs: [py37, py36, py35, py34, py27]
7268
```
7369

7470

merge-coverage.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ jobs:
4040
shutil.copy(str(coverage_file), str(destination))'
4141
displayName: move coverage files into .tox
4242
43-
- script: ${{ format('python -m pip install -U --user --force-reinstall {0}', parameters.tox_version) }}
44-
displayName: install tox
43+
- ${{ if parameters.tox_version }}:
44+
- script: ${{ format('python -m pip install -U --user --force-reinstall {0}', parameters.tox_version) }}
45+
displayName: ${{ format('install {0} from PyPi', parameters.tox_version) }}
46+
- ${{ if not(parameters.tox_version) }}:
47+
- script: python -m pip install -U --user --force-reinstall .
48+
displayName: install tox inline
4549

4650
- script: 'python -m tox -e py -vv --sdistonly'
4751
displayName: run package build to ensure generated files present

publish-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
externalFeeds: ${{ parameters.external_feed}}
2121
- script: 'python -m pip install -U --user --force-reinstall twine pep517'
2222
displayName: "acquire build tools"
23-
- script: 'python -m pep517.build -m --binary --source --out-dir "$(System.DefaultWorkingDirectory)/w" .'
23+
- script: 'python -m pep517.build --binary --source --out-dir "$(System.DefaultWorkingDirectory)/w" .'
2424
displayName: "build wheel and source distribution"
2525
- script: ${{ format('python3.7 -m twine upload -r {0} --config-file $(PYPIRC_PATH) "$(System.DefaultWorkingDirectory)/w/*"', parameters.pypi_remote) }}
2626
displayName: "upload sdist and wheel to PyPi"

run-tox-env.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,33 @@ parameters:
44
coverage:
55
with_toxenv: ''
66
for_envs: []
7+
dependsOn: []
78

89
jobs:
910
- ${{ each job in parameters.jobs }}:
1011
- job: ${{ coalesce(job.value.name, job.key) }}
12+
dependsOn: ${{ coalesce(job.value.dependsOn, parameters.dependsOn) }}
1113
strategy:
1214
matrix:
1315
${{ if job.value.image }}:
1416
${{ each image in job.value.image }}:
1517
${{ image }}:
1618
${{ if eq(image, 'linux') }}:
1719
image: 'Ubuntu-16.04'
20+
image_name: 'linux'
1821
${{ if eq(image, 'windows') }}:
1922
image: 'windows-2019'
23+
image_name: 'windows'
2024
${{ if eq(image, 'macOs') }}:
2125
image: 'macOS-10.14'
26+
image_name: 'macOs'
2227
${{ if notIn(image, 'macOs', 'linux', 'windows') }}:
2328
image: ${{ coalesce(image, 'Ubuntu-16.04') }}
29+
image_name: ${{ coalesce(image, 'linux') }}
2430
${{ if not(job.value.image) }}:
2531
linux:
2632
image: 'Ubuntu-16.04'
33+
image_name: 'linux'
2734
pool:
2835
vmImage: $[ variables['image'] ]
2936

@@ -99,7 +106,11 @@ jobs:
99106
- script: 'python -c "import sys; print(sys.version); print(sys.executable);"'
100107
displayName: show python information
101108

102-
# allow user to plugin further improvements
109+
# allow user to run global before
110+
- ${{ if parameters.before }}:
111+
- ${{ parameters.before }}
112+
113+
# allow user to run per job setup
103114
- ${{ if job.value.before }}:
104115
- ${{ job.value.before }}
105116

@@ -141,7 +152,7 @@ jobs:
141152
ArtifactName: 'coverage-$(Agent.OS)-$(Agent.OSArchitecture)-$(TOXENV)'
142153

143154
- ${{ if and(parameters.coverage.with_toxenv, parameters.coverage.for_envs) }}:
144-
- template: merge-coverage.yml@tox
155+
- template: merge-coverage.yml
145156
parameters:
146157
tox_version: ${{ parameters.tox_version }}
147158
toxenv: ${{ parameters.coverage.with_toxenv }}

0 commit comments

Comments
 (0)