Skip to content

Commit e593182

Browse files
authored
Doc ci build (#145)
add codecov + circle ci to upload website + activate github actions for testing
2 parents 3ade772 + 3eed3ca commit e593182

File tree

8 files changed

+195
-4
lines changed

8 files changed

+195
-4
lines changed

.circleci/artifact_path

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0/docs/build/html/index.html

.circleci/config.yml

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
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

.github/workflows/main.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
on: [status]
2+
jobs:
3+
circleci_artifacts_redirector_job:
4+
runs-on: ubuntu-latest
5+
name: Run CircleCI artifacts redirector
6+
steps:
7+
- name: GitHub Action step
8+
uses: larsoner/circleci-artifacts-redirector-action@master
9+
with:
10+
repo-token: ${{ secrets.GITHUB_TOKEN }}
11+
artifact-path: 0/dev/index.html
12+
circleci-jobs: build_docs

.github/workflows/pythonpackage.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
name: Test Package
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
create:
8+
branches:
9+
- 'master'
10+
tags:
11+
- '**'
412

513
jobs:
614
build:
@@ -9,7 +17,7 @@ jobs:
917
strategy:
1018
max-parallel: 4
1119
matrix:
12-
python-version: [2.7, 3.5, 3.6, 3.7]
20+
python-version: [3.5, 3.6, 3.7, 3.8]
1321

1422
steps:
1523
- uses: actions/checkout@v1
@@ -21,10 +29,20 @@ jobs:
2129
run: |
2230
python -m pip install --upgrade pip
2331
pip install -r requirements.txt
32+
pip install flake8 pytest "pytest-cov<2.6" codecov
33+
pip install -U "sklearn"
2434
- name: Lint with flake8
2535
run: |
26-
pip install flake8
2736
# stop the build if there are Python syntax errors or undefined names
2837
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
2938
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3039
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
40+
- name: Install POT
41+
run: |
42+
pip install -e .
43+
- name: Run tests
44+
run: |
45+
python -m pytest -v test/ ot/ --doctest-modules --ignore ot/gpu/ --cov=ot
46+
- name: Upload codecov
47+
run: |
48+
codecov

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ before_install:
3434
install:
3535
- pip install -r requirements.txt
3636
- pip install -U "numpy>=1.14" scipy # for numpy array formatting in doctests
37-
- pip install flake8 pytest "pytest-cov<2.6"
37+
- pip install flake8 pytest "pytest-cov<2.6" codecov
3838
- pip install -U "sklearn"
3939
- pip install .
4040
# command to run tests + check syntax style
@@ -45,3 +45,6 @@ script:
4545
- flake8 examples/ ot/ test/
4646
- python -m pytest -v test/ ot/ --doctest-modules --ignore ot/gpu/ --cov=ot
4747
# - py.test ot test
48+
after_script:
49+
# Need to run from source dir to execute "git" commands
50+
- codecov;

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![PyPI version](https://badge.fury.io/py/POT.svg)](https://badge.fury.io/py/POT)
44
[![Anaconda Cloud](https://anaconda.org/conda-forge/pot/badges/version.svg)](https://anaconda.org/conda-forge/pot)
55
[![Build Status](https://travis-ci.org/PythonOT/POT.svg?branch=master)](https://travis-ci.org/PythonOT/POT)
6+
[![Codecov Status](https://codecov.io/gh/PythonOT/POT/branch/master/graph/badge.svg)](https://codecov.io/gh/PythonOT/POT)
67
[![Documentation Status](https://readthedocs.org/projects/pot/badge/?version=latest)](http://pot.readthedocs.io/en/latest/?badge=latest)
78
[![Downloads](https://pepy.tech/badge/pot)](https://pepy.tech/project/pot)
89
[![Anaconda downloads](https://anaconda.org/conda-forge/pot/badges/downloads.svg)](https://anaconda.org/conda-forge/pot)

codecov.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
coverage:
2+
precision: 2
3+
round: down
4+
range: "70...100"
5+
status:
6+
project:
7+
default:
8+
target: auto
9+
threshold: 0.01
10+
patch: false
11+
changes: false
12+
comment:
13+
layout: "header, diff, sunburst, uncovered"
14+
behavior: default

docs/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sphinx_gallery
2+
sphinx_rtd_theme
3+
numpydoc
4+
memory_profiler
5+
pillow

0 commit comments

Comments
 (0)