tests: Create regression testcase for #915 #3398
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.12'] | |
tmux-version: ['2.6', '2.7', '2.8', '3.0a', '3.1b', '3.2a', '3.3a', '3.4', 'master'] | |
# balance ci coverage across supported python/tmux versions with CI speed | |
include: | |
- python-version: '3.8' | |
tmux-version: '2.6' | |
- python-version: '3.8' | |
tmux-version: 'master' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install "poetry==1.8.1" | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'poetry' | |
- name: Setup tmux build cache for tmux ${{ matrix.tmux-version }} | |
id: tmux-build-cache | |
uses: actions/cache@v4 | |
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: Install python dependencies | |
run: poetry install --with=test,coverage,lint | |
- name: Lint with ruff check . | |
run: poetry run ruff check . | |
- name: Format with ruff | |
run: poetry run ruff format . --check | |
- name: Lint with mypy | |
run: poetry run mypy . | |
- name: Print python versions | |
run: | | |
python -V | |
poetry run python -V | |
- name: Test with pytest | |
continue-on-error: ${{ matrix.tmux-version == 'master' }} | |
run: | | |
sudo apt install libevent-2.1-7 | |
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@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
strategy: | |
matrix: | |
python-version: ['3.12'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install "poetry==1.8.1" | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'poetry' | |
- name: Build package | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
run: poetry build | |
- name: Publish package | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
skip_existing: true |