-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
config.yml
202 lines (178 loc) · 5.9 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
# See: https://circleci.com/blog/deploying-documentation-to-github-pages-with-continuous-integration/
version: 2.1
# document commands used by downstream jobs
commands:
check-skip:
steps:
- run:
name: Check-skip
command: |
if [ ! -d "treeple" ]; 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
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/treeple.git;
git pull --ff-only upstream "refs/pull/$(cat merge.txt)/merge";
git fetch upstream main;
fi
jobs:
# Build treeple from source
build_treeple:
docker:
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/doc/2.0/circleci-images/
- image: cimg/python:3.9
steps:
- checkout
- check-skip
- merge
- apt-install
- restore_cache:
keys:
- deps_ccache-{{ .Branch }}
- deps_ccache
- run:
name: setup Python venv
command: |
pip install --upgrade pip spin
spin setup-submodule
pip install .[build,doc]
pip install --pre --extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple scikit-learn --force
- run:
name: build treeple
command: |
spin build -j2
- save_cache:
key: deps_ccache-{{ .Branch }}
paths:
- ~/.ccache
- ~/.cache/pip
- run:
name: ccache performance
command: |
ccache -s
# persist, so downstream tasks can use the built image
- persist_to_workspace:
root: ~/
paths:
- .
build_docs:
docker:
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/doc/2.0/circleci-images/
- image: cimg/python:3.9
steps:
- attach_workspace:
at: ~/
- check-skip
- apt-install
- run:
name: build docs
no_output_timeout: 25m
command: |
ls
ls build
ls build-install
echo "After..."
ls build-install/**
export PYTHONPATH=$PWD/build-install/usr/lib/python3.9/site-packages
./spin docs
- 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
docs-deploy:
docker:
- image: node:8
steps:
- checkout
- attach_workspace:
at: doc/_build
- restore_cache:
keys:
- website-cache
- run:
name: Install and configure dependencies
command: |
npm install --global gh-pages@3.0
git config --global user.email "circle@treeple.com"
git config --global user.name "Circle Ci"
- add_ssh_keys:
fingerprints:
- "57:39:99:f3:09:80:6a:70:ca:c0:2a:06:14:16:ce:60"
- run:
# push built docs into the `dev` directory on the `gh-pages` branch
name: Deploy docs to gh-pages branch
command: |
if [ "${CIRCLE_BRANCH}" == "main" ]; then
echo "Deploying dev docs for ${CIRCLE_BRANCH}.";
gh-pages --dotfiles --message "docs updates [skip ci] (${CIRCLE_BUILD_NUM})" --dist doc/_build/html --dest ./dev
else
echo "Deploying stable docs for ${CIRCLE_BRANCH}.";
gh-pages --dotfiles --message "docs updates [skip ci] (${CIRCLE_BUILD_NUM})" --dist doc/_build/html --dest ./stable
fi;
- save_cache:
key: website-cache
paths:
- ~/treeple
workflows:
build-docs:
jobs:
- build_treeple
- build_docs:
requires:
- build_treeple
- docs-deploy:
requires:
- build_docs
filters:
branches:
only: main