|
| 1 | +# Tagging a commit with [circle front] will build the front page and perform test-doc. |
| 2 | +# Tagging a commit with [circle full] will build everything. |
| 3 | +version: 2 |
| 4 | +jobs: |
| 5 | + build_docs: |
| 6 | + docker: |
| 7 | + - image: circleci/python:3.7-stretch |
| 8 | + steps: |
| 9 | + - checkout |
| 10 | + - run: |
| 11 | + name: Set BASH_ENV |
| 12 | + command: | |
| 13 | + echo "set -e" >> $BASH_ENV |
| 14 | + echo "export DISPLAY=:99" >> $BASH_ENV |
| 15 | + echo "export OPENBLAS_NUM_THREADS=4" >> $BASH_ENV |
| 16 | + echo "BASH_ENV:" |
| 17 | + cat $BASH_ENV |
| 18 | +
|
| 19 | + - run: |
| 20 | + name: Merge with upstream |
| 21 | + command: | |
| 22 | + echo $(git log -1 --pretty=%B) | tee gitlog.txt |
| 23 | + echo ${CI_PULL_REQUEST//*pull\//} | tee merge.txt |
| 24 | + if [[ $(cat merge.txt) != "" ]]; then |
| 25 | + echo "Merging $(cat merge.txt)"; |
| 26 | + git remote add upstream git://github.com/PythonOT/POT.git; |
| 27 | + git pull --ff-only upstream "refs/pull/$(cat merge.txt)/merge"; |
| 28 | + git fetch upstream master; |
| 29 | + fi |
| 30 | +
|
| 31 | + # Load our data |
| 32 | + - restore_cache: |
| 33 | + keys: |
| 34 | + - data-cache-0 |
| 35 | + - pip-cache |
| 36 | + |
| 37 | + - run: |
| 38 | + name: Spin up Xvfb |
| 39 | + command: | |
| 40 | + /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; |
| 41 | +
|
| 42 | + # https://github.com/ContinuumIO/anaconda-issues/issues/9190#issuecomment-386508136 |
| 43 | + # https://github.com/golemfactory/golem/issues/1019 |
| 44 | + - run: |
| 45 | + name: Fix libgcc_s.so.1 pthread_cancel bug |
| 46 | + command: | |
| 47 | + sudo apt-get install qt5-default |
| 48 | +
|
| 49 | + - run: |
| 50 | + name: Get Python running |
| 51 | + command: | |
| 52 | + python -m pip install --user --upgrade --progress-bar off pip |
| 53 | + python -m pip install --user --upgrade --progress-bar off -r requirements.txt |
| 54 | + python -m pip install --user --upgrade --progress-bar off -r docs/requirements.txt |
| 55 | + python -m pip install --user --upgrade --progress-bar off ipython "https://api.github.com/repos/sphinx-gallery/sphinx-gallery/zipball/master" memory_profiler |
| 56 | + python -m pip install --user -e . |
| 57 | +
|
| 58 | + - save_cache: |
| 59 | + key: pip-cache |
| 60 | + paths: |
| 61 | + - ~/.cache/pip |
| 62 | + |
| 63 | + # Look at what we have and fail early if there is some library conflict |
| 64 | + - run: |
| 65 | + name: Check installation |
| 66 | + command: | |
| 67 | + which python |
| 68 | + python -c "import ot" |
| 69 | +
|
| 70 | + # Build docs |
| 71 | + - run: |
| 72 | + name: make html |
| 73 | + command: | |
| 74 | + cd docs; |
| 75 | + make html; |
| 76 | +
|
| 77 | + # Save the outputs |
| 78 | + - store_artifacts: |
| 79 | + path: docs/build/html/ |
| 80 | + destination: dev |
| 81 | + - persist_to_workspace: |
| 82 | + root: docs/build |
| 83 | + paths: |
| 84 | + - html |
| 85 | + |
| 86 | + deploy: |
| 87 | + docker: |
| 88 | + - image: circleci/python:3.6-jessie |
| 89 | + steps: |
| 90 | + - attach_workspace: |
| 91 | + at: /tmp/build |
| 92 | + - run: |
| 93 | + name: Fetch docs |
| 94 | + command: | |
| 95 | + set -e |
| 96 | + mkdir -p ~/.ssh |
| 97 | + echo -e "Host *\nStrictHostKeyChecking no" > ~/.ssh/config |
| 98 | + chmod og= ~/.ssh/config |
| 99 | + if [ ! -d ~/PythonOT.github.io ]; then |
| 100 | + git clone [email protected]:/PythonOT/PythonOT.github.io.git ~/PythonOT.github.io --depth=1 |
| 101 | + fi |
| 102 | + - run: |
| 103 | + name: Deploy docs |
| 104 | + command: | |
| 105 | + set -e; |
| 106 | + if [ "${CIRCLE_BRANCH}" == "master" ]; then |
| 107 | + git config --global user.email "[email protected]"; |
| 108 | + git config --global user.name "Circle CI"; |
| 109 | + cd ~/PythonOT.github.io; |
| 110 | + git checkout master |
| 111 | + git remote -v |
| 112 | + git fetch origin |
| 113 | + git reset --hard origin/master |
| 114 | + git clean -xdf |
| 115 | + echo "Deploying dev docs for ${CIRCLE_BRANCH}."; |
| 116 | + cp -a /tmp/build/html/* .; |
| 117 | + touch .nojekyll; |
| 118 | + git add -A; |
| 119 | + git commit -m "CircleCI update of dev docs (${CIRCLE_BUILD_NUM})."; |
| 120 | + git push origin master; |
| 121 | + else |
| 122 | + echo "No deployment (build: ${CIRCLE_BRANCH})."; |
| 123 | + fi |
| 124 | +
|
| 125 | +workflows: |
| 126 | + version: 2 |
| 127 | + |
| 128 | + default: |
| 129 | + jobs: |
| 130 | + - build_docs |
| 131 | + - deploy: |
| 132 | + requires: |
| 133 | + - build_docs |
| 134 | + filters: |
| 135 | + branches: |
| 136 | + only: |
| 137 | + - master |
0 commit comments