forked from simpeg/simpeg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
144 lines (132 loc) · 4.27 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
trigger:
branches:
include:
- 'main'
exclude:
- '*no-ci*'
tags:
include:
- '*'
pr:
branches:
include:
- '*'
exclude:
- '*no-ci*'
stages:
- stage: StyleChecks
displayName: "Style Checks"
jobs:
- job:
displayName: Run style checks with Black
pool:
vmImage: ubuntu-latest
variables:
python.version: '3.8'
steps:
- script: |
pip install -r requirements_style.txt
displayName: "Install dependencies to run the checks"
- script: make black
displayName: "Run black"
- job:
displayName: Run (permissive) style checks with flake8
pool:
vmImage: ubuntu-latest
variables:
python.version: '3.8'
steps:
- script: |
pip install -r requirements_style.txt
displayName: "Install dependencies to run the checks"
- script: make flake
displayName: "Run flake8"
- job:
displayName: Run style checks with flake8 (allowed to fail)
pool:
vmImage: ubuntu-latest
variables:
python.version: '3.8'
steps:
- script: |
pip install -r requirements_style.txt
displayName: "Install dependencies to run the checks"
- script: FLAKE8_OPTS="--exit-zero" make flake-all
displayName: "Run flake8"
- stage: Testing
dependsOn: StyleChecks
jobs:
- template: ./.azure-pipelines/matrix.yml
- stage: Deploy
dependsOn: Testing
condition: startsWith(variables['build.sourceBranch'], 'refs/tags/')
jobs:
- job:
displayName: Deploy Docs and source
pool:
vmImage: ubuntu-latest
variables:
python.version: '3.8'
timeoutInMinutes: 240
steps:
- script: |
git config --global user.name ${GH_NAME}
git config --global user.email ${GH_EMAIL}
git config --list | grep user.
displayName: 'Configure git'
env:
GH_NAME: $(gh.name)
GH_EMAIL: $(gh.email)
- script: |
wget -O Mambaforge.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
bash Mambaforge.sh -b -p "${HOME}/conda"
displayName: Install mamba
- script: |
source "${HOME}/conda/etc/profile.d/conda.sh"
source "${HOME}/conda/etc/profile.d/mamba.sh"
cp environment_test.yml environment_test_with_pyversion.yml
echo " - python="$(python.version) >> environment_test_with_pyversion.yml
mamba env create -f environment_test_with_pyversion.yml
rm environment_test_with_pyversion.yml
conda activate simpeg-test
pip install pytest-azurepipelines
displayName: Create Anaconda testing environment
- script: |
source "${HOME}/conda/etc/profile.d/conda.sh"
conda activate simpeg-test
pip install -e .
displayName: Build package
- script: |
source "${HOME}/conda/etc/profile.d/conda.sh"
conda activate simpeg-test
python setup.py sdist
twine upload --skip-existing dist/*
displayName: Deploy source
env:
TWINE_USERNAME: $(twine.username)
TWINE_PASSWORD: $(twine.password)
- script: |
source "${HOME}/conda/etc/profile.d/conda.sh"
conda activate simpeg-test
export KMP_WARNINGS=0
cd docs
make html
cd ..
displayName: Building documentation
# upload documentation to simpeg-docs gh-pages on tags
- script: |
git clone --depth 1 https://${GH_TOKEN}@github.com/simpeg/simpeg-docs.git
cd simpeg-docs
git gc --prune=now
git remote prune origin
rm -rf *
cp -r $BUILD_SOURCESDIRECTORY/docs/_build/html/* .
cp $BUILD_SOURCESDIRECTORY/docs/README.md .
touch .nojekyll
echo "docs.simpeg.xyz" >> CNAME
git add .
git commit -am "Azure CI commit ref $(Build.SourceVersion)"
git push
displayName: Push documentation to simpeg-docs
env:
GH_TOKEN: $(gh.token)