Skip to content

Commit

Permalink
Merge branch 'master' into support-conf-file
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Feb 5, 2022
2 parents ca79acb + a937b4b commit 0330147
Show file tree
Hide file tree
Showing 154 changed files with 8,981 additions and 21,044 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
11 changes: 11 additions & 0 deletions CONTRIBUTING.md → .github/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,14 @@ Please note we have a code of conduct, please follow it in all your interactions
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
7. You may merge the Pull Request in once you have the sign-off of one other developer. If you
do not have permission to do that, you may request reviewer to merge it for you.

## Decorum

- Participants will be tolerant of opposing views.
- Participants must ensure that their language and actions are free of personal
attacks and disparaging personal remarks.
- When interpreting the words and actions of others, participants should always
assume good intentions.
- Behaviour which can be reasonably considered harassment will not be tolerated.

Based on [Ruby's Community Conduct Guideline](https://www.ruby-lang.org/en/conduct/)
19 changes: 3 additions & 16 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,10 @@
* For general technical questions, problems or feature requests related to the code **in this repository** file an issue.

### Step 2: Provide tmuxp details
* Python version
* system PATH
* tmux version
* tmuxp version
* tmux path
* tmuxp path,
* libtmux version
* shell
* output of `tmux list-sessions`, `tmux list-windows`, `tmux list-panes`
* output of `tmux show-options -g`, `tmux show-window-options -g`
* output of `tmuxp freeze <SESSION_NAME>`
* Include output of `tmuxp debug-info`
* Include any other pertinant system info not captured

### Step 3: Describe your environment
* Architecture: _____
* OS version: _____

### Step 4: Describe the problem:
### Step 3: Describe the problem:
#### Steps to reproduce:
1. _____
2. _____
Expand Down
133 changes: 133 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Publish Docs

on:
push:
branches:
- master

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10' ]
steps:
- uses: actions/checkout@v1
- name: Configure git
run: |
git config --global user.name 'travis-ci'
git config --global user.email 'travis@nowhere.edu'
- name: Filter changed file paths to outputs
uses: dorny/paths-filter@v2.7.0
id: changes
with:
filters: |
root_docs:
- CHANGES
- README.*
docs:
- 'docs/**/*.rst'
- 'docs/**/*.md'
- 'examples/**'
python_files:
- 'tmuxp/**'
- name: Should publish
if: steps.changes.outputs.docs == 'true' || steps.changes.outputs.root_docs == 'true' || steps.changes.outputs.python_files == 'true'
run: echo "PUBLISH=$(echo true)" >> $GITHUB_ENV

- 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
if: env.PUBLISH == 'true'
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
if: env.PUBLISH == 'true'
run: |
curl -O -sSL https://install.python-poetry.org/install-poetry.py
python install-poetry.py -y --version 1.1.12
echo "PATH=${HOME}/.poetry/bin:${PATH}" >> $GITHUB_ENV
rm install-poetry.py
- name: Add ~/.local/bin to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Get poetry cache paths from config
if: env.PUBLISH == 'true'
run: |
echo "poetry_cache_dir=$(poetry config --list | sed -n 's/.*cache-dir = //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
- name: Configure poetry
if: env.PUBLISH == 'true'
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' && env.PUBLISH == 'true'
shell: bash
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv

- name: Upgrade pip
shell: bash
if: env.PUBLISH == 'true'
run: poetry run python -m pip install pip -U

- name: Install dependencies [w/ docs]
if: env.PUBLISH == 'true'
run: poetry install --extras "docs lint"

- name: Build documentation
if: env.PUBLISH == 'true'
run: |
pushd docs; make SPHINXBUILD='poetry run sphinx-build' html; popd
- name: Push documentation to S3
if: env.PUBLISH == 'true'
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
if: env.PUBLISH == 'true'
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
if: env.PUBLISH == 'true'
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
103 changes: 103 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: tests

on: [push, pull_request]

jobs:
build:
# Don't run twice for internal PRs from our own repo
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10' ]
tmux-version: [ '2.6', '2.7', '2.8', '3.0a', '3.1b', '3.2a', 'master' ]
steps:
- uses: actions/checkout@v1

- 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://install.python-poetry.org/install-poetry.py
python install-poetry.py -y --version 1.1.12
echo "PATH=${HOME}/.poetry/bin:${PATH}" >> $GITHUB_ENV
rm install-poetry.py
- name: Add ~/.local/bin to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Get poetry cache paths from config
run: |
echo "poetry_cache_dir=$(poetry config --list | sed -n 's/.*cache-dir = //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
- name: Configure poetry
shell: bash
run: poetry config virtualenvs.in-project true

- name: Set up poetry 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: Setup tmux build cache for tmux ${{ matrix.tmux-version }}
id: tmux-build-cache
uses: actions/cache@v1
with:
path: ~/tmux-builds/tmux-${{ matrix.tmux-version }}
key: tmux-${{ matrix.tmux-version }}

- name: Build tmux ${{ matrix.tmux-version }}
if: steps.tmux-build-cache.outputs.cache-hit != 'true'
run: |
sudo apt install libevent-dev libncurses5-dev libtinfo-dev libutempter-dev bison
mkdir ~/tmux-builds
mkdir ~/tmux-src
git clone https://github.com/tmux/tmux.git ~/tmux-src/tmux-${{ matrix.tmux-version }}
cd ~/tmux-src/tmux-${{ matrix.tmux-version }}
git checkout ${{ matrix.tmux-version }}
sh autogen.sh
./configure --prefix=$HOME/tmux-builds/tmux-${{ matrix.tmux-version }} && make && make install
export PATH=$HOME/tmux-builds/tmux-${{ matrix.tmux-version }}/bin:$PATH
cd ~
tmux -V
- name: Upgrade pip
shell: bash
run: poetry run python -m pip install pip -U

- name: Install python dependencies
run: |
poetry install -E "test coverage lint"
- name: Lint with flake8
run: |
poetry run flake8
- name: Test with pytest
continue-on-error: ${{ matrix.tmux-version == 'master' }}
run: |
export PATH=$HOME/tmux-builds/tmux-${{ matrix.tmux-version }}/bin:$PATH
ls $HOME/tmux-builds/tmux-${{ matrix.tmux-version }}/bin
tmux -V
poetry run py.test --cov=./ --cov-report=xml
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
*,cover
*.cover
.hypothesis/
.pytest_cache/

Expand Down
1 change: 0 additions & 1 deletion .gitmodules

This file was deleted.

15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
repos:
- repo: https://github.com/psf/black
rev: 22.1.0
hooks:
- id: black
language_version: python3.10
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
3 changes: 3 additions & 0 deletions .tmuxp-before-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
poetry shell --no-ansi --no-interaction &2> /dev/null
poetry install --no-ansi --no-interaction &2> /dev/null
54 changes: 27 additions & 27 deletions .tmuxp.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
{
"before_script": "pipenv install --dev --skip-lock",
"session_name": "tmuxp",
"start_directory": "./",
"before_script": "./.tmuxp-before-script.sh",
"shell_command_before": [
"[ -f .venv/bin/activate ] && source .venv/bin/activate && reset"
],
"windows": [
{
"window_name": "tmuxp",
"focus": true,
"layout": "main-horizontal",
"options": {
"main-pane-height": 35
},
"panes": [
{
"focus": true
},
"pane",
},
"pane",
"make watch_test"
],
"layout": "main-horizontal",
]
},
{
"window_name": "docs",
"layout": "main-horizontal",
"options": {
"main-pane-height": 35
},
"focus": true,
"window_name": "tmuxp"
},
{
},
"start_directory": "docs/",
"panes": [
{
"focus": true
},
"pane",
"make serve",
"make watch"
],
"start_directory": "doc/",
"layout": "main-horizontal",
"window_name": "docs",
"options": {
"main-pane-height": 35
}
},
"pane",
"make serve",
"make SPHINXBUILD='poetry run sphinx-build' watch"
]
}
],
"session_name": "tmuxp",
"start_directory": "./",
"shell_command_before": [
"[ -d `pipenv --venv` ] && source `pipenv --venv`/bin/activate && reset"
]
}
}
Loading

0 comments on commit 0330147

Please sign in to comment.