-
Notifications
You must be signed in to change notification settings - Fork 16
/
config.yml
222 lines (202 loc) · 6.95 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
version: 2.1
commands:
check-skip:
steps:
- run:
name: Check-skip
command: |
if [ ! -d "sktree" ]; then
echo "Build was not run due to skip, exiting job ${CIRCLE_JOB} for PR ${CIRCLE_PULL_REQUEST}."
circleci-agent step halt;
fi
export git_log=$(git log --max-count=1 --pretty=format:"%B" | tr "\n" " ")
echo "Got commit message:"
echo "${git_log}"
if [[ -v CIRCLE_PULL_REQUEST ]] && ([[ "$git_log" == *"[skip circle]"* ]] || [[ "$git_log" == *"[circle skip]"* ]]); then
echo "Skip detected, exiting job ${CIRCLE_JOB} for PR ${CIRCLE_PULL_REQUEST}."
circleci-agent step halt;
fi
apt-install:
steps:
- run:
name: Install apt packages
command: |
sudo apt-get update
sudo apt-get install libopenblas-dev gfortran libgmp-dev libmpfr-dev ccache
# make sure pandoc is on the system
sudo apt-get update && sudo apt-get install -y pandoc optipng
# install pysal dependencies
sudo apt install libspatialindex-dev xdg-utils
- run:
name: Set BASH_ENV
command: |
set -e
sudo apt update
sudo apt-get update
sudo apt install -qq graphviz optipng libxft2 graphviz-dev
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 'BASH_ENV:'
cat $BASH_ENV
- run:
name: Install fonts needed for diagrams
command: |
mkdir -p $HOME/.fonts
curl https://codeload.github.com/adobe-fonts/source-code-pro/tar.gz/2.038R-ro/1.058R-it/1.018R-VAR | tar xz -C $HOME/.fonts
curl https://codeload.github.com/adobe-fonts/source-sans-pro/tar.gz/3.028R | tar xz -C $HOME/.fonts
fc-cache -f
- run:
name: Install pysal dependencies
command: |
sudo apt install libspatialindex-dev xdg-utils shared-mime-info
- run:
name: Setup pandoc
command: sudo apt update && sudo apt install -y pandoc optipng
- run:
name: Setup torch
command: sudo apt-get install nvidia-cuda-toolkit nvidia-cuda-toolkit-gcc
merge:
steps:
- 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 remote add upstream https://github.com/neurodata/scikit-tree.git;
git pull --ff-only upstream "refs/pull/$(cat merge.txt)/merge";
git fetch upstream main;
fi
jobs:
build_doc:
docker:
- image: cimg/python:3.10
steps:
- checkout
- check-skip
- merge
- apt-install
- restore_cache:
name: Restore .git
keys:
- source-cache-graphs
- save_cache:
name: Save .git
key: source-cache-graphs
paths:
- ".git"
- run:
name: setup Python venv
command: |
pip install --upgrade pip
pip install .[build,doc]
- run:
name: Check installation
command: |
python -c "import pywhy_graphs;"
python -c "import dodiscover;"
python -c "import numpy; numpy.show_config()"
LIBGL_DEBUG=verbose python -c "import matplotlib.pyplot as plt; plt.figure()"
- run:
name: Build documentation
command: |
make -C doc html
no_output_timeout: 20m
# 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
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:
- "2d:4e:14:8e:32:00:68:e5:f9:dd:64:17:07:3e:2c:9e"
- 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
- deploy:
requires:
- build_doc
filters:
branches:
only:
- main
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