This repository has been archived by the owner on Dec 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/
job--python-tox.yml
99 lines (90 loc) · 3.35 KB
/
job--python-tox.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
parameters:
toxenvs: []
os: linux
architectures: [x64]
coverage: true
wheel_tags: false
additional_variables: {}
pre_test: []
name_postfix: ''
jobs:
- job: ${{ format('tox_{0}{1}', parameters.os, parameters.name_postfix) }}
strategy:
matrix:
${{ each env in parameters.toxenvs }}:
${{ each arch in parameters.architectures }}:
${{ format('{0}_{1}', env, arch) }}:
TOXENV: ${{ env }}
arch: ${{ arch }}
${{ 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.10'
${{ if or(eq(env, 'py311'), startsWith(env, 'py311-')) }}:
py: '3.11'
${{ if or(eq(env, 'pypy3'), startsWith(env, 'pypy3-')) }}:
py: 'pypy3'
# we'll run tox using this python
${{ if or(eq(env, 'py312'), startsWith(env, 'py312-')) }}:
py: '3.11'
ispynext: true
# default python for toxenvs which don't start with `py`
${{ if not(startsWith(env, 'py')) }}:
py: '3.11'
pool:
${{ if eq(parameters.os, 'linux') }}:
vmImage: ubuntu-latest
${{ if eq(parameters.os, 'windows') }}:
vmImage: windows-latest
${{ if eq(parameters.os, 'macos') }}:
vmImage: macOS-latest
variables:
${{ if eq(parameters.os, 'windows') }}:
bindir: Scripts
${{ if ne(parameters.os, 'windows') }}:
bindir: bin
${{ insert }}: ${{ parameters.additional_variables }}
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(py)
architecture: $(arch)
- script: |
sudo add-apt-repository ppa:deadsnakes/nightly
sudo apt-get update
sudo apt-get install -y --no-install-recommends python3.12-dev
condition: variables.ispynext
displayName: install python 3.12
- ${{ parameters.pre_test }}
- script: python -m pip install --upgrade tox setuptools virtualenv
displayName: install tox
- script: tox
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
- ${{ if eq(parameters.wheel_tags, true) }}:
- bash: .tox/$(TOXENV)/$(bindir)/pip wheel --no-deps . -w wheels
displayName: build wheel
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
- ${{ if eq(parameters.os, 'macos') }}:
- bash: |
.tox/$(TOXENV)/$(bindir)/pip install 'delocate>=0.10.3'
.tox/$(TOXENV)/$(bindir)/delocate-wheel wheels/*.whl
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
displayName: delocate
- task: PublishBuildArtifacts@1
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
inputs:
pathToPublish: wheels
artifactName: wheel_${{ parameters.os }}_$(TOXENV)${{ parameters.name_postfix }}
displayName: publish wheel artifact