From 1efd48d61f871d6833158ad18a2a2920bf515d77 Mon Sep 17 00:00:00 2001 From: Alexandre Gramfort Date: Tue, 21 Apr 2020 10:32:42 +0200 Subject: circle CI --- .circleci/artifact_path | 1 + .circleci/config.yml | 137 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 .circleci/artifact_path create mode 100644 .circleci/config.yml (limited to '.circleci') diff --git a/.circleci/artifact_path b/.circleci/artifact_path new file mode 100644 index 0000000..aa9acb8 --- /dev/null +++ b/.circleci/artifact_path @@ -0,0 +1 @@ +0/docs/build/html/index.html diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..9701ad1 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,137 @@ +# 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/PythonOT/POT.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 -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 -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 ot" + + # Build docs + - run: + name: make html + command: | + cd docs; + make html; + + # Save the outputs + - store_artifacts: + path: docs/build/html/ + destination: dev + - persist_to_workspace: + root: docs/build + paths: + - html + + 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 ~/PythonOT.github.io ]; then + git clone git@github.com:/PythonOT/PythonOT.github.io.git ~/PythonOT.github.io --depth=1 + fi + - run: + name: Deploy docs + command: | + set -e; + if [ "${CIRCLE_BRANCH}" == "master" ]; then + git config --global user.email "circle@PythonOT.com"; + git config --global user.name "Circle CI"; + cd ~/PythonOT.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 -- cgit v1.2.3