Repository navigation
142 lines (116 loc) · 4.54 KB
/
Copy pathtests.yml
File metadata and controls
142 lines (116 loc) · 4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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
permissions:
contents: read
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
python-version: ['3.15']
tmux-version: ['3.2a', '3.3a', '3.4', '3.5', '3.6', '3.7a', '3.7b', '3.8', 'master']
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v10.2.0
with:
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Test runtime dependencies
run: |
uv run --no-dev -p python${{ matrix.python-version }} -- python -c '
from libtmux import common, constants, exc, formats, neo, pane, server, session, window, __version__
server = server.Server()
print("libtmux version:", __version__)
print("libtmux Server:", server)
'
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Install tmux build and runtime dependencies
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends \
autoconf automake bison build-essential libevent-dev \
libncurses-dev libutempter-dev pkg-config
- name: Identify tmux source and build environment
id: tmux-build
run: uv run python .github/scripts/tmux_build.py plan "$TMUX_VERSION"
env:
TMUX_VERSION: ${{ matrix.tmux-version }}
- name: Restore tmux ${{ matrix.tmux-version }}
id: tmux-build-cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ steps.tmux-build.outputs.prefix }}
key: ${{ steps.tmux-build.outputs.key }}
- name: Validate or rebuild tmux ${{ matrix.tmux-version }}
run: uv run python .github/scripts/tmux_build.py prepare "$TMUX_VERSION"
env:
TMUX_VERSION: ${{ matrix.tmux-version }}
CACHE_HIT: ${{ steps.tmux-build-cache.outputs.cache-hit }}
- name: Save validated tmux ${{ matrix.tmux-version }}
if: steps.tmux-build-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ steps.tmux-build.outputs.prefix }}
key: ${{ steps.tmux-build.outputs.key }}
- name: Test native cache recovery
run: uv run pytest .github/scripts/test_tmux_build.py --reruns=0
- name: Lint with ruff check
run: uv run ruff check . .github/scripts
- name: Format with ruff format
run: uv run ruff format . .github/scripts --check
- name: Lint with mypy
run: |
uv run mypy .
uv run mypy --python-version 3.11 .github/scripts
- name: Print python versions
run: |
python -V
uv run python -V
- name: Test with pytest
continue-on-error: ${{ matrix.tmux-version == 'master' }}
run: |
tmux -V
uv run py.test --cov=./ --cov-append --cov-report=xml -n auto --verbose
env:
COV_CORE_SOURCE: .
COV_CORE_CONFIG: .coveragerc
COV_CORE_DATAFILE: .coverage.eager
- uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
release:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
permissions:
id-token: write # Required for OIDC trusted publishing
attestations: write # Required for generating attestations
strategy:
matrix:
python-version: ['3.14']
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v10.2.0
with:
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Build package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: uv build
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
skip-existing: true