summaryrefslogtreecommitdiff
path: root/azure-pipelines.yml
blob: 949c39fc4f3f068b484814851d8c3d352455afc2 (plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
trigger:
- master
- features

variables:
  PYTEST_ADDOPTS: "--junitxml=build/test-results/$(tox.env).xml"
  python.needs_vc: False
  python.exe: "python"
  COVERAGE_FILE: "$(Build.Repository.LocalPath)/.coverage"
  COVERAGE_PROCESS_START: "$(Build.Repository.LocalPath)/.coveragerc"
  PYTEST_COVERAGE: '0'

jobs:

- job: 'Test'
  pool:
    vmImage: "vs2017-win2016"
  strategy:
    matrix:
      py27:
        python.version: '2.7'
        tox.env: 'py27'
        PYTEST_COVERAGE: '1'
      py27-xdist:
        python.version: '2.7'
        tox.env: 'py27-xdist'
        PYTEST_COVERAGE: '1'
      py27-numpy/nobyte:
        python.version: '2.7'
        tox.env: 'py27-numpy,py27-nobyte'
        PYTEST_COVERAGE: '1'
      py27-trial:
        python.version: '2.7'
        tox.env: 'py27-trial'
        python.needs_vc: True
        PYTEST_COVERAGE: '1'
      py27-pluggymaster-xdist:
        python.version: '2.7'
        tox.env: 'py27-pluggymaster-xdist'
      pypy:
        python.version: 'pypy'
        tox.env: 'pypy'
        python.exe: 'pypy'
      py34:
        python.version: '3.4'
        tox.env: 'py34'
        PYTEST_COVERAGE: '1'
      py35:
        python.version: '3.5'
        tox.env: 'py35'
        PYTEST_COVERAGE: '1'
      py36:
        python.version: '3.6'
        tox.env: 'py36'
        PYTEST_COVERAGE: '1'
      py37:
        python.version: '3.7'
        tox.env: 'py37'
        PYTEST_COVERAGE: '1'
      py37-linting/docs/doctesting:
        python.version: '3.7'
        tox.env: 'linting,docs,doctesting'
      py37-xdist:
        python.version: '3.7'
        tox.env: 'py37-xdist'
        PYTEST_COVERAGE: '1'
      py37-trial/numpy:
        python.version: '3.7'
        tox.env: 'py37-trial,py37-numpy'
        PYTEST_COVERAGE: '1'
      py37-pluggymaster-xdist:
        python.version: '3.7'
        tox.env: 'py37-pluggymaster-xdist'
    maxParallel: 10

  steps:
  - task: UsePythonVersion@0
    condition: not(startsWith(variables['python.exe'], 'pypy'))
    inputs:
      versionSpec: '$(python.version)'
      architecture: 'x64'

  - script: choco install vcpython27
    condition: eq(variables['python.needs_vc'], True)
    displayName: 'Install VC for py27'

  - script: choco install python.pypy
    condition: eq(variables['python.exe'], 'pypy')
    displayName: 'Install pypy'

  - script: choco install pypy3
    condition: eq(variables['python.exe'], 'pypy3')
    displayName: 'Install pypy3'

  - task: PowerShell@2
    inputs:
      targetType: 'inline'
      script: |
        Invoke-WebRequest -Uri "https://bootstrap.pypa.io/get-pip.py" -OutFile "get-pip.py"
        $(python.exe) get-pip.py
    condition: startsWith(variables['python.exe'], 'pypy')
    displayName: 'Install pip'

  - script: $(python.exe) -m pip install --upgrade pip && $(python.exe) -m pip install tox
    displayName: 'Install tox'

  - script: |
      call scripts/setup-coverage-vars.bat || goto :eof
      $(python.exe) -m tox -e $(tox.env)
    displayName: 'Run tests'

  - task: PublishTestResults@2
    inputs:
      testResultsFiles: 'build/test-results/$(tox.env).xml'
      testRunTitle: '$(tox.env)'
    condition: succeededOrFailed()

  - script: call scripts\upload-coverage.bat
    displayName: 'Upload coverage'
    condition: eq(variables['PYTEST_COVERAGE'], '1')
    env:
      CODECOV_TOKEN: $(CODECOV_TOKEN)