Skip to content

Commit 13b0134

Browse files
authored
TST: Use templates in Azure Pipelines config file (#926)
* try posix.yml template for bare linux and mac * move conda tests to templates * add to what's new * remove commented flake check
1 parent ae98bf9 commit 13b0134

File tree

5 files changed

+153
-183
lines changed

5 files changed

+153
-183
lines changed

azure-pipelines.yml

Lines changed: 16 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -6,195 +6,28 @@ trigger:
66

77
jobs:
88

9-
- job: 'Test_bare_linux'
10-
11-
pool:
12-
vmImage: 'ubuntu-16.04'
13-
strategy:
14-
matrix:
15-
Python35:
16-
python.version: '3.5'
17-
Python36:
18-
python.version: '3.6'
19-
Python37:
20-
python.version: '3.7'
21-
Python38:
22-
python.version: '3.8'
23-
24-
25-
steps:
26-
- task: UsePythonVersion@0
27-
inputs:
28-
versionSpec: '$(python.version)'
29-
30-
- script: |
31-
pip install pytest pytest-cov pytest-mock pytest-timeout pytest-azurepipelines pytest-rerunfailures pytest-remotedata
32-
pip install -e .
33-
pytest pvlib --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
34-
displayName: 'Test with pytest'
35-
36-
- task: PublishTestResults@2
37-
condition: succeededOrFailed()
38-
inputs:
39-
testResultsFiles: '**/test-*.xml'
40-
testRunTitle: 'Publish test results for Python $(python.version)'
41-
42-
- task: PublishCodeCoverageResults@1
43-
inputs:
44-
codeCoverageTool: Cobertura
45-
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
46-
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
47-
48-
49-
- job: 'Test_conda_linux'
50-
51-
pool:
52-
vmImage: 'ubuntu-16.04'
53-
54-
strategy:
55-
matrix:
56-
Python35:
57-
python.version: '35'
58-
Python36:
59-
python.version: '36'
60-
coverage: true
61-
Python37:
62-
python.version: '37'
63-
Python38:
64-
python.version: '38'
65-
66-
steps:
67-
- bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin"
68-
displayName: Add conda to PATH
69-
- script: conda env create --quiet --file ci/requirements-py$(python.version).yml
70-
displayName: Create Anaconda environment
71-
- script: |
72-
source activate test_env
73-
pip install pytest-azurepipelines
74-
pip install -e .
75-
displayName: 'pip dependencies'
76-
- script: |
77-
source activate test_env
78-
conda list
79-
displayName: 'List installed dependencies'
80-
- script: |
81-
source activate test_env
82-
export NREL_API_KEY=$(nrelApiKey)
83-
pytest pvlib --remote-data --junitxml=junit/test-results.xml --cov --cov-report=xml --cov-report=html
84-
displayName: 'pytest'
85-
# - script: |
86-
# source activate test_env
87-
# flake8 pvlib
88-
# displayName: 'flake8'
89-
- task: PublishTestResults@2
90-
inputs:
91-
testResultsFiles: '**/test-results.xml'
92-
testRunTitle: 'Linux $(python.version)'
93-
- task: PublishCodeCoverageResults@1
94-
inputs:
95-
codeCoverageTool: Cobertura
96-
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
97-
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
98-
condition: eq(variables['coverage'], true)
99-
- script: |
100-
bash <(curl https://codecov.io/bash) -t bbc2bdbe-5e67-4fef-9cb7-f52fe0b703a8 -f coverage.xml -F adder -F subtractor -F conda
101-
displayName: 'codecov'
102-
condition: eq(variables['coverage'], true)
9+
- template: ci/azure/posix.yml
10+
parameters:
11+
name: Test_bare_Linux
12+
vmImage: ubuntu-16.04
10313

10414

105-
- job: 'Test_conda_windows'
106-
107-
pool:
108-
vmImage: 'vs2017-win2016'
109-
110-
strategy:
111-
matrix:
112-
Python35-windows:
113-
python.version: '35'
114-
Python36-windows:
115-
python.version: '36'
116-
Python37-windows:
117-
python.version: '37'
118-
Python38-windows:
119-
python.version: '38'
120-
121-
steps:
122-
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
123-
displayName: Add conda to PATH
124-
- script: conda env create --quiet --file ci/requirements-py$(python.version).yml
125-
displayName: Create Anaconda environment
126-
- script: |
127-
call activate test_env
128-
pip install pytest-azurepipelines
129-
pip install -e .
130-
displayName: 'pip dependencies'
131-
- script: |
132-
call activate test_env
133-
conda list
134-
displayName: 'List installed dependencies'
135-
- script: |
136-
call activate test_env
137-
pytest pvlib --junitxml=junit/test-results.xml
138-
displayName: 'pytest'
139-
- task: PublishTestResults@2
140-
inputs:
141-
testResultsFiles: '**/test-results.xml'
142-
testRunTitle: 'Windows $(python.version)'
15+
- template: ci/azure/posix.yml
16+
parameters:
17+
name: Test_bare_macOS
18+
vmImage: macOS-10.14
14319

14420

145-
- job: 'Test_bare_macOS_Mojave'
21+
- template: ci/azure/conda_linux.yml
22+
parameters:
23+
name: Test_conda_linux
24+
vmImage: ubuntu-16.04
14625

147-
pool:
148-
vmImage: 'macOS-10.14'
149-
strategy:
150-
matrix:
151-
Python35:
152-
python.version: '3.5'
153-
Python36:
154-
python.version: '3.6'
155-
Python37:
156-
python.version: '3.7'
157-
Python38:
158-
python.version: '3.8'
159-
160-
steps:
161-
- task: UsePythonVersion@0
162-
inputs:
163-
versionSpec: '$(python.version)'
16426

165-
- script: |
166-
pip install pytest pytest-cov pytest-mock pytest-timeout pytest-azurepipelines pytest-rerunfailures pytest-remotedata
167-
pip install -e .
168-
pytest pvlib --junitxml=junit/test-results.xml --cov=pvlib --cov-report=xml --cov-report=html
169-
displayName: 'Test with pytest'
170-
171-
- task: PublishTestResults@2
172-
condition: succeededOrFailed()
173-
inputs:
174-
testResultsFiles: '**/test-*.xml'
175-
testRunTitle: 'Publish test results for Python $(python.version)'
176-
177-
- task: PublishCodeCoverageResults@1
178-
inputs:
179-
codeCoverageTool: Cobertura
180-
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
181-
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
182-
183-
184-
- job: DocTest
185-
pool:
186-
vmImage: 'ubuntu-16.04'
187-
steps:
188-
- task: UsePythonVersion@0
189-
inputs:
190-
versionSpec: '3.8'
191-
- script: |
192-
pip install -e .[all]
193-
displayName: Install pvlib[all] for doc build
194-
- script: |
195-
cd docs/sphinx/
196-
sphinx-build -j auto -b html -d _build/doctrees source build
197-
displayName: Build HTML docs
27+
- template: ci/azure/conda_windows.yml
28+
parameters:
29+
name: Test_conda_windows
30+
vmImage: vs2017-win2016
19831

19932

20033
- job: 'Publish'

ci/azure/conda_linux.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
parameters:
2+
name: ''
3+
vmImage: ''
4+
5+
jobs:
6+
- job: ${{ parameters.name }}
7+
pool:
8+
vmImage: ${{ parameters.vmImage }}
9+
strategy:
10+
matrix:
11+
Python35:
12+
python.version: '35'
13+
Python36:
14+
python.version: '36'
15+
coverage: true
16+
Python37:
17+
python.version: '37'
18+
Python38:
19+
python.version: '38'
20+
21+
steps:
22+
- bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin"
23+
displayName: Add conda to PATH
24+
- script: conda env create --quiet --file ci/requirements-py$(python.version).yml
25+
displayName: Create Anaconda environment
26+
- script: |
27+
source activate test_env
28+
pip install pytest-azurepipelines
29+
pip install -e .
30+
displayName: 'pip dependencies'
31+
- script: |
32+
source activate test_env
33+
conda list
34+
displayName: 'List installed dependencies'
35+
- script: |
36+
source activate test_env
37+
export NREL_API_KEY=$(nrelApiKey)
38+
pytest pvlib --remote-data --junitxml=junit/test-results.xml --cov --cov-report=xml --cov-report=html
39+
displayName: 'pytest'
40+
- task: PublishTestResults@2
41+
inputs:
42+
testResultsFiles: '**/test-results.xml'
43+
testRunTitle: 'Linux $(python.version)'
44+
- task: PublishCodeCoverageResults@1
45+
inputs:
46+
codeCoverageTool: Cobertura
47+
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
48+
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
49+
condition: eq(variables['coverage'], true)
50+
- script: |
51+
bash <(curl https://codecov.io/bash) -t bbc2bdbe-5e67-4fef-9cb7-f52fe0b703a8 -f coverage.xml -F adder -F subtractor -F conda
52+
displayName: 'codecov'
53+
condition: eq(variables['coverage'], true)

ci/azure/conda_windows.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
parameters:
2+
name: ''
3+
vmImage: ''
4+
5+
jobs:
6+
- job: ${{ parameters.name }}
7+
pool:
8+
vmImage: ${{ parameters.vmImage }}
9+
strategy:
10+
matrix:
11+
Python35-windows:
12+
python.version: '35'
13+
Python36-windows:
14+
python.version: '36'
15+
Python37-windows:
16+
python.version: '37'
17+
Python38-windows:
18+
python.version: '38'
19+
20+
steps:
21+
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
22+
displayName: Add conda to PATH
23+
- script: conda env create --quiet --file ci/requirements-py$(python.version).yml
24+
displayName: Create Anaconda environment
25+
- script: |
26+
call activate test_env
27+
pip install pytest-azurepipelines
28+
pip install -e .
29+
displayName: 'pip dependencies'
30+
- script: |
31+
call activate test_env
32+
conda list
33+
displayName: 'List installed dependencies'
34+
- script: |
35+
call activate test_env
36+
pytest pvlib --junitxml=junit/test-results.xml
37+
displayName: 'pytest'
38+
- task: PublishTestResults@2
39+
inputs:
40+
testResultsFiles: '**/test-results.xml'
41+
testRunTitle: 'Windows $(python.version)'

ci/azure/posix.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
parameters:
2+
name: ''
3+
vmImage: ''
4+
5+
jobs:
6+
- job: ${{ parameters.name }}
7+
pool:
8+
vmImage: ${{ parameters.vmImage }}
9+
strategy:
10+
matrix:
11+
Python35:
12+
python.version: '3.5'
13+
Python36:
14+
python.version: '3.6'
15+
Python37:
16+
python.version: '3.7'
17+
Python38:
18+
python.version: '3.8'
19+
20+
steps:
21+
- task: UsePythonVersion@0
22+
inputs:
23+
versionSpec: '$(python.version)'
24+
25+
- script: |
26+
pip install pytest pytest-cov pytest-mock pytest-timeout pytest-azurepipelines pytest-rerunfailures pytest-remotedata
27+
pip install -e .
28+
pytest pvlib --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
29+
displayName: 'Test with pytest'
30+
31+
- task: PublishTestResults@2
32+
condition: succeededOrFailed()
33+
inputs:
34+
testResultsFiles: '**/test-*.xml'
35+
testRunTitle: 'Publish test results for Python $(python.version)'
36+
37+
- task: PublishCodeCoverageResults@1
38+
inputs:
39+
codeCoverageTool: Cobertura
40+
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
41+
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'

docs/sphinx/source/whatsnew/v0.7.2.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Testing
5858
* Implement the `pytest.mark.flaky` decorator from `pytest-rurunfailures`
5959
`<https://github.com/pytest-dev/pytest-rerunfailures>`_ on all network
6060
dependent iotools tests to repeat them on failure. (:pull:`919`)
61+
* Separate azure-pipelines.yml platform-specific tests to their own templates
62+
located in ``./ci/azure/``. (:pull:`926`)
6163

6264
Documentation
6365
~~~~~~~~~~~~~

0 commit comments

Comments
 (0)