|
| 1 | +jobs: |
| 2 | +- job: |
| 3 | + displayName: linux |
| 4 | + pool: |
| 5 | + vmImage: 'ubuntu-16.04' |
| 6 | + strategy: |
| 7 | + matrix: |
| 8 | + Python36: |
| 9 | + python.version: '3.6' |
| 10 | + Python37: |
| 11 | + python.version: '3.7' |
| 12 | + Python38: |
| 13 | + python.version: '3.8' |
| 14 | + |
| 15 | + steps: |
| 16 | + - bash: echo "##vso[task.prependpath]$CONDA/bin" |
| 17 | + displayName: Add conda to PATH |
| 18 | + |
| 19 | + - bash: | |
| 20 | + conda config --add channels conda-forge |
| 21 | + conda config --set channel_priority strict |
| 22 | + conda create --yes --quiet --name build python=$PYTHON_VERSION conda conda-build |
| 23 | + displayName: Create Anaconda build environment |
| 24 | +
|
| 25 | + - bash: | |
| 26 | + eval "$(conda shell.bash hook)" |
| 27 | + conda activate build |
| 28 | + conda build -m "ci/python${PYTHON_VERSION}.yaml" "recipe" |
| 29 | + displayName: Build geometric_features |
| 30 | +
|
| 31 | + - bash: | |
| 32 | + eval "$(conda shell.bash hook)" |
| 33 | + conda create --yes --quiet --name test --use-local python=$PYTHON_VERSION \ |
| 34 | + geometric_features pytest |
| 35 | + displayName: Create Anaconda test environment |
| 36 | +
|
| 37 | + - bash: | |
| 38 | + eval "$(conda shell.bash hook)" |
| 39 | + conda activate test |
| 40 | + pytest --pyargs geometric_features |
| 41 | + displayName: pytest |
| 42 | +
|
| 43 | + - bash: | |
| 44 | + eval "$(conda shell.bash hook)" |
| 45 | + conda create --yes --quiet --name docs --use-local python=$PYTHON_VERSION \ |
| 46 | + geometric_features sphinx mock sphinx_rtd_theme m2r |
| 47 | + condition: eq(variables['python.version'], '3.8') |
| 48 | + displayName: Create Anaconda docs environment |
| 49 | +
|
| 50 | + - bash: | |
| 51 | + eval "$(conda shell.bash hook)" |
| 52 | + conda activate docs |
| 53 | +
|
| 54 | + echo "source branch: $(Build.SourceBranch)" |
| 55 | + echo "target branch: $(System.PullRequest.TargetBranch)" |
| 56 | + echo "repository: $(Build.Repository.Name)" |
| 57 | +
|
| 58 | + tag=$(git describe --tags $(git rev-list --tags --max-count=1)) |
| 59 | + echo "tag: $tag" |
| 60 | +
|
| 61 | + version=`python -c "import geometric_features; print(geometric_features.__version__)"` |
| 62 | + echo "version: $version" |
| 63 | +
|
| 64 | + REPO_PATH=$PWD |
| 65 | +
|
| 66 | + if [[ "$(Build.SourceBranch)" == "refs/heads/master" ]]; then |
| 67 | + export DOCS_VERSION="stable" |
| 68 | + deploy=True |
| 69 | + elif [[ "$(Build.SourceBranch)" == refs/tags/* ]]; then |
| 70 | + # this is a tag build |
| 71 | + export DOCS_VERSION="$tag" |
| 72 | + deploy=True |
| 73 | + else |
| 74 | + DOCS_VERSION="$version" |
| 75 | + export DOCS_VERSION |
| 76 | + deploy=False |
| 77 | + fi |
| 78 | + echo "Docs version: $DOCS_VERSION" |
| 79 | + echo "Deploy to gh-pages? $deploy" |
| 80 | + cd docs || exit 1 |
| 81 | + make html |
| 82 | +
|
| 83 | + cd "$REPO_PATH" || exit 1 |
| 84 | +
|
| 85 | + if [[ "$deploy" == "True" ]]; then |
| 86 | + PUBLICATION_BRANCH=gh-pages |
| 87 | + # Checkout the branch |
| 88 | + pushd $HOME || exit 1 |
| 89 | + git clone --branch=$PUBLICATION_BRANCH https://$(GitHubToken)@github.com/$(Build.Repository.Name) publish |
| 90 | + cd publish || exit 1 |
| 91 | +
|
| 92 | + # Update pages |
| 93 | + if [[ -d "$DOCS_VERSION" ]]; then |
| 94 | + git rm -rf "$DOCS_VERSION" > /dev/null |
| 95 | + fi |
| 96 | + mkdir "$DOCS_VERSION" |
| 97 | + cp -r "$REPO_PATH"/docs/_build/html/* "$DOCS_VERSION" |
| 98 | + # Commit and push latest version |
| 99 | + git add . |
| 100 | + if git diff-index --quiet HEAD; then |
| 101 | + echo "No changes in the docs." |
| 102 | + else |
| 103 | + git config --local user.name "Azure Pipelines" |
| 104 | + git config --local user.email "[email protected]" |
| 105 | + git commit -m "[skip ci] Update $DOCS_VERSION" |
| 106 | + git push -fq origin $PUBLICATION_BRANCH |
| 107 | + fi |
| 108 | + popd || exit 1 |
| 109 | + fi |
| 110 | + condition: eq(variables['python.version'], '3.8') |
| 111 | + displayName: build and deploy docs |
| 112 | +
|
| 113 | +- job: |
| 114 | + displayName: osx |
| 115 | + pool: |
| 116 | + vmImage: 'macOS-10.14' |
| 117 | + strategy: |
| 118 | + matrix: |
| 119 | + Python36: |
| 120 | + python.version: '3.6' |
| 121 | + Python37: |
| 122 | + python.version: '3.7' |
| 123 | + Python38: |
| 124 | + python.version: '3.8' |
| 125 | + |
| 126 | + steps: |
| 127 | + - bash: echo "##vso[task.prependpath]$CONDA/bin" |
| 128 | + displayName: Add conda to PATH |
| 129 | + |
| 130 | + - bash: | |
| 131 | + conda config --add channels conda-forge |
| 132 | + conda config --set channel_priority strict |
| 133 | + conda create --yes --quiet --name build python=$PYTHON_VERSION conda conda-build |
| 134 | + displayName: Create Anaconda build environment |
| 135 | +
|
| 136 | + - bash: | |
| 137 | + eval "$(conda shell.bash hook)" |
| 138 | + conda activate build |
| 139 | + conda build -m "ci/python${PYTHON_VERSION}.yaml" "recipe" |
| 140 | + displayName: Build geometric_features |
| 141 | +
|
| 142 | + - bash: | |
| 143 | + eval "$(conda shell.bash hook)" |
| 144 | + conda create --yes --quiet --name test --use-local python=$PYTHON_VERSION \ |
| 145 | + geometric_features pytest |
| 146 | + displayName: Create Anaconda test environment |
| 147 | +
|
| 148 | + - bash: | |
| 149 | + eval "$(conda shell.bash hook)" |
| 150 | + conda activate test |
| 151 | + pytest --pyargs geometric_features |
| 152 | + displayName: pytest |
| 153 | +
|
0 commit comments