forked from mosdef-hub/mbuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
200 lines (172 loc) · 6.39 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
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
trigger:
branches:
include:
- master
tags:
include:
- 0.*
pr:
autoCancel: true
branches:
include:
- master
paths:
exclude:
- docs
schedules:
- cron: "0 0 * * *"
displayName: Daily midnight build for master
branches:
include:
- master
always: true
stages:
- stage: Test
jobs:
- job: NoBleeding
strategy:
matrix:
Python36Ubuntu:
imageName: 'ubuntu-latest'
python.version: 3.6
Python37Ubuntu:
imageName: 'ubuntu-latest'
python.version: 3.7
Python38Ubuntu:
imageName: 'ubuntu-latest'
python.version: 3.8
Python36macOS:
imageName: 'macOS-latest'
python.version: 3.6
Python37macOS:
imageName: 'macOS-latest'
python.version: 3.7
Python38macOS:
imageName: 'macOS-latest'
python.version: 3.8
pool:
vmImage: $(imageName)
steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add Conda to path
- bash: sudo chown -R $USER $CONDA
condition: eq( variables['Agent.OS'], 'Darwin' )
displayName: Take ownership of conda installation
- bash: |
conda config --set always_yes yes --set changeps1 no
displayName: Set conda config
- bash: |
conda update -c defaults conda
conda update --all
sed -i -E 's/python.*$/python='$(python.version)'/' environment-dev.yml
conda env create -f environment-dev.yml
source activate mbuild-dev
pip install -e .
displayName: Create Conda env, Activate, Install dependencies, Install Branch
- bash: |
source activate mbuild-dev
python -m pytest -v --cov=mbuild --cov-report=html --pyargs mbuild
displayName: Run Tests
- bash: |
source activate test-environment
bash <(curl -s https://codecov.io/bash) -C $(Build.SourceVersion)
condition: and( eq( variables['Agent.OS'], 'Linux' ), eq( variables['python.version'], '3.8' ) )
displayName: Upload Coverage Report
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
condition: and( eq( variables['Agent.OS'], 'Linux' ), eq( variables['python.version'], '3.7' ) )
displayName: Publish Coverage Report
- job: Windows_no_bleeding
pool:
vmImage: 'windows-latest'
strategy:
matrix:
Python36:
python.version: 3.6
Python37:
python.version: 3.7
Python38:
python.version: 3.8
steps:
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
displayName: Add Conda to path
- script: |
conda config --set always_yes yes --set changeps1 no
displayName: Add relavent channels
- script: |
conda update -c defaults conda
conda update conda -yq
sed -i -E 's/python.*$/python='$(python.version)'/' environment-win.yml
conda env create -f environment-win.yml
call activate mbuild-dev
displayName: Create Conda env, Activate, Install dependencies
- script: |
call activate mbuild-dev
python -m pip --version
python -m pip --verbose install -e .
displayName: Install mBuild
- script: |
call activate mbuild-dev
python -m pytest -v --cov=mbuild --cov-report=html --pyargs mbuild
displayName: Run Tests
- job: LinuxBleedingFoyer
pool:
vmImage: 'ubuntu-latest'
steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add Conda to path
- bash: |
conda config --set always_yes yes --set changeps1 no
conda update -c defaults conda
conda update --all
pip install conda-merge
git clone https://github.com/mosdef-hub/foyer.git
conda-merge environment-dev.yml foyer/environment-dev.yml > combine.yml
sed -iE 's/python.*$/python=3.7/' combine.yml
sed -iE '/mbuild/d' combine.yml
sed -iE '/ foyer/d' combine.yml
conda env create -n bleeding -f combine.yml
source activate bleeding
pip install -e .
cd foyer
pip install -e .
displayName: Create a new bleeding test environment
- bash: |
source activate bleeding
python -m pytest -v --cov=mbuild --cov-report=html --pyargs mbuild
displayName: Run Tests
- stage: Docker
dependsOn: Test
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/0')), ne(variables['Build.Reason'], 'Schedule'))
pool:
vmImage: 'ubuntu-latest'
jobs:
- job: publishDocker
steps:
- bash: |
if [[ $BUILD_SOURCEBRANCH == "refs/heads/master" ]]; then TAG='latest'; else TAG='stable'; fi
if [[ $BUILD_SOURCEBRANCH != "refs/heads/master" ]]; then VERSION=$(Build.SourceBranch); fi;
echo "##vso[task.setvariable variable=VERSION;]${VERSION:10}"
echo "##vso[task.setvariable variable=DOCKER_TAG;]$TAG"
displayName: Export Docker Tags
- task: Docker@2
displayName: Login to docker hub
inputs:
command: login
containerRegistry: mosdefDockerLogin
- task: Docker@2
displayName: Build and Push
inputs:
command: buildAndPush
repository: mosdef/mbuild
tags: |
$(DOCKER_TAG)
$(VERSION)
- task: Docker@2
displayName: Logout
inputs:
command: logout
containerRegistry: mosdefDockerLogin