forked from MPAS-Dev/geometric_features
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
116 lines (102 loc) · 3.42 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
jobs:
- job:
displayName: linux
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'
Python311:
python.version: '3.11'
steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH
- bash: |
set -e
eval "$(conda shell.bash hook)"
conda config --add channels conda-forge
conda config --set channel_priority strict
conda update --yes --all
conda install --yes mamba
# workaround based on recent failures
rm /usr/share/miniconda/pkgs/cache/*.json
mamba install --yes conda-build boa
displayName: Update conda base environment
- bash: |
set -e
eval "$(conda shell.bash hook)"
# workaround based on recent failures
rm /usr/share/miniconda/pkgs/cache/*.json
conda mambabuild -m "ci/python${PYTHON_VERSION}.yaml" "recipe"
displayName: Build geometric_features
- bash: |
set -e
eval "$(conda shell.bash hook)"
mamba create --yes --quiet --name test -c ${CONDA_PREFIX}/conda-bld/ \
python=$PYTHON_VERSION geometric_features pytest sphinx mock \
sphinx_rtd_theme m2r2
displayName: Create Anaconda test environment
- bash: |
set -e
eval "$(conda shell.bash hook)"
conda activate test
pytest --pyargs geometric_features
displayName: pytest
- bash: |
set -e
eval "$(conda shell.bash hook)"
conda activate test
echo "source branch: $(Build.SourceBranch)"
echo "target branch: $(System.PullRequest.TargetBranch)"
echo "repository: $(Build.Repository.Name)"
tag=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "tag: $tag"
version=`python -c "import geometric_features; print(geometric_features.__version__)"`
echo "version: $version"
REPO_PATH=$PWD
if [[ "$(Build.SourceBranch)" == "refs/heads/main" ]]; 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.10')
displayName: build and deploy docs