forked from pypa/virtualenv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-run-tox-env.yml
79 lines (66 loc) · 2.72 KB
/
azure-run-tox-env.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
parameters:
tox: ""
python: ""
os: "linux"
jobs:
- job: ${{ format('{0}_{1}', parameters.os, parameters.tox) }}
pool:
${{ if eq(parameters.os, 'windows') }}:
vmImage: "vs2017-win2016"
${{ if eq(parameters.os, 'macOs') }}:
vmImage: "macOS 10.13"
${{ if eq(parameters.os, 'linux') }}:
vmImage: "Ubuntu 16.04"
variables:
${{ if in(parameters.python, 'pypy', 'pypy3') }}:
python: ${{ parameters.python }}
${{ if notIn(parameters.python, 'pypy', 'pypy3') }}:
python: "python"
steps:
# ensure the required Python versions are available
- ${{ if notIn(parameters.python, 'pypy', 'pypy3') }}:
- task: UsePythonVersion@0
displayName: setup python
inputs:
versionSpec: ${{ parameters.python }}
- script: "$(python) -c \"import sys; print(sys.version); print(sys.executable)\""
displayName: show python information
- script: "python -m pip install -U pip setuptools --user -v"
displayName: upgrade pip and setuptools
- script: "python -m pip install -U tox --pre --user -v"
displayName: install tox
- script: ${{ format('python -m tox -e {0} --notest', parameters.tox) }}
displayName: install test dependencies
- ${{ if startsWith(parameters.tox, 'py') }}:
- script: python -m tox -e coverage --notest
displayName: install coverage dependencies
- script: ${{ format('python -m tox -e {0}', parameters.tox) }}
displayName: run tests
- ${{ if and( startsWith(parameters.tox, 'py'), eq(variables['system.pullrequest.isfork'], false) ) }}:
- task: PublishTestResults@2
displayName: publish test results via junit
condition: succeededOrFailed()
inputs:
testResultsFormat: "JUnit"
testResultsFiles: ${{ format('$(System.DefaultWorkingDirectory)/.tox/.test.{0}.xml', parameters.tox) }}
testRunTitle: ${{ format('{0}_{1}', parameters.os, parameters.tox) }}
- ${{ if startsWith(parameters.tox, 'py') }}:
- script: "python -m tox -e coverage"
displayName: create coverag report
condition: succeededOrFailed()
- ${{ if and( startsWith(parameters.tox, 'py'), eq(variables['system.pullrequest.isfork'], false) ) }}:
- task: CopyFiles@2
displayName: move coverage files into staging area
condition: succeededOrFailed()
inputs:
sourceFolder: $(System.DefaultWorkingDirectory)/.tox
contents: |
.coverage
coverage.xml
targetFolder: $(Build.StagingDirectory)
- task: PublishBuildArtifacts@1
displayName: publish coverage file
condition: succeededOrFailed()
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
ArtifactName: ${{ format('coverage-{0}-{1}', parameters.os, parameters.tox) }}