forked from py-why/dodiscover
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
264 lines (257 loc) · 8.82 KB
/
config.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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
version: 2.1
jobs:
build_doc:
docker:
- image: cimg/base:stable-20.04
steps:
- restore_cache:
name: Restore .git
keys:
- source-cache-graphs
- checkout
- run:
name: Complete checkout
command: |
if ! git remote -v | grep upstream; then
git remote add upstream https://github.com/py-why/dodiscover.git
fi
git remote set-url upstream https://github.com/py-why/dodiscover.git
git fetch upstream
- save_cache:
name: Save .git
key: source-cache-graphs
paths:
- ".git"
- run:
name: Check-skip
command: |
set -e
export COMMIT_MESSAGE=$(git log --format=oneline -n 1);
if [[ -v CIRCLE_PULL_REQUEST ]] && ([[ "$COMMIT_MESSAGE" == *"[skip circle]"* ]] || [[ "$COMMIT_MESSAGE" == *"[circle skip]"* ]]); then
echo "Skip detected, exiting job ${CIRCLE_JOB} for PR ${CIRCLE_PULL_REQUEST}."
circleci-agent step halt;
fi
- run:
name: Merge with upstream
command: |
echo $(git log -1 --pretty=%B) | tee gitlog.txt
echo ${CI_PULL_REQUEST//*pull\//} | tee merge.txt
if [[ $(cat merge.txt) != "" ]]; then
echo "Merging $(cat merge.txt)";
git pull --ff-only upstream "refs/pull/$(cat merge.txt)/merge";
fi
- run:
name: Set BASH_ENV
command: |
set -e
sudo apt install -qq graphviz optipng python3.8-venv python3-venv libxft2
python3.8 -m venv ~/python_env
echo "set -e" >> $BASH_ENV
echo "export OPENBLAS_NUM_THREADS=4" >> $BASH_ENV
echo "export XDG_RUNTIME_DIR=/tmp/runtime-circleci" >> $BASH_ENV
echo "export PATH=~/.local/bin/:$PATH" >> $BASH_ENV
echo "export DISPLAY=:99" >> $BASH_ENV
echo "source ~/python_env/bin/activate" >> $BASH_ENV
mkdir -p ~/.local/bin
ln -s ~/python_env/bin/python ~/.local/bin/python
echo "BASH_ENV:"
cat $BASH_ENV
- run:
name: Setup pandoc
command: sudo apt update && sudo apt install -y pandoc optipng
- restore_cache:
name: Restore pip cache
keys:
- pip-cache
- restore_cache:
name: Restore install-bin-cache
keys:
- user-install-bin-cache
- run:
name: Get Python running and install dependencies
command: |
python -m pip install --progress-bar off --upgrade pip setuptools wheel
python -m pip install --progress-bar off .
python -m pip install --progress-bar off .[doc,gui]
python -m pip install --progress-bar off git+https://github.com/py-why/dodiscover
- save_cache:
name: Save pip cache
key: pip-cache
paths:
- ~/.cache/pip
- save_cache:
name: Save install-bin-cache
key: user-install-bin-cache
paths:
- ~/.local/lib/python3.8/site-packages
- ~/.local/bin
- run:
name: Check pip package versions
command: pip freeze
- run:
name: Check installation
command: |
LIBGL_DEBUG=verbose python -c "import matplotlib.pyplot as plt; plt.figure()"
python -c "import dodiscover;"
python -c "import numpy; numpy.show_config()"
- run:
name: Build documentation
command: |
cd doc
make html
# Save the example test results
- store_test_results:
path: doc/_build/test-results
- store_artifacts:
path: doc/_build/test-results
destination: test-results
# Save the SG RST
- store_artifacts:
path: doc/auto_examples.zip
- store_artifacts:
path: doc/generated.zip
# Save the outputs
- store_artifacts:
path: doc/_build/html/
destination: dev
- store_artifacts:
path: doc/_build/html_stable/
destination: stable
- persist_to_workspace:
root: doc/_build
paths:
- html
- html_stable
linkcheck:
parameters:
scheduled:
type: string
default: "false"
docker:
- image: cimg/python:3.9.2
steps:
- restore_cache:
keys:
- source-cache-graphs
- checkout
- run:
name: Check-skip
command: |
export COMMIT_MESSAGE=$(git log --format=oneline -n 1);
if [[ "$COMMIT_MESSAGE" != *"[circle linkcheck]"* ]] && [ "<< parameters.scheduled >>" != "true" ]; then
echo "Skip detected, exiting job ${CIRCLE_JOB}."
circleci-agent step halt;
fi
- run:
name: Set BASH_ENV
command: |
set -e
echo "set -e" >> $BASH_ENV
echo "export PATH=~/.local/bin/:$PATH" >> $BASH_ENV
- restore_cache:
keys:
- pip-cache
- run:
name: Get Python running
command: |
python -m pip install --progress-bar off --upgrade pip setuptools wheel
python -m pip install --progress-bar off .[doc]
- run:
name: make linkcheck
command: |
make -C doc linkcheck
- run:
name: make linkcheck-grep
when: always
command: |
make -C doc linkcheck-grep
- store_artifacts:
path: doc/_build/linkcheck
destination: linkcheck
deploy:
docker:
- image: cimg/node:lts
steps:
- checkout
- attach_workspace:
at: doc/_build
- run:
name: Set BASH_ENV
command: |
set -e
echo "set -e" >> $BASH_ENV
# Don't try to deploy if nothing is there or not on the right branch
- run:
name: Check docs
command: |
if [ ! -f doc/_build/html/index.html ] && [ ! -f doc/_build/html_stable/index.html ]; then
echo "No files found to upload (build: ${CIRCLE_BRANCH}).";
circleci-agent step halt;
fi;
- run:
name: Install and configure dependencies
# do not update gh-pages above 3.0.0
# see: https://github.com/tschaub/gh-pages/issues/354
command: |
npm install gh-pages@3.0
git config --global user.email "circle@pywhy.com"
git config --global user.name "Circle Ci"
- add_ssh_keys:
fingerprints:
- "b5:1e:a1:6d:8d:48:f2:8f:dd:bd:2d:66:a9:30:fe:b9"
- run:
# push built doc into the `dev` directory on the `gh-pages` branch
name: Deploy doc to gh-pages branch
command: |
if [ "${CIRCLE_BRANCH}" == "main" ]; then
echo "Deploying dev doc for ${CIRCLE_BRANCH}.";
node_modules/gh-pages/bin/gh-pages.js --dotfiles --message "doc updates [skip ci]" --dist doc/_build/html --dest ./dev
else
echo "Deploying stable doc for ${CIRCLE_BRANCH}.";
node_modules/gh-pages/bin/gh-pages.js --dotfiles --message "doc updates [skip ci]" --dist doc/_build/html_stable --dest ./stable
fi;
workflows:
default:
jobs:
- build_doc:
name: build_doc
- linkcheck:
name: linkcheck
- deploy:
requires:
- build_doc
filters:
branches:
only:
- main
- maint/0.2
main:
jobs:
- build_doc:
name: build_doc_main
- deploy:
name: deploy_main
requires:
- build_doc_main
triggers:
- schedule:
# "At 00:00" (once a day) should be enough "0 0 * * *",
# But for testing at first, let's do once an hour (6 AM GMT)
cron: "0 6 * * *"
filters:
branches:
only:
- main
weekly:
jobs:
- linkcheck:
name: linkcheck_weekly
scheduled: "true"
triggers:
- schedule:
# "At 00:00 on Sunday" should be often enough
cron: "0 0 * * 0"
filters:
branches:
only:
- main