forked from MPAS-Dev/MPAS-Analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
218 lines (186 loc) · 6.01 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
trigger:
branches:
include:
- master
- develop
tags:
include:
- '*'
pr:
branches:
include:
- master
- develop
jobs:
- job:
displayName: linux
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'
steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH
- bash: |
conda config --add channels conda-forge
conda config --set channel_priority strict
conda create --yes --quiet --name build python=$PYTHON_VERSION conda conda-build
displayName: Create Anaconda build environment
- bash: |
eval "$(conda shell.bash hook)"
conda activate build
conda build -m "ci/python${PYTHON_VERSION}.yaml" "ci/recipe"
displayName: Build MPAS-Analysis
- bash: |
eval "$(conda shell.bash hook)"
conda activate build
conda create --yes --quiet --name test -c ${CONDA_PREFIX}/conda-bld/ \
python=$PYTHON_VERSION mpas-analysis pytest
displayName: Create Anaconda test environment
- bash: |
eval "$(conda shell.bash hook)"
conda activate test
pytest --pyargs mpas_analysis
displayName: pytest
- bash: |
eval "$(conda shell.bash hook)"
conda activate build
conda create --yes --quiet --name docs -c ${CONDA_PREFIX}/conda-bld/ \
python=$PYTHON_VERSION mpas-analysis sphinx mock sphinx_rtd_theme \
tabulate m2r2 "mistune<2"
condition: eq(variables['python.version'], '3.9')
displayName: Create Anaconda docs environment
- bash: |
eval "$(conda shell.bash hook)"
conda activate docs
echo "source branch: $(Build.SourceBranch)"
echo "repository: $(Build.Repository.Name)"
tag=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "tag: $tag"
version=`python -c "import mpas_analysis; print(mpas_analysis.__version__)"`
echo "version: $version"
REPO_PATH=$PWD
if [[ "$(Build.SourceBranch)" == "refs/heads/develop" ]]; then
export DOCS_VERSION="latest"
deploy=True
elif [[ "$(Build.SourceBranch)" == "refs/heads/master" ]]; then
export DOCS_VERSION="stable"
deploy=True
elif [[ "$(Build.SourceBranch)" == refs/tags/* ]]; then
# this is a tag build
export DOCS_VERSION="$tag"
deploy=True
else
DOCS_VERSION="$version"
export DOCS_VERSION
deploy=False
fi
echo "Docs version: $DOCS_VERSION"
echo "Deploy to gh-pages? $deploy"
cd docs || exit 1
make html
cd "$REPO_PATH" || exit 1
if [[ "$deploy" == "True" ]]; then
PUBLICATION_BRANCH=gh-pages
# Checkout the branch
pushd $HOME || exit 1
git clone --branch=$PUBLICATION_BRANCH https://$(GitHubToken)@github.com/$(Build.Repository.Name) publish
cd publish || exit 1
# Update pages
if [[ -d "$DOCS_VERSION" ]]; then
git rm -rf "$DOCS_VERSION" > /dev/null
fi
mkdir "$DOCS_VERSION"
cp -r "$REPO_PATH"/docs/_build/html/* "$DOCS_VERSION"
# Commit and push latest version
git add .
if git diff-index --quiet HEAD; then
echo "No changes in the docs."
else
git config --local user.name "Azure Pipelines"
git config --local user.email "[email protected]"
git commit -m "[skip ci] Update $DOCS_VERSION"
git push -fq origin $PUBLICATION_BRANCH
fi
popd || exit 1
fi
condition: eq(variables['python.version'], '3.9')
displayName: build and deploy docs
- job:
displayName: xarray-master
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python39:
python.version: '3.9'
steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH
- bash: |
conda config --add channels conda-forge
conda config --set channel_priority strict
conda create --yes --quiet --name build python=$PYTHON_VERSION conda conda-build
displayName: Create Anaconda build environment
- bash: |
eval "$(conda shell.bash hook)"
conda activate build
conda build -m "ci/python${PYTHON_VERSION}.yaml" "ci/recipe"
displayName: Build MPAS-Analysis
- bash: |
eval "$(conda shell.bash hook)"
conda activate build
conda create --yes --quiet --name test -c ${CONDA_PREFIX}/conda-bld/ \
python=$PYTHON_VERSION mpas-analysis pytest
conda activate test
pip install git+https://github.com/pydata/xarray.git
displayName: Create Anaconda test environment
- bash: |
eval "$(conda shell.bash hook)"
conda activate test
pytest --pyargs mpas_analysis
displayName: pytest
- job:
displayName: osx
pool:
vmImage: 'macOS-latest'
strategy:
matrix:
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'
steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH
- bash: sudo chown -R 501:20 /usr/local/miniconda/pkgs
displayName: Fix permissions
- bash: |
conda config --add channels conda-forge
conda config --set channel_priority strict
conda create --yes --quiet --name build python=$PYTHON_VERSION conda conda-build
displayName: Create Anaconda build environment
- bash: |
eval "$(conda shell.bash hook)"
conda activate build
conda build -m "ci/python${PYTHON_VERSION}.yaml" "ci/recipe"
displayName: Build MPAS-Analysis
- bash: |
eval "$(conda shell.bash hook)"
conda activate build
conda create --yes --quiet --name test -c ${CONDA_PREFIX}/conda-bld/ \
python=$PYTHON_VERSION mpas-analysis pytest
displayName: Create Anaconda test environment
- bash: |
eval "$(conda shell.bash hook)"
conda activate test
pytest --pyargs mpas_analysis
displayName: pytest