Skip to content

Doc ci build #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/artifact_path
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0/docs/build/html/index.html
137 changes: 137 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
on: [status]
jobs:
circleci_artifacts_redirector_job:
runs-on: ubuntu-latest
name: Run CircleCI artifacts redirector
steps:
- name: GitHub Action step
uses: larsoner/circleci-artifacts-redirector-action@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
artifact-path: 0/dev/index.html
circleci-jobs: build_docs
24 changes: 21 additions & 3 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Test Package

on: [push]
on:
push:
branches:
- '**'
create:
branches:
- 'master'
tags:
- '**'

jobs:
build:
Expand All @@ -9,7 +17,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [2.7, 3.5, 3.6, 3.7]
python-version: [3.5, 3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v1
Expand All @@ -21,10 +29,20 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install flake8 pytest "pytest-cov<2.6" codecov
pip install -U "sklearn"
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install POT
run: |
pip install -e .
- name: Run tests
run: |
python -m pytest -v test/ ot/ --doctest-modules --ignore ot/gpu/ --cov=ot
- name: Upload codecov
run: |
codecov
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ before_install:
install:
- pip install -r requirements.txt
- pip install -U "numpy>=1.14" scipy # for numpy array formatting in doctests
- pip install flake8 pytest "pytest-cov<2.6"
- pip install flake8 pytest "pytest-cov<2.6" codecov
- pip install -U "sklearn"
- pip install .
# command to run tests + check syntax style
Expand All @@ -45,3 +45,6 @@ script:
- flake8 examples/ ot/ test/
- python -m pytest -v test/ ot/ --doctest-modules --ignore ot/gpu/ --cov=ot
# - py.test ot test
after_script:
# Need to run from source dir to execute "git" commands
- codecov;
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![PyPI version](https://badge.fury.io/py/POT.svg)](https://badge.fury.io/py/POT)
[![Anaconda Cloud](https://anaconda.org/conda-forge/pot/badges/version.svg)](https://anaconda.org/conda-forge/pot)
[![Build Status](https://travis-ci.org/PythonOT/POT.svg?branch=master)](https://travis-ci.org/PythonOT/POT)
[![Codecov Status](https://codecov.io/gh/PythonOT/POT/branch/master/graph/badge.svg)](https://codecov.io/gh/PythonOT/POT)
[![Documentation Status](https://readthedocs.org/projects/pot/badge/?version=latest)](http://pot.readthedocs.io/en/latest/?badge=latest)
[![Downloads](https://pepy.tech/badge/pot)](https://pepy.tech/project/pot)
[![Anaconda downloads](https://anaconda.org/conda-forge/pot/badges/downloads.svg)](https://anaconda.org/conda-forge/pot)
Expand Down
14 changes: 14 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
coverage:
precision: 2
round: down
range: "70...100"
status:
project:
default:
target: auto
threshold: 0.01
patch: false
changes: false
comment:
layout: "header, diff, sunburst, uncovered"
behavior: default
5 changes: 5 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sphinx_gallery
sphinx_rtd_theme
numpydoc
memory_profiler
pillow