Skip to content
This repository was archived by the owner on Dec 6, 2023. It is now read-only.

Commit 8dae0f9

Browse files
authored
deploy docs automatically with every commit in master (#177)
* deploy docs automatically * minor update * hotfix
1 parent 669b50c commit 8dae0f9

File tree

7 files changed

+59
-5
lines changed

7 files changed

+59
-5
lines changed

Diff for: .github/workflows/gh_pages.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Deploy Docs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build-and-deploy-docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 3
16+
- name: Install Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: '3.x'
20+
- name: Install package
21+
run: |
22+
pip install -r requirements_build.txt
23+
python setup.py build
24+
python setup.py install
25+
- name: Build docs
26+
run: |
27+
cd doc
28+
pip install -r requirements.txt
29+
make html
30+
- name: Deploy docs
31+
uses: JamesIves/[email protected]
32+
with:
33+
branch: gh-pages
34+
folder: ${{ github.workspace }}/doc/_build/html

Diff for: doc/conf.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import sphinx_bootstrap_theme
1212

13-
from lightning import __version__
1413

1514
# -- Project information -----------------------------------------------------
1615

@@ -20,6 +19,13 @@
2019
copyright = '{}, {}'.format(datetime.now().year, author)
2120

2221
# The full version, including alpha/beta/rc tags.
22+
try:
23+
from lightning import __version__
24+
except (ImportError, ModuleNotFoundError) as e:
25+
raise ImportError(
26+
f"You must install '{project}' package itself to build docs for it"
27+
) from e
28+
2329
release = __version__
2430

2531
# -- General configuration ---------------------------------------------------

Diff for: doc/requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
matplotlib
2+
sphinx
13
sphinx_bootstrap_theme
2-
sphinx-gallery
4+
sphinx_gallery

Diff for: requirements.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
joblib
2+
numpy
3+
scikit-learn
4+
scipy

Diff for: requirements_build.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cython
2+
numpy

Diff for: requirements_test.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-r requirements.txt
2+
pytest

Diff for: setup.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
f.read())
2525
VERSION = match.group('version').strip()
2626
MIN_PYTHON_VERSION = '3.6'
27+
with open('requirements.txt', encoding='utf-8') as f:
28+
REQUIREMENTS = [
29+
line.strip()
30+
for line in f.read().splitlines()
31+
if line.strip()
32+
]
2733

2834

2935
def configuration(parent_package='', top_path=None):
@@ -49,9 +55,7 @@ def configuration(parent_package='', top_path=None):
4955
name=DISTNAME,
5056
maintainer=MAINTAINER,
5157
python_requires='>={}'.format(MIN_PYTHON_VERSION),
52-
install_requires=[
53-
'scikit-learn'
54-
],
58+
install_requires=REQUIREMENTS,
5559
include_package_data=True,
5660
scripts=["bin/lightning_train",
5761
"bin/lightning_predict"],

0 commit comments

Comments
 (0)