|
1 | 1 | name: $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.rr) |
2 | | - |
3 | | -variables: |
4 | | - "System.PreferGit": true |
5 | | - PYTEST_ADDOPTS: "-vv -ra --showlocals" |
| 2 | +resources: |
| 3 | + repositories: |
| 4 | + - repository: tox |
| 5 | + type: github |
| 6 | + endpoint: github |
| 7 | + name: tox-dev/azure-pipelines-template |
| 8 | + ref: master |
6 | 9 |
|
7 | 10 | trigger: |
8 | 11 | batch: true |
9 | 12 | branches: |
10 | 13 | include: |
11 | | - - master |
12 | | - - refs/tags/* |
13 | | - paths: |
14 | | - exclude: |
15 | | - - readthedocs.yml |
16 | | - - LICENSE.txt |
17 | | - - CODE_OF_CONDUCT.md |
18 | | - - .gitignore |
19 | | - - .github/* |
20 | | - |
21 | | -jobs: |
22 | | - - template: azure-run-tox-env.yml |
23 | | - parameters: {tox: fix_lint, python: '3.7'} |
24 | | - - template: azure-run-tox-env.yml |
25 | | - parameters: {tox: docs, python: '3.7'} |
26 | | - - template: azure-run-tox-env.yml |
27 | | - parameters: {tox: package_description, python: '3.7'} |
28 | | - |
29 | | - - template: azure-run-tox-env.yml |
30 | | - parameters: {tox: pypy, python: pypy2, os: linux} |
31 | | - - template: azure-run-tox-env.yml |
32 | | - parameters: {tox: pypy3, python: pypy3, os: linux} |
33 | | - |
34 | | - - template: azure-run-tox-env.yml |
35 | | - parameters: {tox: py37, python: '3.7', os: windows} |
36 | | - - template: azure-run-tox-env.yml |
37 | | - parameters: {tox: py36, python: '3.6', os: windows} |
38 | | - - template: azure-run-tox-env.yml |
39 | | - parameters: {tox: py35, python: '3.5', os: windows} |
40 | | - - template: azure-run-tox-env.yml |
41 | | - parameters: {tox: py34, python: '3.4', os: windows} |
42 | | - - template: azure-run-tox-env.yml |
43 | | - parameters: {tox: py27, python: '2.7', os: windows} |
44 | | - |
45 | | - - template: azure-run-tox-env.yml |
46 | | - parameters: {tox: py37, python: '3.7', os: linux} |
47 | | - - template: azure-run-tox-env.yml |
48 | | - parameters: {tox: py36, python: '3.6', os: linux} |
49 | | - - template: azure-run-tox-env.yml |
50 | | - parameters: {tox: py35, python: '3.5', os: linux} |
51 | | - - template: azure-run-tox-env.yml |
52 | | - parameters: {tox: py34, python: '3.4', os: linux} |
53 | | - - template: azure-run-tox-env.yml |
54 | | - parameters: {tox: py27, python: '2.7', os: linux} |
55 | | - |
56 | | - - template: azure-run-tox-env.yml |
57 | | - parameters: {tox: py36, python: '3.6', os: macOs} |
58 | | - |
59 | | - - job: report_coverage |
60 | | - pool: {vmImage: 'Ubuntu 16.04'} |
61 | | - dependsOn: |
62 | | - - windows_py37 |
63 | | - - windows_py36 |
64 | | - - windows_py35 |
65 | | - - windows_py34 |
66 | | - - windows_py27 |
67 | | - - linux_py37 |
68 | | - - linux_py36 |
69 | | - - linux_py35 |
70 | | - - linux_py34 |
71 | | - - linux_py27 |
72 | | - - linux_pypy3 |
73 | | - - linux_pypy |
74 | | - - macOS_py36 |
75 | | - steps: |
76 | | - - task: DownloadBuildArtifacts@0 |
77 | | - displayName: download coverage files for run |
78 | | - inputs: |
79 | | - buildType: current |
80 | | - downloadType: specific |
81 | | - itemPattern: coverage-*/* |
82 | | - downloadPath: $(Build.StagingDirectory) |
83 | | - |
84 | | - - task: UsePythonVersion@0 |
85 | | - displayName: setup python |
86 | | - inputs: |
87 | | - versionSpec: 3.7 |
88 | | - |
89 | | - - script: | |
90 | | - python -c ' |
91 | | - from pathlib import Path |
92 | | - import shutil |
93 | | -
|
94 | | - from_folder = Path("$(Build.StagingDirectory)") |
95 | | - destination_folder = Path("$(System.DefaultWorkingDirectory)") / ".tox" |
96 | | - destination_folder.mkdir() |
97 | | - for coverage_file in from_folder.glob("*/.coverage"): |
98 | | - destination = destination_folder / f".coverage.{coverage_file.parent.name[9:]}" |
99 | | - print(f"{coverage_file} copy to {destination}") |
100 | | - shutil.copy(str(coverage_file), str(destination))' |
101 | | - displayName: move coverage files into .tox |
102 | | -
|
103 | | - - script: 'python -m pip install -U tox --pre' |
104 | | - displayName: install tox |
105 | | - |
106 | | - - script: 'python -m tox -e py --sdistonly' |
107 | | - displayName: generate version.py |
108 | | - |
109 | | - - script: 'python -m tox -e coverage' |
110 | | - displayName: create coverag report via tox |
| 14 | + - master |
| 15 | + - refs/tags/* |
| 16 | +pr: |
| 17 | + branches: |
| 18 | + include: |
| 19 | + - master |
111 | 20 |
|
112 | | - - task: PublishCodeCoverageResults@1 |
113 | | - displayName: publish overall coverage report to Azure |
114 | | - inputs: |
115 | | - codeCoverageTool: 'cobertura' |
116 | | - summaryFileLocation: '$(System.DefaultWorkingDirectory)/.tox/coverage.xml' |
117 | | - reportDirectory: '$(System.DefaultWorkingDirectory)/.tox/htmlcov' |
118 | | - failIfCoverageEmpty: true |
| 21 | +variables: |
| 22 | + PYTEST_ADDOPTS: "-v -v -ra --showlocals" |
| 23 | + PYTEST_XDIST_PROC_NR: 'auto' |
119 | 24 |
|
120 | | - - job: publish |
121 | | - dependsOn: |
122 | | - - report_coverage |
123 | | - - linux_fix_lint |
124 | | - - linux_docs |
125 | | - - linux_package_description |
126 | | - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/')) |
127 | | - pool: {vmImage: 'Ubuntu 16.04'} |
128 | | - steps: |
129 | | - - task: UsePythonVersion@0 |
130 | | - displayName: setup python3.7 |
131 | | - inputs: {versionSpec: '3.7'} |
132 | | - - script: 'python -m pip install -U pip twine' |
133 | | - displayName: upgrade pip |
134 | | - - script: 'python -m pip wheel -w $(Build.ArtifactStagingDirectory)/build --no-deps .' |
135 | | - displayName: build wheel |
136 | | - - task: PublishBuildArtifacts@1 |
137 | | - displayName: wheel to Azure Artifact |
138 | | - inputs: |
139 | | - pathtoPublish: "$(Build.ArtifactStagingDirectory)/build" |
140 | | - ArtifactName: wheel |
141 | | - - task: TwineAuthenticate@0 |
142 | | - inputs: |
143 | | - artifactFeeds: '' |
144 | | - externalFeeds: pypi-conn |
145 | | - - script: 'python -m twine upload -r pypi --verbose --config-file $PYPIRC_PATH $(Build.ArtifactStagingDirectory)/build/*.whl' |
146 | | - displayName: perform publish |
| 25 | +jobs: |
| 26 | +- template: run-tox-env.yml@tox |
| 27 | + parameters: |
| 28 | + jobs: |
| 29 | + fix_lint: null |
| 30 | + docs: null |
| 31 | + py38: |
| 32 | + image: [linux] |
| 33 | + py37: |
| 34 | + image: [linux, windows, macOs] |
| 35 | + py36: |
| 36 | + image: [linux, windows, macOs] |
| 37 | + py35: |
| 38 | + image: [linux, windows, macOs] |
| 39 | + py27: |
| 40 | + image: [linux, windows, macOs] |
| 41 | + pypy3: |
| 42 | + image: [linux] |
| 43 | + pypy: |
| 44 | + image: [linux] |
| 45 | + dev: null |
| 46 | + package_description: null |
| 47 | + coverage: |
| 48 | + with_toxenv: 'coverage' # generate .tox/.coverage, .tox/coverage.xml after test run |
| 49 | + for_envs: [py38, py37, py36, py35] |
| 50 | + |
| 51 | +- ${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}: |
| 52 | + - template: publish-pypi.yml@tox |
| 53 | + parameters: |
| 54 | + external_feed: 'toxdev' |
| 55 | + pypi_remote: 'pypi-toxdev' |
| 56 | + dependsOn: [fix_lint, docs, package_description, dev, report_coverage] |
0 commit comments