This repository has been archived by the owner on Jul 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython-tests.yml
78 lines (68 loc) · 2.49 KB
/
python-tests.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
# Copied with so far minor modifications from
# https://github.com/asottile/azure-pipeline-templates/blob/master/job--python-tox.yml
parameters:
toxenvs: []
os: linux
coverage: true
additionalVariables: {}
preTest: []
namePostfix: ""
jobs:
- job: ${{ format('tox_{0}{1}', parameters.os, parameters.namePostfix) }}
strategy:
matrix:
${{ each env in parameters.toxenvs }}:
${{ env }}:
TOXENV: ${{ env }}
${{ if or(eq(env, 'py35'), startsWith(env, 'py35-')) }}:
py: "3.5"
${{ if or(eq(env, 'py36'), startsWith(env, 'py36-')) }}:
py: "3.6"
${{ if or(eq(env, 'py37'), startsWith(env, 'py37-')) }}:
py: "3.7"
${{ if or(eq(env, 'py38'), startsWith(env, 'py38-')) }}:
py: "3.8"
${{ if or(eq(env, 'py39'), startsWith(env, 'py39-')) }}:
py: "3.9"
${{ if or(eq(env, 'py310'), startsWith(env, 'py310-')) }}:
py: "3.8"
ispy310: true
${{ if or(eq(env, 'pypy3'), startsWith(env, 'pypy3-')) }}:
py: "pypy3"
# Use Python 3.8 by default for toxenvs that don't start with "py"
${{ if not(startsWith(env, 'py')) }}:
py: "3.8"
pool:
${{ if eq(parameters.os, 'linux') }}:
vmImage: ubuntu-18.04
${{ if eq(parameters.os, 'windows') }}:
vmImage: windows-2019
${{ if eq(parameters.os, 'macos') }}:
vmImage: macOS-10.14
variables:
${{ if eq(parameters.os, 'windows') }}:
bindir: Scripts
${{ if ne(parameters.os, 'windows') }}:
bindir: bin
${{ insert }}: ${{ parameters.additionalVariables }}
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(py)
- template: ../tasks/deadsnakes-install.yml
parameters:
version: "3.10"
condition: variables.ispy310
- ${{ parameters.preTest }}
- script: python -m pip install --upgrade tox setuptools virtualenv wheel
displayName: Install tox
- bash: tox --discover $(which python)
displayName: Run tox
- ${{ if eq(parameters.coverage, true) }}:
- bash: .tox/$(TOXENV)/$(bindir)/coverage xml -o coverage.xml
displayName: Generate coverage xml
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: cobertura
summaryFileLocation: coverage.xml
displayName: Publish coverage artifact