Skip to content

Commit 0330147

Browse files
authored
Merge branch 'master' into support-conf-file
2 parents ca79acb + a937b4b commit 0330147

File tree

154 files changed

+8981
-21044
lines changed

Some content is hidden

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

154 files changed

+8981
-21044
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

CONTRIBUTING.md renamed to .github/contributing.md

+11
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,14 @@ Please note we have a code of conduct, please follow it in all your interactions
2222
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
2323
7. You may merge the Pull Request in once you have the sign-off of one other developer. If you
2424
do not have permission to do that, you may request reviewer to merge it for you.
25+
26+
## Decorum
27+
28+
- Participants will be tolerant of opposing views.
29+
- Participants must ensure that their language and actions are free of personal
30+
attacks and disparaging personal remarks.
31+
- When interpreting the words and actions of others, participants should always
32+
assume good intentions.
33+
- Behaviour which can be reasonably considered harassment will not be tolerated.
34+
35+
Based on [Ruby's Community Conduct Guideline](https://www.ruby-lang.org/en/conduct/)

.github/issue_template.md

+3-16
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,10 @@
22
* For general technical questions, problems or feature requests related to the code **in this repository** file an issue.
33

44
### Step 2: Provide tmuxp details
5-
* Python version
6-
* system PATH
7-
* tmux version
8-
* tmuxp version
9-
* tmux path
10-
* tmuxp path,
11-
* libtmux version
12-
* shell
13-
* output of `tmux list-sessions`, `tmux list-windows`, `tmux list-panes`
14-
* output of `tmux show-options -g`, `tmux show-window-options -g`
15-
* output of `tmuxp freeze <SESSION_NAME>`
5+
* Include output of `tmuxp debug-info`
6+
* Include any other pertinant system info not captured
167

17-
### Step 3: Describe your environment
18-
* Architecture: _____
19-
* OS version: _____
20-
21-
### Step 4: Describe the problem:
8+
### Step 3: Describe the problem:
229
#### Steps to reproduce:
2310
1. _____
2411
2. _____

.github/workflows/publish-docs.yml

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

.github/workflows/tests.yml

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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: [ '3.10' ]
14+
tmux-version: [ '2.6', '2.7', '2.8', '3.0a', '3.1b', '3.2a', '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://install.python-poetry.org/install-poetry.py
31+
python install-poetry.py -y --version 1.1.12
32+
echo "PATH=${HOME}/.poetry/bin:${PATH}" >> $GITHUB_ENV
33+
rm install-poetry.py
34+
35+
- name: Add ~/.local/bin to PATH
36+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
37+
38+
- name: Get poetry cache paths from config
39+
run: |
40+
echo "poetry_cache_dir=$(poetry config --list | sed -n 's/.*cache-dir = //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
41+
echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
42+
43+
- name: Configure poetry
44+
shell: bash
45+
run: poetry config virtualenvs.in-project true
46+
47+
- name: Set up poetry cache
48+
uses: actions/cache@v2
49+
id: cache
50+
with:
51+
path: |
52+
.venv
53+
${{ env.poetry_cache_dir }}
54+
${{ env.poetry_virtualenvs_path }}
55+
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
56+
57+
- name: Ensure cache is healthy
58+
if: steps.cache.outputs.cache-hit == 'true'
59+
shell: bash
60+
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
61+
62+
- name: Setup tmux build cache for tmux ${{ matrix.tmux-version }}
63+
id: tmux-build-cache
64+
uses: actions/cache@v1
65+
with:
66+
path: ~/tmux-builds/tmux-${{ matrix.tmux-version }}
67+
key: tmux-${{ matrix.tmux-version }}
68+
69+
- name: Build tmux ${{ matrix.tmux-version }}
70+
if: steps.tmux-build-cache.outputs.cache-hit != 'true'
71+
run: |
72+
sudo apt install libevent-dev libncurses5-dev libtinfo-dev libutempter-dev bison
73+
mkdir ~/tmux-builds
74+
mkdir ~/tmux-src
75+
git clone https://github.com/tmux/tmux.git ~/tmux-src/tmux-${{ matrix.tmux-version }}
76+
cd ~/tmux-src/tmux-${{ matrix.tmux-version }}
77+
git checkout ${{ matrix.tmux-version }}
78+
sh autogen.sh
79+
./configure --prefix=$HOME/tmux-builds/tmux-${{ matrix.tmux-version }} && make && make install
80+
export PATH=$HOME/tmux-builds/tmux-${{ matrix.tmux-version }}/bin:$PATH
81+
cd ~
82+
tmux -V
83+
84+
- name: Upgrade pip
85+
shell: bash
86+
run: poetry run python -m pip install pip -U
87+
88+
- name: Install python dependencies
89+
run: |
90+
poetry install -E "test coverage lint"
91+
- name: Lint with flake8
92+
run: |
93+
poetry run flake8
94+
- name: Test with pytest
95+
continue-on-error: ${{ matrix.tmux-version == 'master' }}
96+
run: |
97+
export PATH=$HOME/tmux-builds/tmux-${{ matrix.tmux-version }}/bin:$PATH
98+
ls $HOME/tmux-builds/tmux-${{ matrix.tmux-version }}/bin
99+
tmux -V
100+
poetry run py.test --cov=./ --cov-report=xml
101+
- uses: codecov/codecov-action@v1
102+
with:
103+
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

.gitmodules

-1
This file was deleted.

.pre-commit-config.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 22.1.0
4+
hooks:
5+
- id: black
6+
language_version: python3.10
7+
- repo: https://github.com/pycqa/isort
8+
rev: 5.10.1
9+
hooks:
10+
- id: isort
11+
name: isort (python)
12+
- repo: https://github.com/PyCQA/flake8
13+
rev: 4.0.1
14+
hooks:
15+
- id: flake8

.tmuxp-before-script.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
poetry shell --no-ansi --no-interaction &2> /dev/null
3+
poetry install --no-ansi --no-interaction &2> /dev/null

.tmuxp.json

+27-27
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
{
2-
"before_script": "pipenv install --dev --skip-lock",
2+
"session_name": "tmuxp",
3+
"start_directory": "./",
4+
"before_script": "./.tmuxp-before-script.sh",
5+
"shell_command_before": [
6+
"[ -f .venv/bin/activate ] && source .venv/bin/activate && reset"
7+
],
38
"windows": [
49
{
10+
"window_name": "tmuxp",
11+
"focus": true,
12+
"layout": "main-horizontal",
13+
"options": {
14+
"main-pane-height": 35
15+
},
516
"panes": [
617
{
718
"focus": true
8-
},
9-
"pane",
19+
},
20+
"pane",
1021
"make watch_test"
11-
],
12-
"layout": "main-horizontal",
22+
]
23+
},
24+
{
25+
"window_name": "docs",
26+
"layout": "main-horizontal",
1327
"options": {
1428
"main-pane-height": 35
15-
},
16-
"focus": true,
17-
"window_name": "tmuxp"
18-
},
19-
{
29+
},
30+
"start_directory": "docs/",
2031
"panes": [
2132
{
2233
"focus": true
23-
},
24-
"pane",
25-
"make serve",
26-
"make watch"
27-
],
28-
"start_directory": "doc/",
29-
"layout": "main-horizontal",
30-
"window_name": "docs",
31-
"options": {
32-
"main-pane-height": 35
33-
}
34+
},
35+
"pane",
36+
"make serve",
37+
"make SPHINXBUILD='poetry run sphinx-build' watch"
38+
]
3439
}
35-
],
36-
"session_name": "tmuxp",
37-
"start_directory": "./",
38-
"shell_command_before": [
39-
"[ -d `pipenv --venv` ] && source `pipenv --venv`/bin/activate && reset"
4040
]
41-
}
41+
}

0 commit comments

Comments
 (0)