|
| 1 | +version: 2 |
| 2 | +jobs: |
| 3 | + build_docs: |
| 4 | + docker: |
| 5 | + - image: circleci/python:3.8.1-buster |
| 6 | + steps: |
| 7 | + - checkout |
| 8 | + - run: |
| 9 | + name: Set BASH_ENV |
| 10 | + command: | |
| 11 | + echo "set -e" >> $BASH_ENV |
| 12 | + echo "export DISPLAY=:99" >> $BASH_ENV |
| 13 | + echo "export OPENBLAS_NUM_THREADS=4" >> $BASH_ENV |
| 14 | + echo "export LIBSVMDATA_HOME=$HOME/celer_data/" >> $BASH_ENV |
| 15 | + echo "BASH_ENV:" |
| 16 | + cat $BASH_ENV |
| 17 | +
|
| 18 | + - run: |
| 19 | + name: Merge with upstream |
| 20 | + command: | |
| 21 | + echo $(git log -1 --pretty=%B) | tee gitlog.txt |
| 22 | + echo ${CI_PULL_REQUEST//*pull\//} | tee merge.txt |
| 23 | + if [[ $(cat merge.txt) != "" ]]; then |
| 24 | + echo "Merging $(cat merge.txt)"; |
| 25 | + git remote add upstream https://github.com/mathurinm/skglm.git; |
| 26 | + git pull --ff-only upstream "refs/pull/$(cat merge.txt)/merge"; |
| 27 | + git fetch upstream master; |
| 28 | + fi |
| 29 | +
|
| 30 | + # If both keys are in the same command only one is restored |
| 31 | + - restore_cache: |
| 32 | + keys: |
| 33 | + - pip-cache |
| 34 | + |
| 35 | + - run: |
| 36 | + name: Spin up Xvfb |
| 37 | + command: | |
| 38 | + /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; |
| 39 | +
|
| 40 | + - run: |
| 41 | + name: Get Python running |
| 42 | + command: | |
| 43 | + python -m pip install --user --upgrade --progress-bar off pip |
| 44 | + python -m pip install --user --upgrade --progress-bar off -r doc/doc-requirements.txt |
| 45 | + python -m pip install --user -e . |
| 46 | +
|
| 47 | + - save_cache: |
| 48 | + key: pip-cache |
| 49 | + paths: |
| 50 | + - ~/.cache/pip |
| 51 | + |
| 52 | + # Look at what we have and fail early if there is some library conflict |
| 53 | + - run: |
| 54 | + name: Check installation |
| 55 | + command: | |
| 56 | + which python |
| 57 | + python -c "import skglm" |
| 58 | +
|
| 59 | + # Build docs |
| 60 | + - run: |
| 61 | + name: make html |
| 62 | + no_output_timeout: 120m |
| 63 | + command: | |
| 64 | + cd doc; |
| 65 | + make clean; |
| 66 | + make SPHINXOPTS=-v html; |
| 67 | + cd ..; |
| 68 | +
|
| 69 | +
|
| 70 | + # Deploy docs |
| 71 | + - run: |
| 72 | + name: deploy |
| 73 | + command: | |
| 74 | + if [[ ${CIRCLE_BRANCH} == "master" ]]; then |
| 75 | + set -e |
| 76 | + mkdir -p ~/.ssh |
| 77 | + echo -e "Host *\nStrictHostKeyChecking no" > ~/.ssh/config |
| 78 | + chmod og= ~/.ssh/config |
| 79 | + cd doc; |
| 80 | + pip install ghp-import; |
| 81 | + make install |
| 82 | + fi |
| 83 | +
|
| 84 | + # Save the outputs |
| 85 | + - store_artifacts: |
| 86 | + path: doc/_build/html/ |
| 87 | + destination: dev |
| 88 | + - persist_to_workspace: |
| 89 | + root: doc/_build |
| 90 | + paths: |
| 91 | + - html |
| 92 | + |
| 93 | + |
| 94 | +workflows: |
| 95 | + version: 2 |
| 96 | + |
| 97 | + default: |
| 98 | + jobs: |
| 99 | + - build_docs |
0 commit comments