Skip to content

Commit

Permalink
refactor(ci, docs): Publish our own docs, poetry updates (#295)
Browse files Browse the repository at this point in the history
Related tmuxp PR: tmux-python/tmuxp#623
  • Loading branch information
tony authored Aug 16, 2020
2 parents c1dda0f + 9c9f94e commit bf7cdca
Show file tree
Hide file tree
Showing 45 changed files with 879 additions and 398 deletions.
15 changes: 15 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
codecov:
notify:
require_ci_to_pass: no

coverage:
precision: 2
round: down
range: "70...100"
status:
project:
default:
target: auto
threshold: 1%
base: auto
patch: off
97 changes: 97 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Publish Docs

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.x' ]
steps:
- uses: actions/checkout@v1
- name: Configure git
run: |
git config --global user.name 'travis-ci'
git config --global user.email '[email protected]'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Get full Python version
id: full-python-version
shell: bash
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")

- name: Install poetry
run: |
curl -O -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
python get-poetry.py -y
echo "::set-env name=PATH::$HOME/.poetry/bin:$PATH"
rm get-poetry.py
- name: Get poetry cache paths from config
run: |
echo ::set-env name=poetry_cache_dir::$(poetry config --list | sed -n 's/.*cache-dir = //p' | sed -e 's/^"//' -e 's/"$//')
echo ::set-env name=poetry_virtualenvs_path::$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^"//' -e 's/"$//')
- name: Configure poetry
shell: bash
run: poetry config virtualenvs.in-project true

- name: Set up cache
uses: actions/cache@v2
id: cache
with:
path: |
.venv
{{ env.poetry_cache_dir }}
{{ env.poetry_virtualenvs_path }}
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
shell: bash
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv

- name: Upgrade pip
shell: bash
run: poetry run python -m pip install pip -U

- name: Install dependencies [w/ docs]
run: poetry install --extras "docs lint"

- name: Build documentation
run: |
pushd docs; make SPHINXBUILD='poetry run sphinx-build' html; popd
- name: Push documentation to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-west-1' # optional: defaults to us-east-1
SOURCE_DIR: 'docs/_build/html' # optional: defaults to entire repository

- name: Generate list of changed files for CloudFront to invalidate
run: |
pushd docs/_build/html; FILES=$(find . -name \* -print | grep html | cut -c2- | sort | uniq | tr '\n' ' '); popd
for file in $FILES; do
echo $file
# add bare directory to list of updated paths when we see index.html
[[ "$file" == *"/index.html" ]] && echo $file | sed -e 's/\/index.html$/\//'
done | sort | uniq | tr '\n' ' ' > .updated_files
- name: Invalidate on CloudFront
uses: chetan/invalidate-cloudfront-action@master
env:
DISTRIBUTION: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION }}
AWS_REGION: 'us-east-1'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
PATHS_FROM: .updated_files
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: libtmux CI
name: tests

on: [push, pull_request]

Expand Down
10 changes: 4 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
*,cover
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
# Django stuff
*.log

# Sphinx documentation
Expand All @@ -62,13 +62,11 @@ docs/_build/
# PyBuilder
target/

#Ipython Notebook
# ipython Notebook
.ipynb_checkpoints

# editors
.idea
.ropeproject
*.swp

