-
Notifications
You must be signed in to change notification settings - Fork 51
/
azure-pipelines.yml
94 lines (92 loc) · 3.38 KB
/
azure-pipelines.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
jobs:
- job: Test
strategy:
matrix:
linux_python36:
VM_IMAGE: ubuntu-16.04
PYTHON_VERSION: '3.6'
linux_python37:
VM_IMAGE: ubuntu-16.04
PYTHON_VERSION: '3.7'
mac_python36:
VM_IMAGE: macOS-10.13
PYTHON_VERSION: '3.6'
mac_python37:
VM_IMAGE: macOS-10.13
PYTHON_VERSION: '3.7'
win_python36:
VM_IMAGE: vs2017-win2016
PYTHON_VERSION: '3.6'
win_python37:
VM_IMAGE: vs2017-win2016
PYTHON_VERSION: '3.7'
maxParallel: 4
pool:
vmImage: $(VM_IMAGE)
steps:
- bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin"
condition: eq( variables['Agent.OS'], 'Linux' )
displayName: Add conda to PATH (Linux)
- bash: echo "##vso[task.prependpath]$CONDA/bin"
condition: eq( variables['Agent.OS'], 'Darwin' )
displayName: Add conda to PATH (Mac)
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Add conda to PATH (Windows)
- script: conda env create --quiet --name molvs python=$(PYTHON_VERSION)
displayName: Create conda environment
- script: conda env update --quiet --name molvs --file environment.yml
displayName: Install dependencies
- bash: |
source activate molvs
python -m pip install . --no-deps
pytest --junitxml=result.xml
displayName: Run tests (Linux/Mac)
condition: ne( variables['Agent.OS'], 'Windows_NT' )
- script: |
call activate molvs
python -m pip install . --no-deps
pytest --junitxml=result.xml
displayName: Run tests (Windows)
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- task: PublishTestResults@2
inputs:
testResultsFiles: result.xml
testRunTitle: Python $(PYTHON_VERSION) ($(VM_IMAGE))
condition: succeededOrFailed()
- job: Package
dependsOn: Test
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/')))
pool:
vmImage: ubuntu-16.04
steps:
- bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin"
displayName: Add conda to PATH (Linux)
- script: conda env create --quiet --name molvs --file environment.yml
displayName: Create conda environment
- script: |
source activate molvs
python setup.py sdist bdist_wheel --universal
displayName: Build sdist and wheel
- task: PublishPipelineArtifact@0
inputs:
artifactName: molvs-$(Build.BuildNumber)
targetPath: dist
displayName: Publish dist artifact
- job: PyPI
dependsOn: Package
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
pool:
vmImage: ubuntu-16.04
steps:
- task: DownloadPipelineArtifact@0
inputs:
artifactName: molvs-$(Build.BuildNumber)
targetPath: dist
displayName: Download dist artifact
- task: TwineAuthenticate@0
inputs:
externalFeeds: pypi
displayName: Authenticate with PyPI
- script: twine upload -r pypi --config-file $PYPIRC_PATH dist/*
displayName: Upload to PyPI