Skip to content

Commit 244b122

Browse files
authored
build: Overhaul docs, packaging, use numpy-style docs (#303)
See also: vcs-python/libvcs#270
2 parents 7571d51 + 58c85d4 commit 244b122

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+967
-632
lines changed

.codecov.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
codecov:
2+
notify:
3+
require_ci_to_pass: no
4+
5+
coverage:
6+
precision: 2
7+
round: down
8+
range: "70...100"
9+
status:
10+
project:
11+
default:
12+
target: auto
13+
threshold: 1%
14+
base: auto
15+
patch: off

.github/workflows/publish-docs.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Publish Docs
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: [ '3.x' ]
12+
steps:
13+
- uses: actions/checkout@v1
14+
- name: Configure git
15+
run: |
16+
git config --global user.name 'travis-ci'
17+
git config --global user.email '[email protected]'
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v1
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- name: Get full Python version
24+
id: full-python-version
25+
shell: bash
26+
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
27+
28+
- name: Install poetry
29+
run: |
30+
curl -O -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
31+
python get-poetry.py -y
32+
echo "::set-env name=PATH::$HOME/.poetry/bin:$PATH"
33+
rm get-poetry.py
34+
35+
- name: Get poetry cache paths from config
36+
run: |
37+
echo ::set-env name=poetry_cache_dir::$(poetry config --list | sed -n 's/.*cache-dir = //p' | sed -e 's/^"//' -e 's/"$//')
38+
echo ::set-env name=poetry_virtualenvs_path::$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^"//' -e 's/"$//')
39+
40+
- name: Configure poetry
41+
shell: bash
42+
run: poetry config virtualenvs.in-project true
43+
44+
- name: Set up cache
45+
uses: actions/cache@v2
46+
id: cache
47+
with:
48+
path: |
49+
.venv
50+
{{ env.poetry_cache_dir }}
51+
{{ env.poetry_virtualenvs_path }}
52+
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
53+
54+
- name: Ensure cache is healthy
55+
if: steps.cache.outputs.cache-hit == 'true'
56+
shell: bash
57+
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
58+
59+
- name: Upgrade pip
60+
shell: bash
61+
run: poetry run python -m pip install pip -U
62+
63+
- name: Install dependencies [w/ docs]
64+
run: poetry install --extras "docs lint"
65+
66+
- name: Build documentation
67+
run: |
68+
pushd docs; make SPHINXBUILD='poetry run sphinx-build' html; popd
69+
70+
- name: Push documentation to S3
71+
uses: jakejarvis/s3-sync-action@master
72+
with:
73+
args: --acl public-read --follow-symlinks --delete
74+
env:
75+
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
76+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
77+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
78+
AWS_REGION: 'us-west-1' # optional: defaults to us-east-1
79+
SOURCE_DIR: 'docs/_build/html' # optional: defaults to entire repository
80+
81+
- name: Generate list of changed files for CloudFront to invalidate
82+
run: |
83+
pushd docs/_build/html; FILES=$(find . -name \* -print | grep html | cut -c2- | sort | uniq | tr '\n' ' '); popd
84+
for file in $FILES; do
85+
echo $file
86+
# add bare directory to list of updated paths when we see index.html
87+
[[ "$file" == *"/index.html" ]] && echo $file | sed -e 's/\/index.html$/\//'
88+
done | sort | uniq | tr '\n' ' ' > .updated_files
89+
90+
- name: Invalidate on CloudFront
91+
uses: chetan/invalidate-cloudfront-action@master
92+
env:
93+
DISTRIBUTION: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION }}
94+
AWS_REGION: 'us-east-1'
95+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
96+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
97+
PATHS_FROM: .updated_files

