Skip to content

Commit bb8fa25

Browse files
authored
refactor(docs): readthedocs -> gh action + aws, reST-> md, sphinx -> numpy format (#267)
- Move sphinx format to Numpy-style - Move from reStructuredText to Markdown (via recommonmark). The master plan is to eliminate docutils and sphinx as a bottleneck completely in favor of something else (e.g. gatsby with a source that inspects our modules and can source intersphinx) - Move from RTD to GitHub Action, full support of poetry extras packages, deploys straight to S3 and CloudFront
2 parents 1ee8026 + 0f4d80e commit bb8fa25

Some content is hidden

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

53 files changed

+1305
-656
lines changed

.codecov.yml

+15
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/libvcs-ci.yml

+47-7
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,56 @@ jobs:
1919
uses: actions/setup-python@v1
2020
with:
2121
python-version: ${{ matrix.python-version }}
22-
- name: Install dependencies
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
2329
run: |
24-
python -m pip install --upgrade poetry
25-
poetry install
26-
- name: Lint with flake8
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
2736
run: |
28-
poetry run flake8
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 deploy"
65+
66+
- name: Lint with flake8
67+
run: poetry run flake8
68+
2969
- name: Test with pytest
30-
run: |
31-
poetry run py.test --cov=./ --cov-report=xml
70+
run: poetry run py.test --cov=./ --cov-report=xml
71+
3272
- uses: codecov/codecov-action@v1
3373
with:
3474
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/publish-docs.yml

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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+
pushd docs; cp manifest.json _build/html; popd
70+
71+
- name: Push documentation to S3
72+
uses: jakejarvis/s3-sync-action@master
73+
with:
74+
args: --acl public-read --follow-symlinks --delete
75+
env:
76+
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
77+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
78+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
79+
AWS_REGION: 'us-west-1' # optional: defaults to us-east-1
80+
SOURCE_DIR: 'docs/_build/html' # optional: defaults to entire repository
81+
82+
- name: Generate list of changed files for CloudFront to invalidate
83+
run: |
84+
pushd docs/_build/html; FILES=$(find . -name \* -print | grep html | cut -c2- | sort | uniq | tr '\n' ' '); popd
85+
for file in $FILES; do
86+
echo $file
87+
# add bare directory to list of updated paths when we see index.html
88+
[[ "$file" == *"/index.html" ]] && echo $file | sed -e 's/\/index.html$/\//'
89+
done | sort | uniq | tr '\n' ' ' > .updated_files
90+
91+
- name: Invalidate on CloudFront
92+
uses: chetan/invalidate-cloudfront-action@master
93+
env:
94+
DISTRIBUTION: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION }}
95+
AWS_REGION: 'us-east-1'
96+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
97+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
98+
PATHS_FROM: .updated_files

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,12 @@ doc/_build/
7777
*.lprof
7878

7979
pip-wheel-metadata/
80+
81+
# Used by publish-docs.yml CI
82+
.updated_files
83+
84+
# mkdocs
85+
site/
86+
87+
# vim
88+
.vim/

.tmuxp.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ windows:
2121
panes:
2222
- focus: true
2323
- pane
24-
- make serve
25-
- make SPHINXBUILD='poetry run sphinx-build' watch
24+
- make -C .. serve_docs
25+
- make -C .. watch_docs

0 commit comments

Comments
 (0)