Repository navigation
120 lines (104 loc) · 3.61 KB
/
Copy pathpython.yaml
File metadata and controls
120 lines (104 loc) · 3.61 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
name: Python SDK
on:
push:
branches: [main]
tags:
- "python/v[0-9]+.[0-9]+.[0-9]+"
- "python/v[0-9]+.[0-9]+.[0-9]+-*" # pre-releases: -alpha.N / -beta.N / -rc.N
paths:
- "sdk/python/**"
- "**.go"
- "go.mod"
- "go.sum"
- Dockerfile.fraise
- docker-compose.yaml
- mise.toml
- ".github/workflows/python.yaml"
pull_request:
paths:
- "sdk/python/**"
- "**.go"
- "go.mod"
- "go.sum"
- Dockerfile.fraise
- docker-compose.yaml
- mise.toml
- ".github/workflows/python.yaml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !contains(github.ref, 'main')}}
permissions:
contents: read
jobs:
lint:
name: Lint Python SDK
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- uses: jdx/mise-action@90f833d396d0cc3674b631d2d225e306476c303a # v5.2.10
- name: Lint
run: mise run lint:py
unit:
name: Unit tests (py${{ matrix.python }})
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: false
matrix:
python: ["3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- uses: jdx/mise-action@90f833d396d0cc3674b631d2d225e306476c303a # v5.2.10
# Only the SDK's unit tests, so no server is involved.
- name: Unit tests with coverage
env:
UV_PYTHON: ${{ matrix.python }}
run: mise run coverage:py
# Uploaded under the `python` flag so the SDK's coverage is reported
# separately from the Go server's (see codecov.yaml).
- name: Upload coverage to Codecov
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage-py.xml
flags: python
integration:
name: Integration tests (${{ matrix.runner }}, py${{ matrix.python }})
needs: unit
# The SDK must work against the server image on any architecture a user
# runs. So every published architecture is crossed with every Python the
# SDK supports, the same list as the unit job above. The runners are
# native, so each cell builds and runs the server image for its own
# architecture.
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
runner: [ubuntu-24.04, ubuntu-24.04-arm]
python: ["3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- uses: jdx/mise-action@90f833d396d0cc3674b631d2d225e306476c303a # v5.2.10
# fraise runs in a container, and Go builds inside the image. pytest
# runs here, on the matrix's Python.
- name: Run Python SDK integration tests
env:
UV_PYTHON: ${{ matrix.python }}
run: mise run test:integration:py
publish-python:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/python/v')
# integration already requires unit, so this gates on both. Nothing reaches
# PyPI unless the SDK passed against a live server on amd64 and arm64.
needs: integration
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write # PyPI trusted publishing, with no token secret
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- uses: jdx/mise-action@90f833d396d0cc3674b631d2d225e306476c303a # v5.2.10
- name: Version must match tag
run: mise run check:tag:py
- name: Build and release
run: mise run release:py