File: tests.yml

package info (click to toggle)
tmuxp 1.63.1-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 3,232 kB
  • sloc: python: 14,326; sh: 21; makefile: 6
file content (123 lines) | stat: -rw-r--r-- 3,989 bytes parent folder | download | duplicates (3)
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
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.14']
        tmux-version: ['3.2a', '3.3a', '3.4', '3.5', '3.6', 'master']
    steps:
      - uses: actions/checkout@v6

      - name: Install uv
        uses: astral-sh/setup-uv@v7
        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 tmuxp import _internal, cli, workspace, exc, log, plugin, shell, types, util, __version__
          from tmuxp._internal import config_reader, types
          from tmuxp.cli import convert, debug_info, edit, freeze, import_config, load, ls, shell, utils
          from tmuxp.workspace import builder, constants, finders, freezer, importers, loader, validation
          from libtmux import __version__ as __libtmux_version__
          print("tmuxp version:", __version__)
          print("libtmux version:", __libtmux_version__)
          '

      - name: Install dependencies
        run: uv sync --all-extras --dev

      - name: Setup tmux build cache for tmux ${{ matrix.tmux-version }}
        id: tmux-build-cache
        uses: actions/cache@v5
        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: Lint with ruff check .
        run: uv run ruff check .

      - name: Format with ruff
        run: uv run ruff format . --check

      - name: Lint with mypy
        run: uv run mypy .

      - name: Print python versions
        run: |
          python -V
          uv 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
          uv run py.test --cov=./ --cov-report=xml --verbose

      - uses: codecov/codecov-action@v5
        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
      attestations: write

    strategy:
      matrix:
        python-version: ['3.14']

    steps:
      - uses: actions/checkout@v6

      - name: Install uv
        uses: astral-sh/setup-uv@v7
        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
        run: uv build

      - name: Publish package
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          attestations: true
          skip-existing: true