Skip to content

Commit 937474a

Browse files
authored
docs,ci: Move tests to GH Actions, poetry-readiness, doc/ -> docs/, push docs to S3 (#623)
2 parents d7d444e + 06454a3 commit 937474a

Some content is hidden

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

49 files changed

+1118
-384
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/tests.yml

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
# Don't run twice for internal PRs from our own repo
8+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
9+
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: [ '2.7', '3.x' ]
14+
tmux-version: [ '2.6', '2.7', '2.8', '3.0', 'master' ]
15+
steps:
16+
- uses: actions/checkout@v1
17+
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 poetry 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: Setup tmux build cache for tmux ${{ matrix.tmux-version }}
60+
id: tmux-build-cache
61+
uses: actions/cache@v1
62+
with:
63+
path: ~/tmux-builds/tmux-${{ matrix.tmux-version }}
64+
key: tmux-${{ matrix.tmux-version }}
65+
66+
- name: Build tmux ${{ matrix.tmux-version }}
67+
if: steps.tmux-build-cache.outputs.cache-hit != 'true'
68+
run: |
69+
sudo apt install libevent-dev libncurses5-dev libtinfo-dev libutempter-dev bison
70+
mkdir ~/tmux-builds
71+
mkdir ~/tmux-src
72+
git clone https://github.com/tmux/tmux.git ~/tmux-src/tmux-${{ matrix.tmux-version }}
73+
cd ~/tmux-src/tmux-${{ matrix.tmux-version }}
74+
git checkout ${{ matrix.tmux-version }}
75+
sh autogen.sh
76+
./configure --prefix=$HOME/tmux-builds/tmux-${{ matrix.tmux-version }} && make && make install
77+
export PATH=$HOME/tmux-builds/tmux-${{ matrix.tmux-version }}/bin:$PATH
78+
cd ~
79+
tmux -V
80+
81+
- name: Upgrade pip
82+
shell: bash
83+
run: poetry run python -m pip install pip -U
84+
85+
- name: Install python dependencies
86+
run: |
87+
poetry install -E "test coverage lint"
88+
- name: Lint with flake8
89+
run: |
90+
poetry run flake8
91+
- name: Test with pytest
92+
continue-on-error: ${{ matrix.tmux-version == 'master' }}
93+
run: |
94+
export PATH=$HOME/tmux-builds/tmux-${{ matrix.tmux-version }}/bin:$PATH
95+
ls $HOME/tmux-builds/tmux-${{ matrix.tmux-version }}/bin
96+
tmux -V
97+
poetry run py.test --cov=./ --cov-report=xml
98+
- uses: codecov/codecov-action@v1
99+
with:
100+
token: ${{ secrets.CODECOV_TOKEN }}

.gitignore

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

.tmuxp.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"options": {
2828
"main-pane-height": 35
2929
},
30-
"start_directory": "doc/",
30+
"start_directory": "docs/",
3131
"panes": [
3232
{
3333
"focus": true
@@ -38,4 +38,4 @@
3838
]
3939
}
4040
]
41-
}
41+
}

.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

.travis.yml

-65
This file was deleted.

CHANGES

+10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ Changelog
44

55
Here you can find the recent changes to tmuxp
66

7+
current
8+
-------
9+
- :issue:`623` Move docs from RTD to self-serve site
10+
- :issue:`623` Modernize Makefiles
11+
- :issue:`623` New development docs
12+
- :issue:`623` Move doc -> docs
13+
- :issue:`623` Move tests to GitHub Actions
14+
- :issue:`623` Update pyproject.toml to experiment with poetry packaging
15+
- :issue:`619` isort 5
16+
717
tmuxp 1.5.5 (2020-07-26)
818
------------------------
919
- :issue:`616` (via: :issue:`599`) New command: ``tmuxp ls``

MANIFEST.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
44
recursive-include tests *.py *.yaml *.json *.sh
55
recursive-include examples *.yaml *.json

Makefile

+12-4
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
entr_warn:
46
@echo "----------------------------------------------------------"
@@ -12,7 +14,7 @@ isort:
1214
poetry run isort `${PY_FILES}`
1315

1416
black:
15-
poetry run black `${PY_FILES}` --skip-string-normalization
17+
poetry run black `${PY_FILES}`
1618

1719
test:
1820
poetry run py.test $(test)
@@ -21,13 +23,19 @@ watch_test:
2123
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) test; else $(MAKE) test entr_warn; fi
2224

2325
build_docs:
24-
cd doc && $(MAKE) html
26+
$(MAKE) -C docs html
2527

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

2937
flake8:
30-
poetry run flake8 tmuxp tests
38+
poetry run flake8
3139

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

0 commit comments

Comments
 (0)