# 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: cimg/python:3.9 resource_class: medium 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 https://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: Install ffmpeg command: | sudo apt update sudo apt install ffmpeg - run: name: Get Python running command: | python -m pip install --user --upgrade --progress-bar off pip python -m pip install --user -e . python -m pip install --user --upgrade --no-cache-dir --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 sphinx-gallery memory_profiler # python -m pip install --user --upgrade --progress-bar off ipython "https://api.github.com/repos/sphinx-gallery/sphinx-gallery/zipball/master" memory_profiler - 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" - run: name: Correct link in release file command: | sed -i -r 's/PR #([[:digit:]]*)/\[PR #\1\]\(https:\/\/github.com\/PythonOT\/POT\/pull\/\1\)/' RELEASES.md sed -i -r 's/Issue #([[:digit:]]*)/\[Issue #\1\]\(https:\/\/github.com\/PythonOT\/POT\/issues\/\1\)/' RELEASES.md # Build docs - run: name: make html command: | cd docs; make html; no_output_timeout: 30m # Save the outputs - store_artifacts: path: docs/build/html/ destination: dev - persist_to_workspace: root: docs/build paths: - html deploy_master: 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}."; cd master cp -a /tmp/build/html/* .; cp -a /tmp/build/html/.github/* .github/; touch .nojekyll; git add -A; git add -f .github/* ; git commit -m "CircleCI update of dev docs (${CIRCLE_BUILD_NUM})."; git push origin master; else echo "No deployment (build: ${CIRCLE_BRANCH})."; fi deploy_tag: 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; 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/* .; cp -a /tmp/build/html/.github/* .github/; touch .nojekyll; git add -A; git add -f .github/* ; git commit -m "CircleCI update of dev docs (${CIRCLE_BUILD_NUM})."; git push origin master; workflows: version: 2 default: jobs: - build_docs: filters: tags: only: /[0-9]+(\.[0-9]+)*$/ - deploy_master: requires: - build_docs filters: branches: only: - master - deploy_tag: requires: - build_docs filters: branches: ignore: /.*/ tags: only: /[0-9]+(\.[0-9]+)*$/