# docs
doc/_build/
.vim
2 changes: 1 addition & 1 deletion .tmuxp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ windows:
layout: main-horizontal
options:
main-pane-height: 35
start_directory: doc/
start_directory: docs/
panes:
- focus: true
- pane
Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include README.rst LICENSE CHANGES .tmuxp.yaml
include README.rst LICENSE CHANGES pyproject.toml .tmuxp.yaml
include requirements/*.txt
recursive-include doc *.rst
recursive-include docs *.rst
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,31 @@ entr_warn:
@echo "----------------------------------------------------------"

isort:
isort `${PY_FILES}`
poetry run isort `${PY_FILES}`

black:
black `${PY_FILES}` --skip-string-normalization
poetry run black `${PY_FILES}`

test:
py.test $(test)
poetry run py.test $(test)

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

build_docs:
cd doc && $(MAKE) html
$(MAKE) -C docs html

watch_docs:
cd doc && $(MAKE) watch_docs
if command -v entr > /dev/null; then ${DOC_FILES} | entr -c $(MAKE) build_docs; else $(MAKE) build_docs entr_warn; fi

serve_docs:
$(MAKE) -C docs serve

dev_docs:
$(MAKE) -j watch_docs serve_docs

flake8:
flake8 libtmux tests
poetry run flake8

watch_flake8:
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) flake8; else $(MAKE) flake8 entr_warn; fi
64 changes: 21 additions & 43 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,11 @@ powerful traversal features::
>>> pane.window.session
Session($3 foo)

.. _MIT: http://opensource.org/licenses/MIT
.. _developing and testing: http://libtmux.git-pull.com/en/latest/developing.html
.. _developing and testing: http://libtmux.git-pull.com/developing.html
.. _tmuxp: https://tmuxp.git-pull.com/
.. _documentation: https://libtmux.git-pull.com/
.. _API: https://libtmux.git-pull.com/en/latest/api.html
.. _architectural details: https://libtmux.git-pull.com/en/latest/about.html
.. _API: https://libtmux.git-pull.com/api.html
.. _architectural details: https://libtmux.git-pull.com/about.html
.. _formats: http://man.openbsd.org/OpenBSD-5.9/man1/tmux.1#FORMATS
.. _target: http://man.openbsd.org/OpenBSD-5.9/man1/tmux.1#COMMANDS

Expand All @@ -176,56 +175,35 @@ See donation options at https://git-pull.com/support.html.

Project details
---------------
- tmux support: 1.8, 1.9a, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
- python support: 2.7, >= 3.3, pypy, pypy3
- Source: https://github.com/tmux-python/libtmux
- Docs: https://libtmux.git-pull.com
- API: https://libtmux.git-pull.com/api.html
- Changelog: https://libtmux.git-pull.com/history.html
- Issues: https://github.com/tmux-python/libtmux/issues
- Test Coverage: https://codecov.io/gh/tmux-python/libtmux
- pypi: https://pypi.python.org/pypi/libtmux
- Open Hub: https://www.openhub.net/p/libtmux-python
- License: `MIT`_.

============== ==========================================================
tmux support 1.8, 1.9a, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
python support 2.7, >= 3.3, pypy, pypy3
Source https://github.com/tmux-python/libtmux
Docs https://libtmux.git-pull.com
API https://libtmux.git-pull.com/en/latest/api.html
Changelog https://libtmux.git-pull.com/en/latest/history.html
Issues https://github.com/tmux-python/libtmux/issues
Test Coverage https://codecov.io/gh/tmux-python/libtmux
pypi https://pypi.python.org/pypi/libtmux
Open Hub https://www.openhub.net/p/libtmux-python
License `MIT`_.
git repo .. code-block:: bash

$ git clone https://github.com/tmux-python/libtmux.git
install stable .. code-block:: bash

$ pip install libtmux
install dev .. code-block:: bash

$ git clone https://github.com/tmux-python/libtmux.git libtmux
$ cd ./libtmux
$ virtualenv .venv
$ source .venv/bin/activate
$ pip install -e .

See the `developing and testing`_ page in the docs for
more.
tests .. code-block:: bash

$ make test
============== ==========================================================
.. _MIT: http://opensource.org/licenses/MIT

.. |pypi| image:: https://img.shields.io/pypi/v/libtmux.svg
:alt: Python Package
:target: http://badge.fury.io/py/libtmux

.. |build-status| image:: https://github.com/tmux-python/libtmux/workflows/.github/workflows/libtmux-ci.yml/badge.svg
.. |docs| image:: https://github.com/tmux-python/libtmux/workflows/Publish%20Docs/badge.svg
:alt: Docs
:target: https://github.com/tmux-python/libtmux/actions?query=workflow%3A"Publish+Docs"

.. |build-status| image:: https://github.com/tmux-python/libtmux/workflows/tests/badge.svg
:alt: Build Status
:target: https://github.com/tmux-python/libtmux/actions
:target: https://github.com/tmux-python/tmux-python/actions?query=workflow%3A"tests"

.. |coverage| image:: https://codecov.io/gh/tmux-python/libtmux/branch/master/graph/badge.svg
:alt: Code Coverage
:target: https://codecov.io/gh/tmux-python/libtmux

.. |license| image:: https://img.shields.io/github/license/tmux-python/libtmux.svg
:alt: License

.. |docs| image:: https://readthedocs.org/projects/libtmux/badge/?version=latest
:alt: Documentation Status
:scale: 100%
:target: https://readthedocs.org/projects/libtmux/
Loading

0 comments on commit bf7cdca

Please sign in to comment.