Repository navigation
88 lines (81 loc) · 2.27 KB
/
Copy pathpython.yml
File metadata and controls
88 lines (81 loc) · 2.27 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
name: Build and Test
on:
# Pushes to PR branches are covered by the pull_request event; running
# on every push as well would test each PR twice. Tags must be kept so
# that the pypi-publish job runs on release.
push:
branches: [main]
tags: ["*"]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build distribution
run: python -m build
- uses: actions/upload-artifact@v7
with:
path: ./dist/*
test:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12", "3.13", "3.14"]
services:
rabbitmq:
image: rabbitmq:3
ports:
- 5672:5672
options: >-
--health-cmd "rabbitmq-diagnostics -q check_port_connectivity"
--health-interval 5s
--health-timeout 5s
--health-retries 12
env:
RABBITMQ_HOST: localhost
RABBITMQ_PORT: 5672
steps:
- uses: actions/checkout@v7
- uses: actions/download-artifact@v8
with:
name: artifact
path: dist
- name: Set up uv with Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v10.3.3
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
- name: Install dependencies
run: |
uv sync --locked --no-install-project
uv pip install dist/*.whl
- name: Test with pytest
run: |
pytest tests
pypi-publish:
name: Upload release to PyPI
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/workflows
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: artifact
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3