-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (97 loc) · 2.64 KB
/
Copy pathpython-publish.yml
File metadata and controls
116 lines (97 loc) · 2.64 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
name: Publish Python Package
on:
release:
types: [published]
push:
tags:
- "v*"
workflow_dispatch:
jobs:
pytest-modern:
name: pytest (Python ${{ matrix.python-version }})
runs-on: ubuntu-22.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.12"]
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: uv sync --dev
- name: Run tests
run: uv run pytest -q
pytest-py36:
name: pytest (Python 3.6)
runs-on: ubuntu-22.04
permissions:
contents: read
container:
image: python:3.6.15-slim-bullseye
steps:
- name: Install system dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends git
- name: Check out repository
uses: actions/checkout@v4
- name: Mark workspace as safe for git
run: git config --global --add safe.directory "$PWD"
- name: Show runtime versions
run: |
python --version
pip --version
git --version
- name: Install Python 3.6 test dependencies
run: python -m pip install "pytest>=6.2.5,<7"
- name: Run Python 3.6 tests
env:
PYTHONPATH: ${{ github.workspace }}
run: python -m pytest -q
build:
name: Build distributions
needs: [pytest-modern, pytest-py36]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build distributions
run: uv build
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/tmux-wrapper
permissions:
id-token: write
steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1