-
Notifications
You must be signed in to change notification settings - Fork 173
/
config.yml
201 lines (185 loc) · 7.7 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
# Tagging a commit with [circle front] will build the front page and perform test-doc.
# Tagging a commit with [circle full] will build everything.
version: 2
jobs:
build_docs:
docker:
- image: circleci/python:3.7-stretch
steps:
- checkout
- run:
name: Set BASH_ENV
command: |
echo "set -e" >> $BASH_ENV
echo "export DISPLAY=:99" >> $BASH_ENV
echo "export OPENBLAS_NUM_THREADS=4" >> $BASH_ENV
echo "BASH_ENV:"
cat $BASH_ENV
- 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 git://github.com/braindecode/braindecode.git;
git pull --ff-only upstream "refs/pull/$(cat merge.txt)/merge";
git fetch upstream master;
fi
# Load our data
- restore_cache:
keys:
- data-cache-0
- pip-cache
- run:
name: Spin up Xvfb
command: |
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render -noreset;
# https://github.com/ContinuumIO/anaconda-issues/issues/9190#issuecomment-386508136
# https://github.com/golemfactory/golem/issues/1019
- run:
name: Fix libgcc_s.so.1 pthread_cancel bug
command: |
sudo apt-get install qt5-default
- run:
name: Get Python running
command: |
python -m pip install --user --upgrade --progress-bar off pip
python -m pip install --user --upgrade --progress-bar off -r requirements.txt
python -m pip install --user --upgrade --progress-bar off torch
python -m pip install --user --upgrade --progress-bar off -r docs/requirements.txt
python -m pip install --user --upgrade --progress-bar off ipython "https://api.github.com/repos/sphinx-gallery/sphinx-gallery/zipball/master" memory_profiler
python -m pip install --user --upgrade --progress-bar off coloredlogs
python -m pip install --user --upgrade --progress-bar off pyyaml
python -m pip install --user --upgrade --progress-bar off git+https://github.com/NeuroTechX/moabb
python -m pip install --user -e .
- save_cache:
key: pip-cache
paths:
- ~/.cache/pip
# Look at what we have and fail early if there is some library conflict
- run:
name: Check installation
command: |
which python
python -c "import braindecode"
# Figure out if we should run a full, pattern, or noplot version
- run:
name: Get data
command: |
python setup.py develop --user
if ! git remote -v | grep upstream ; then git remote add upstream git://github.com/braindecode/braindecode.git; fi
git fetch upstream
git branch -a
mkdir -p ~/mne_data
touch pattern.txt;
if [ "$CIRCLE_BRANCH" == "master" ] || [[ $(cat gitlog.txt) == *"[circle full]"* ]]; then
echo html > build.txt;
else
FNAMES=$(git diff --name-only $(git merge-base $CIRCLE_BRANCH upstream/master) $CIRCLE_BRANCH);
echo FNAMES="$FNAMES";
for FNAME in $FNAMES; do
if [[ `expr match $FNAME "\(tutorials\|examples\)/.*plot_.*\.py"` ]] ; then
echo "Checking example $FNAME ...";
PATTERN=`basename $FNAME`"\\|"$PATTERN;
if [[ $(cat $FNAME | grep -x ".*datasets.*eegbci.*" | wc -l) -gt 0 ]]; then
python -c "import mne; print([mne.datasets.eegbci.load_data(s, [4, 5, 6, 8, 9, 10, 12, 13, 14], update_path=True, force_update=True) for s in range(1, 51)])";
fi;
if [[ $(cat $FNAME | grep -x ".*datasets.*sleep_physionet.*" | wc -l) -gt 0 ]]; then
python -c "import mne; print(mne.datasets.sleep_physionet.age.fetch_data([0, 1], recording=[1], update_path=True, force_update=True))";
fi;
fi;
done;
echo PATTERN="$PATTERN";
if [[ $PATTERN ]]; then
PATTERN="\(${PATTERN::-2}\)";
echo html-pattern > build.txt;
else
echo html > build.txt;
fi;
fi;
echo "$PATTERN" > pattern.txt;
- run:
name: Verify build type
command: |
echo "PATTERN=$(cat pattern.txt)"
echo "BUILD=$(cat build.txt)"
ls -al ~/mne_data;
# Build docs
- run:
name: make html
command: |
cd docs;
PATTERN=$(cat ../pattern.txt) make $(cat ../build.txt);
# Reduce upload time of artifacts we will (almost) never look at
- run:
name: Reduce artifact upload time
command: |
if grep -q html_dev-pattern build.txt || grep -q html_dev-noplot build.txt; then
tar czf docs/_build/html/_downloads.tgz docs/_build/html/_downloads
rm -Rf docs/_build/html/_downloads
fi
# Save the outputs
- store_artifacts:
path: docs/_build/html/
destination: dev
- persist_to_workspace:
root: docs/_build
paths:
- html
# Keep these separate, maybe better in terms of size limitations (?)
- save_cache:
key: data-cache-0
paths:
- ~/mne_data/MNE-eegbci-data
- ~/mne_data/physionet-sleep-data
deploy:
docker:
- image: circleci/python:3.6-jessie
steps:
- attach_workspace:
at: /tmp/build
- run:
name: Fetch docs
command: |
set -e
mkdir -p ~/.ssh
echo -e "Host *\nStrictHostKeyChecking no" > ~/.ssh/config
chmod og= ~/.ssh/config
if [ ! -d ~/braindecode.github.io ]; then
git clone git@github.com:/braindecode/braindecode.github.io.git ~/braindecode.github.io --depth=1
fi
- run:
name: Deploy docs
command: |
set -e;
if [ "${CIRCLE_BRANCH}" == "master" ]; then
git config --global user.email "circle@mne.com";
git config --global user.name "Circle CI";
cd ~/braindecode.github.io;
git checkout master
git remote -v
git fetch origin
git reset --hard origin/master
git clean -xdf
echo "Deploying dev docs for ${CIRCLE_BRANCH}.";
cp -a /tmp/build/html/* .;
touch .nojekyll;
git add -A;
git commit -m "CircleCI update of dev docs (${CIRCLE_BUILD_NUM}).";
git push origin master;
else
echo "No deployment (build: ${CIRCLE_BRANCH}).";
fi
workflows:
version: 2
default:
jobs:
- build_docs
- deploy:
requires:
- build_docs
filters:
branches:
only:
- master