This repository has been archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
98 lines (87 loc) · 3.06 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
# Azure Pipelines config
jobs:
- job: test
strategy:
matrix:
linux_39:
image_name: ubuntu-latest
python_version: '3.9'
tox_env: py39
linux_38:
image_name: ubuntu-latest
python_version: '3.8'
tox_env: py38
linux_37:
image_name: ubuntu-latest
python_version: '3.7'
tox_env: py37
mac:
image_name: macOS-latest
python_version: '3.8'
tox_env: py38
# Tests currently fail on windows
# See https://github.com/stencila/pyla/issues/2
# windows:
# image_name: windows-latest
# python_version: 3.8
# tox_env: py38
pool:
vmImage: $(image_name)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(python_version)
displayName: 'Install Python $(python_version)'
- script: pip3 install -r requirements-dev.txt
displayName: 'Install dev dependencies'
- script: tox -e $(tox_env)
displayName: 'Run tests'
- script: make build
displayName: 'Build package'
# Only do these platform independent tasks on Linux and only
# if succeeded so far
- script: make lint
# pylint currently fails under Python 3.9. See https://github.com/PyCQA/pylint/issues/3882
condition: and(succeeded(), eq(variables['agent.os'], 'Linux'), not(eq(variables['python_version'], '3.9')))
displayName: 'Linting'
- script: make docs
condition: and(succeeded(), eq(variables['agent.os'], 'Linux'))
displayName: 'Build docs'
- script: bash <(curl -s https://codecov.io/bash)
condition: and(succeeded(), eq(variables['agent.os'], 'Linux'))
displayName: 'Upload coverage'
- job: release
dependsOn: test
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
pool:
vmImage: ubuntu-latest
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: 3.8
displayName: 'Install Python'
- script: |
# Install dev dependencies
pip3 install -r requirements-dev.txt
# Publish package (if necessary)
git config user.name "Stencila CI Bot"
git config user.email "[email protected]"
semantic-release publish
# Publish docs
# Sphinx autodoc needs to have prod deps
# (e.g. stencila.schema) also installed
python3 setup.py develop
make docs
git checkout -b gh-pages
ls -a | grep -v 'docs\|\.git' | xargs rm -rf
cp -r docs/_build/. .
rm -rf docs
git add -A
git commit -m "docs(*): Update published docs"
git remote add origin-pages https://$(GH_TOKEN)@github.com/stencila/pyla.git > /dev/null 2>&1
git push --force --set-upstream origin-pages gh-pages
env:
GH_TOKEN: $(GH_TOKEN)
PYPI_USERNAME: stencila
PYPI_PASSWORD: $(PYPI_PASSWORD)
displayName: 'Release package'