Skip to content

Commit bf7cdca

Browse files
authored
refactor(ci, docs): Publish our own docs, poetry updates (#295)
Related tmuxp PR: tmux-python/tmuxp#623
2 parents c1dda0f + 9c9f94e commit bf7cdca

Some content is hidden

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

45 files changed

+879
-398
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/publish-docs.yml

+97
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/libtmux-ci.yml renamed to .github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: libtmux CI
1+
name: tests
22

33
on: [push, pull_request]
44

.gitignore

+4-6
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ htmlcov/
4545
.cache
4646
nosetests.xml
4747
coverage.xml
48-
*,cover
48+
*.cover
4949
.hypothesis/
5050
.pytest_cache/
5151

5252
# Translations
5353
*.mo
5454
*.pot
5555

56-
# Django stuff:
56+
# Django stuff
5757
*.log
5858

5959
# Sphinx documentation
@@ -62,13 +62,11 @@ 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-
73-
# docs
74-
doc/_build/
72+
.vim

.tmuxp.yaml

+1-1
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

MANIFEST.in

+2-2
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

+12-6
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,31 @@ entr_warn:
1010
@echo "----------------------------------------------------------"
1111

1212
isort:
13-
isort `${PY_FILES}`
13+
poetry run isort `${PY_FILES}`
1414

1515
black:
16-
black `${PY_FILES}` --skip-string-normalization
16+
poetry run black `${PY_FILES}`
1717

1818
test:
19-
py.test $(test)
19+
poetry run py.test $(test)
2020

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

2424
build_docs:
25-
cd doc && $(MAKE) html
25+
$(MAKE) -C docs html
2626

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

3036
flake8:
31-
flake8 libtmux tests
37+
poetry run flake8
3238

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

README.rst

+21-43
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,11 @@ powerful traversal features::
155155
>>> pane.window.session
156156
Session($3 foo)
157157

158-
.. _MIT: http://opensource.org/licenses/MIT
159-
.. _developing and testing: http://libtmux.git-pull.com/en/latest/developing.html
158+
.. _developing and testing: http://libtmux.git-pull.com/developing.html
160159
.. _tmuxp: https://tmuxp.git-pull.com/
161160
.. _documentation: https://libtmux.git-pull.com/
162-
.. _API: https://libtmux.git-pull.com/en/latest/api.html
163-
.. _architectural details: https://libtmux.git-pull.com/en/latest/about.html
161+
.. _API: https://libtmux.git-pull.com/api.html
162+
.. _architectural details: https://libtmux.git-pull.com/about.html
164163
.. _formats: http://man.openbsd.org/OpenBSD-5.9/man1/tmux.1#FORMATS
165164
.. _target: http://man.openbsd.org/OpenBSD-5.9/man1/tmux.1#COMMANDS
166165

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

177176
Project details
178177
---------------
178+
- tmux support: 1.8, 1.9a, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
179+
- python support: 2.7, >= 3.3, pypy, pypy3
180+
- Source: https://github.com/tmux-python/libtmux
181+
- Docs: https://libtmux.git-pull.com
182+
- API: https://libtmux.git-pull.com/api.html
183+
- Changelog: https://libtmux.git-pull.com/history.html
184+
- Issues: https://github.com/tmux-python/libtmux/issues
185+
- Test Coverage: https://codecov.io/gh/tmux-python/libtmux
186+
- pypi: https://pypi.python.org/pypi/libtmux
187+
- Open Hub: https://www.openhub.net/p/libtmux-python
188+
- License: `MIT`_.
179189

180-
============== ==========================================================
181-
tmux support 1.8, 1.9a, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
182-
python support 2.7, >= 3.3, pypy, pypy3
183-
Source https://github.com/tmux-python/libtmux
184-
Docs https://libtmux.git-pull.com
185-
API https://libtmux.git-pull.com/en/latest/api.html
186-
Changelog https://libtmux.git-pull.com/en/latest/history.html
187-
Issues https://github.com/tmux-python/libtmux/issues
188-
Test Coverage https://codecov.io/gh/tmux-python/libtmux
189-
pypi https://pypi.python.org/pypi/libtmux
190-
Open Hub https://www.openhub.net/p/libtmux-python
191-
License `MIT`_.
192-
git repo .. code-block:: bash
193-
194-
$ git clone https://github.com/tmux-python/libtmux.git
195-
install stable .. code-block:: bash
196-
197-
$ pip install libtmux
198-
install dev .. code-block:: bash
199-
200-
$ git clone https://github.com/tmux-python/libtmux.git libtmux
201-
$ cd ./libtmux
202-
$ virtualenv .venv
203-
$ source .venv/bin/activate
204-
$ pip install -e .
205-
206-
See the `developing and testing`_ page in the docs for
207-
more.
208-
tests .. code-block:: bash
209-
210-
$ make test
211-
============== ==========================================================
190+
.. _MIT: http://opensource.org/licenses/MIT
212191

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

217-
.. |build-status| image:: https://github.com/tmux-python/libtmux/workflows/.github/workflows/libtmux-ci.yml/badge.svg
196+
.. |docs| image:: https://github.com/tmux-python/libtmux/workflows/Publish%20Docs/badge.svg
197+
:alt: Docs
198+
:target: https://github.com/tmux-python/libtmux/actions?query=workflow%3A"Publish+Docs"
199+
200+
.. |build-status| image:: https://github.com/tmux-python/libtmux/workflows/tests/badge.svg
218201
:alt: Build Status
219-
:target: https://github.com/tmux-python/libtmux/actions
202+
:target: https://github.com/tmux-python/tmux-python/actions?query=workflow%3A"tests"
220203

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

225208
.. |license| image:: https://img.shields.io/github/license/tmux-python/libtmux.svg
226209
:alt: License
227-
228-
.. |docs| image:: https://readthedocs.org/projects/libtmux/badge/?version=latest
229-
:alt: Documentation Status
230-
:scale: 100%
231-
:target: https://readthedocs.org/projects/libtmux/

0 commit comments

Comments
 (0)