forked from mosdef-hub/gmso
-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
134 lines (119 loc) · 4.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
trigger:
branches:
include:
- master
tags:
include:
- 0.*
pr:
autoCancel: true
branches:
include:
- master
schedules:
- cron: "0 0 * * *"
displayName: Daily midnight build for master
branches:
include:
- master
always: true
stages:
- stage: Test
jobs:
- job: TestsForGMSO
strategy:
matrix:
Python37Ubuntu:
imageName: 'ubuntu-latest'
python.version: 3.7
Python38Ubuntu:
imageName: 'ubuntu-latest'
python.version: 3.8
Python39Ubuntu:
imageName: 'ubuntu-latest'
python.version: 3.9
Python37macOS:
imageName: 'macOS-latest'
python.version: 3.7
Python38macOS:
imageName: 'macOS-latest'
python.version: 3.8
Python39macOS:
imageName: 'macOS-latest'
python.version: 3.9
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 configuration
- bash: |
conda install -y -c conda-forge mamba
displayName: Install mamba
- bash: |
mamba update conda -yq
displayName: Add relevant channels and update
- bash: |
sed -i -E 's/python.*$/python='$(python.version)'/' environment-dev.yml
mamba env create -f environment-dev.yml
source activate gmso-dev
pip install -e .
displayName: Install requirements and testing branch
- bash: |
source activate gmso-dev
pip install pytest-azurepipelines
python -m pytest -v --cov=gmso --cov-report=html --color=yes --pyargs gmso --no-coverage-upload
displayName: Run tests
- bash: |
source activate gmso-dev
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${CODECOV_UPLOAD_TOKEN} -C $(Build.SourceVersion)
condition: and( eq( variables['Agent.OS'], 'Linux' ), eq( variables['python.version'], '3.7' ) )
displayName: Upload coverage report to codecov.io
env:
CODECOV_UPLOAD_TOKEN: $(codecovUploadToken)
- 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 to Azure dashboard
- 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/gmso
tags: |
$(DOCKER_TAG)
$(VERSION)
- task: Docker@2
displayName: Logout
inputs:
command: logout
containerRegistry: mosdefDockerLogin