.github/workflows/tests.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: tests
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: [ '2.7', '3.x' ]
12+
steps:
13+
- uses: actions/checkout@v1
14+
- name: Configure git
15+
run: |
16+
git config --global user.name 'travis-ci'
17+
git config --global user.email '[email protected]'
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v1
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- name: Get full Python version
24+
id: full-python-version
25+
shell: bash
26+
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
27+
28+
- name: Install poetry
29+
run: |
30+
curl -O -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
31+
python get-poetry.py -y
32+
echo "::set-env name=PATH::$HOME/.poetry/bin:$PATH"
33+
rm get-poetry.py
34+
35+
- name: Get poetry cache paths from config
36+
run: |
37+
echo ::set-env name=poetry_cache_dir::$(poetry config --list | sed -n 's/.*cache-dir = //p' | sed -e 's/^"//' -e 's/"$//')
38+
echo ::set-env name=poetry_virtualenvs_path::$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^"//' -e 's/"$//')
39+
40+
- name: Configure poetry
41+
shell: bash
42+
run: poetry config virtualenvs.in-project true
43+
44+
- name: Set up cache
45+
uses: actions/cache@v2
46+
id: cache
47+
with:
48+
path: |
49+
.venv
50+
{{ env.poetry_cache_dir }}
51+
{{ env.poetry_virtualenvs_path }}
52+
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
53+
54+
- name: Ensure cache is healthy
55+
if: steps.cache.outputs.cache-hit == 'true'
56+
shell: bash
57+
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
58+
59+
- name: Upgrade pip
60+
shell: bash
61+
run: poetry run python -m pip install pip -U
62+
63+
- name: Install dependencies
64+
run: poetry install -E "docs test coverage lint format"
65+
66+
- name: Lint with flake8
67+
run: poetry run flake8
68+
69+
- name: Test with pytest
70+
run: poetry run py.test --cov=./ --cov-report=xml
71+
72+
- uses: codecov/codecov-action@v1
73+
with:
74+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/vcspull-ci.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ htmlcov/
4545
.cache
4646
nosetests.xml
4747
coverage.xml
48-
*,cover
48+
*.cover
4949
.hypothesis/
5050
.pytest_cache/
5151

@@ -62,13 +62,14 @@ docs/_build/
6262
# PyBuilder
6363
target/
6464

65-
#Ipython Notebook
65+
# ipython Notebook
6666
.ipynb_checkpoints
6767

6868
# editors
6969
.idea
7070
.ropeproject
7171
*.swp
72+
.vim/
7273

7374
# docs
7475
doc/_build/

.tmuxp.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ windows:
1717
layout: main-horizontal
1818
options:
1919
main-pane-height: 35
20-
start_directory: doc/
20+
start_directory: docs/
2121
panes:
2222
- focus: true
2323
- pane

CHANGES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Changelog
44

55
Here you can find the recent changes to vcspull
66

7+
current
8+
-------
9+
- #303 - Overhaul docs and packaging
10+
- #303 - Add docs for CLI via sphinx-click
11+
712
vcspull-1.4.3 (2020-08-05)
813
--------------------------
914
- Bump libvcs to 0.4.4

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
include README.rst LICENSE CHANGES .tmuxp.yaml
1+
include README.rst LICENSE CHANGES pyproject.toml .tmuxp.yaml
22
include requirements/*.txt
3-
recursive-include doc *.rst
3+
recursive-include docs *.rst

Makefile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
PY_FILES= find . -type f -not -path '*/\.*' | grep -i '.*[.]py$$' 2> /dev/null
2+
DOC_FILES= find . -type f -not -path '*/\.*' | grep -i '.*[.]rst\$\|.*[.]md\$\|.*[.]css\$\|.*[.]py\$\|mkdocs\.yml\|CHANGES\|TODO\|.*conf\.py' 2> /dev/null
3+
SHELL := /bin/bash
24

35

46
entr_warn:
@@ -10,25 +12,31 @@ entr_warn:
1012
@echo "----------------------------------------------------------"
1113

1214
isort:
13-
isort `${PY_FILES}`
15+
poetry run isort `${PY_FILES}`
1416

1517
black:
16-
black `${PY_FILES}` --skip-string-normalization
18+
poetry run black `${PY_FILES}` --skip-string-normalization
1719

1820
test:
19-
py.test $(test)
21+
poetry run py.test $(test)
2022

2123
watch_test:
2224
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) test; else $(MAKE) test entr_warn; fi
2325

2426
build_docs:
25-
cd doc && $(MAKE) html
27+
$(MAKE) -C docs html
2628

2729
watch_docs:
28-
cd doc && $(MAKE) watch_docs
30+
if command -v entr > /dev/null; then ${DOC_FILES} | entr -c $(MAKE) build_docs; else $(MAKE) build_docs entr_warn; fi
31+
32+
serve_docs:
33+
$(MAKE) -C docs serve
34+
35+
dev_docs:
36+
$(MAKE) -j watch_docs serve_docs
2937

3038
flake8:
31-
flake8 vcspull tests
39+
flake8 libvcs tests
3240

3341
watch_flake8:
3442
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) flake8; else $(MAKE) flake8 entr_warn; fi

0 commit comments

Comments
 (0)