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

Commit 8e8e218

Browse files
committed
update documentation for 0.2
1 parent 93808cf commit 8e8e218

File tree

1 file changed

+71
-60
lines changed

1 file changed

+71
-60
lines changed

README.md

Lines changed: 71 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,45 @@ resources:
2727
ref: refs/tags/0.1
2828
```
2929
30-
this will make the templates in this repository available in the `tox` namespace.
30+
this will make the templates in this repository available in the `tox` namespace. Note the ref allows you to pin
31+
the template version you want, you can use ``refs/master`` if you want latest unstable version.
3132

3233
# job templates
3334

3435
## `run-tox-env.yml`
35-
This job template will run tox for a given set of tox targets on given platform (new in `0.1`).
36+
37+
#### Assumptions
38+
39+
tox will run under `Python 3.7`. tox environments generate Junit file under `.tox\junit.{toxenv}.xml`.
40+
Environments tracking coverage data generate will have another tox environment to normalize/merge coverage files.
41+
These should be invoked after test suit runs, and one final time to merge all the sub-coverage files when all
42+
specified tox environments finished (independent their outcome).
43+
44+
### Logic
45+
46+
This job template will run tox for a given set of tox target on given platforms (new in `0.2`).
3647
Features and functionality:
3748

38-
- each specified toxenv target maps to a single Azure Pipelines job
39-
- make tox available in the job: provision a python (``3.7``) and install a specified tox into that
49+
- each specified toxenv target maps to a single Azure Pipelines job, but split over multiple architectures via the
50+
image matrix (each matrix will set the `image_name` variable to `macOs`, `linux` or `windows`
51+
depending on the image used)
52+
- make tox available in the job: provision a python (`3.7`) and install a specified tox into that
4053
- provision a python needed for the target tox environment
4154
- provision the target tox environment (create environment, install dependencies)
4255
- invoke the tox target
4356
- if a junit file is found under `.tox\junit.{toxenv}.xml` upload it as test report
4457
- 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
58+
and upload those as a build artifact (also enqueue a job after all these job succeed to merge the generated
59+
coverage reports)
4660
- if coverage was requested queue a job that post all toxenv runs will merge all the coverages via a tox target
4761

62+
63+
4864
### example
4965

5066
The following example will run `py36` and `py37` on Windows, Linux and MacOs. It will also invoke
51-
`fix_lint` and `docs` target with `python3.7` on Linux.
67+
`fix_lint` and `docs` target with `python3.7` on Linux. It will also run the the `coverage` tox environment
68+
for `py37` and `py36`, and then save as build artifacts files `.tox/.coverage` and `.tox/coverage.xml`:
5269

5370
```yaml
5471
jobs:
@@ -63,78 +80,72 @@ jobs:
6380
py36:
6481
image: [linux, windows, macOs]
6582
coverage:
66-
with_toxenv: 'coverage' # generate .tox/.coverage, .tox/coverage.xml after test run
67-
for_envs: [py37, py36, py35, py34, py27]
83+
with_toxenv: 'coverage'
84+
for_envs: [py37, py36]
6885
```
6986

7087

7188
### parameters
7289

73-
At root level you can control with `tox_version` the tox version specifier to install, this defaults to latest in PyPi
74-
(`tox`). Beside this at the root level we have the ``jobs`` key. Inside this you can enlist groups of targets as maps.
75-
The key is the name of the group. The values configure the target:
76-
77-
- `toxenvs`: the list of `tox` environment names to run; must either:
78-
- be equal to: `py27`, `py34`, `py35`, `py36`, `py37`, `py38`, `jython`, `pypy`, `pypy3`
79-
- start with: `py27-`, `py34-`, `py35-`, `py36-`, `py37-`, `py38-`, `jython-`, `pypy-`, `pypy3`
80-
81-
- `image`: specify the Azure pipelines image to use (determines the OS target); if not specified
82-
we'll use the groups key name to assign one:
83-
- `linux` - `Ubuntu-16.04`
84-
- `windows` - `windows-2019`
85-
- `osx` - `macOS-latest`
86-
- otherwise `Ubuntu-16.04`
87-
- `architecture`: either `x64` or `x86`) with default `x64` (only affects windows)
88-
- `coverage`: if set after running the test suite tox will run this tox target to generate a coverage report.
89-
- `before` steps to be run before invoking the tox environment (useful to provision additional dependencies).
90-
91-
Note, for now:
92-
- `python3.8` is only available on linux -- it is installed from
93-
[deadsnakes](https://github.com/deadsnakes).
94-
- `jython` is available from under Linux and MacOs.
95-
96-
## `merge-coverage.yml`
90+
At root level you can control with:
91+
92+
- `tox_version` the tox version specifier to install, this defaults to latest in PyPi (`tox`) - setting it to empty,
93+
- `dependsOn` jobs these set of jobs should depend on
94+
- `before` steps to be run before invoking every tox environment (useful to provision additional dependencies), use
95+
condition variables for architecture specific content
96+
- `jobs` a map where the key is the tox environment key, while the value is configuration related to that
97+
environment:
98+
99+
- the key determines the tox target to run
100+
- the value contains:
101+
102+
- `image` to list an array of targeted architecture, the array elements are mapped as:
103+
- `linux` - `Ubuntu-16.04`
104+
- `windows` - `windows-2019`
105+
- `osx` - `macOS-latest`
106+
- otherwise the value if set, fallback to `Ubuntu-16.04`.
107+
108+
- `py` - determines the python to provision for running the environment, if not set will be derived from the key:
109+
- ``py27`` or starts with ``py27-`` - Python 2.7
110+
- ``py34`` or starts with ``py34-`` - Python 3.4
111+
- ``py35`` or starts with ``py35-`` - Python 3.5
112+
- ``py36`` or starts with ``py36-`` - Python 3.6
113+
- ``py37`` or starts with ``py37-`` - Python 3.7
114+
- ``py38`` or starts with ``py38-`` - Python 3.8 latest pre-release (only available on linux -- it is
115+
installed from [deadsnakes](https://github.com/deadsnakes))
116+
- ``pypy`` or starts with ``pypy-`` - PyPy 2
117+
- ``pypy3`` or starts with ``pypy3-`` - PyPy 3
118+
- `jython` - Jython is available from under Linux and MacOs.
119+
- `architecture`: Python architecture (either `x64` or `x86`) with default `x64` (only affects windows)
120+
- `before` steps to be run before invoking this tox environment (useful to provision additional dependencies)
121+
122+
- `coverage` - if set runs a tox environment (`with_toxenv` - must run with `python3.7`) to normalize coverage data
123+
(must generate `.tox/.coverage` and `.tox/coverage.xml`) after all environments within ``for_envs``. It also enqueues
124+
a final job to use `with_toxenv` to merge the coverage files under the name `report_coverage`.
97125

98-
This job template will download coverage files attached to the build (uploaded by `run-tox-env.yml`)
99-
and use target tox environment configured to generate a unified report. This then will be uploaded
100-
to the Azure Pipelines coverage report.
101-
102-
### example
103-
104-
```yaml
105-
- template: merge-coverage.yml@tox
106-
parameters:
107-
coverage: 'coverage'
108-
dependsOn:
109-
- windows
110-
- linux
111-
- macOs
112-
```
126+
## `publish-pypi.yml`
113127

114-
### parameters
115-
- `coverage` - tox target that generates the unified coverage report (default `coverage`)
116-
- `dependsOn` - environments this job depends on
117-
- `tox_version` - the tox version specifier to use, defaults to latest
128+
#### Assumptions
129+
The project is PEP-517 and PEP-518 compatible. A PyPi remote and external feed is configured via Azure Pipelines
130+
project dashboard.
118131

119-
## `publish-pypi.yml`
132+
### Logic
120133

121-
This job template will publish the Python package in the current folder (both sdist and wheel)
122-
via the PEP-517/8 build mechanism and twine.
134+
This job template will publish the Python package in the current folder (both sdist and wheel) via the PEP-517/8 build
135+
mechanism and twine.
123136

124137
### example
125138

126139
```yaml
127140
- ${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}:
128141
- template: publish-pypi.yml@tox
129142
parameters:
130-
- external_feed: 'toxdev'
131-
- pypi_remote: 'pypi-toxdev'
132-
- dependsOn:
133-
- check
134-
- report_coverage
143+
external_feed: 'toxdev'
144+
pypi_remote: 'pypi-toxdev'
145+
dependsOn: [report_coverage, fix_lint, docs]
135146
```
136147

137148
### parameters
138149
- `external_feed` - the external feed to upload
139150
- `pypi_remote` - the pypi remote to upload to
140-
- `dependsOn` - environments this job depends on
151+
- `dependsOn` - jobs this jobs depends on

0 commit comments

Comments
 (0)