summaryrefslogtreecommitdiff
path: root/azure-pipelines.yml
blob: b94eef366559c4fa35992bb2b765ffddccee96cd (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# Python package
# Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python

stages:

- stage: check_codestyle
  jobs:
    - job: pre_commit
      pool:
        vmImage: 'ubuntu-latest'

      steps:
        - task: UsePythonVersion@0
          inputs:
            versionSpec: '3.11'
        - script: |
            python -m pip install --upgrade build pip setuptools wheel
          displayName: 'Install Python build tools and dependencies'
        - script: |
            python -m build
            python -m pip install '.[dev]'
          displayName: 'Build wheel/sdist and install lmfit'
        - script: |
            pre-commit install ; pre-commit run --all-files
          displayName: 'Run pre-commit hooks'
        - script: |
            check-wheel-contents dist/*.whl
          displayName: 'Run check-wheel-contents'
        - script: |
            twine check dist/*
          displayName: "Run twine check"

- stage: build_documentation
  dependsOn: check_codestyle
  condition: succeededOrFailed()
  jobs:
    - job: build_documentation
      pool:
        vmImage: 'ubuntu-latest'

      steps:
        - task: UsePythonVersion@0
          inputs:
            versionSpec: '3.11'
        - script: |
            python -m pip install --upgrade build pip setuptools wheel
          displayName: 'Install Python build tools'
        - script: |
            python -m build
            python -m pip install '.[doc]'
          displayName: 'Build wheel/sdist and install lmfit'
        - script: |
            sudo apt-get update && sudo apt-get install -qq -y texlive-latex-extra latexmk
          displayName: 'Install TeX Live'
        - script: |
            cd doc ; make all
          displayName: 'Build the documentation'

- stage: tests_minimum_dependencies
  dependsOn: check_codestyle
  condition: succeededOrFailed()
  jobs:
    - job:
      pool:
        vmImage: 'ubuntu-latest'
      strategy:
        matrix:
          Python37:
            python.version: '3.7'
          Python38:
            python.version: '3.8'

      steps:
        - task: UsePythonVersion@0
          inputs:
            versionSpec: '$(python.version)'
          displayName: 'Use Python $(python.version)'
        - script: |
            sudo apt-get update && sudo apt-get install -yq --no-install-suggests --no-install-recommends \
            libatlas-base-dev liblapack-dev gfortran libgmp-dev libmpfr-dev libsuitesparse-dev ccache \
            swig libmpc-dev
          displayName: 'Install dependencies'
        - script: |
            python -m pip install --upgrade build pip wheel
            python -m pip install asteval==0.9.28 numpy==1.19.0 scipy==1.6.0 uncertainties==3.1.4
          displayName: 'Install minimum required version of dependencies'
        - script: |
            python -m build
            python -m pip install ".[test]"
          displayName: 'Build wheel/sdist and install lmfit'
        - script: |
            python -m pip list
          displayName: 'List installed Python packages'
        - script: |
            python -m pip install pytest-azurepipelines
            pytest
          displayName: 'Run test-suite and collect coverage'
        - script: |
            curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --import # One-time step
            curl -Os https://uploader.codecov.io/latest/linux/codecov
            curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
            curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
            gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM
            shasum -a 256 -c codecov.SHA256SUM
            chmod +x codecov
          displayName: 'Download and verify codecov uploader'
        - script: |
            ./codecov -v -f "coverage.xml"
          displayName: 'Upload to codecov.io'

- stage: tests_latest_dependencies
  dependsOn: check_codestyle
  condition: succeededOrFailed()
  jobs:
    - job:
      pool:
        vmImage: 'ubuntu-latest'
      strategy:
        matrix:
          Python37:
            python.version: '3.7'
          Python38:
            python.version: '3.8'
          Python39:
            python.version: '3.9'
          Python310:
            python.version: '3.10'
          Python311:
            python.version: '3.11'

      steps:
        - task: UsePythonVersion@0
          inputs:
            versionSpec: '$(python.version)'
          displayName: 'Use Python $(python.version)'
        - script: |
            sudo apt-get update && sudo apt-get install -yq --no-install-suggests --no-install-recommends \
            libatlas-base-dev liblapack-dev gfortran libgmp-dev libmpfr-dev libsuitesparse-dev ccache \
            swig libmpc-dev
          displayName: 'Install dependencies'
        - script: |
            python -m pip install --upgrade build pip setuptools wheel
          displayName: 'Install latest available version of Python dependencies'
        - script: |
            python -m build
            python -m pip install '.[all]'
          displayName: 'Build wheel/sdist and install lmfit'
        - script: |
            python -m pip list
          displayName: 'List installed Python packages'
        - script: |
            python -m pip install pytest-azurepipelines
            pytest
          displayName: 'Run test-suite and collect coverage'
        - script: |
            curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --import # One-time step
            curl -Os https://uploader.codecov.io/latest/linux/codecov
            curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
            curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
            gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM
            shasum -a 256 -c codecov.SHA256SUM
            chmod +x codecov
          displayName: 'Download and verify codecov uploader'
        - script: |
            ./codecov -v -f "coverage.xml"
          displayName: 'Upload to codecov.io'

# Python 3.11 on Windows currently fails to build pycairo
- stage: test_Windows_latest
  dependsOn: check_codestyle
  condition: succeededOrFailed()
  jobs:
    - job:
      pool:
        vmImage: 'windows-latest'
      strategy:
        matrix:
          Python310:
            python.version: '3.10'

      steps:
        - task: UsePythonVersion@0
          inputs:
            versionSpec: '$(python.version)'
          displayName: 'Use Python $(python.version)'
        - script: |
            python -m pip install --upgrade build pip setuptools wheel
          displayName: 'Install latest available version of Python dependencies'
        - script: |
            python -m build
            python -m pip install .[all]
          displayName: 'Build wheel/sdist and install lmfit'
        - script: |
            python -m pip list
          displayName: 'List installed Python packages'
        - script: |
            python -m pip install pytest-azurepipelines
            pytest
          displayName: 'Run test-suite'
        - powershell:
            cd doc ; .\make.bat html
          displayName: 'Build the HTML documentation'

- stage: test_macOS_latest
  dependsOn: check_codestyle
  condition: succeededOrFailed()
  jobs:
    - job:
      pool:
        vmImage: 'macos-latest'
      strategy:
        matrix:
          Python311:
            python.version: '3.11'

      steps:
        - task: UsePythonVersion@0
          inputs:
            versionSpec: '$(python.version)'
          displayName: 'Use Python $(python.version)'
        - script: |
            python -m pip install --upgrade build pip setuptools wheel
          displayName: 'Install latest available version of Python dependencies'
        - script: |
            python -m build
            python -m pip install '.[all]'
          displayName: 'Build wheel/sdist and install lmfit'
        - script: |
            python -m pip list
          displayName: 'List installed Python packages'
        - script: |
            python -m pip install pytest-azurepipelines
            pytest
          displayName: 'Run test-suite and collect coverage'

- stage: development_version
  dependsOn: check_codestyle
  condition: succeededOrFailed()
  jobs:
    - job: Python312_dev
      pool:
        vmImage: 'ubuntu-latest'
      steps:
        - script: |
            sudo add-apt-repository ppa:deadsnakes/nightly
            sudo apt-get update && sudo apt-get install -y --no-install-recommends python3.12-dev python3.12-venv
          displayName: Install Python development version from the deadsnakes PPA
        - script: |
            sudo apt-get update && sudo apt-get install -yq --no-install-suggests --no-install-recommends \
            libatlas-base-dev liblapack-dev gfortran libgmp-dev libmpfr-dev libsuitesparse-dev ccache \
            swig libmpc-dev
          displayName: 'Install dependencies'
        - script: |
            export PATH=/home/vsts/.local/bin:$PATH
            ##curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
            ##python3.12 get-pip.py --user
            python3.12 -m ensurepip --upgrade
            pip3.12 install -U build pip setuptools wheel pybind11 cython || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
          displayName: 'Install build, pip, setuptools, wheel, pybind11, and cython'
        - script: |
            export PATH=/home/vsts/.local/bin:$PATH
            export numpy_version=1.23.5
            wget https://github.com/numpy/numpy/releases/download/v${numpy_version}/numpy-${numpy_version}.tar.gz
            tar xzvf numpy-${numpy_version}.tar.gz
            cd numpy-${numpy_version}
            python3.12 setup.py install --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
          displayName: 'Install latest available version of NumPy'
        - script: |
            export PATH=/home/vsts/.local/bin:$PATH
            pip3.12 install -U pythran || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
          displayName: 'Install pythran'
        - script: |
            export PATH=/home/vsts/.local/bin:$PATH
            export scipy_version=1.9.3
            wget https://github.com/scipy/scipy/releases/download/v${scipy_version}/scipy-${scipy_version}.tar.gz
            tar xzvf scipy-${scipy_version}.tar.gz
            cd scipy-${scipy_version}
            python3.12 setup.py install --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
          displayName: 'Install latest available version of SciPy'
        - script: |
            export PATH=/home/vsts/.local/bin:$PATH
            # remove numdifftools for now as it pulls in statsmodels, that wants to build with NumPy 1.14.5
            pip3.12 install asteval uncertainties dill emcee flaky pytest pytest-cov || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
          displayName: 'Install latest available version of Python dependencies'
        - script: |
            python3.12 -m build
            python3.12 -m pip install '.[test]' --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
          displayName: 'Build wheel/sdist and install lmfit'
        - script: |
            export PATH=/home/vsts/.local/bin:$PATH
            pip3.12 list || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
          displayName: 'List installed Python packages'
        - script: |
            export PATH=/home/vsts/.local/bin:$PATH
            pip3.12 install pytest-azurepipelines
            cd $(Agent.BuildDirectory)/s/tests
            pytest || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!"
          displayName: 'Run test-suite'