-
Notifications
You must be signed in to change notification settings - Fork 9
148 lines (125 loc) · 4.65 KB
/
ci.yaml
File metadata and controls
148 lines (125 loc) · 4.65 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
143
144
145
146
147
148
name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
permissions:
contents: read
attestations: write
id-token: write
concurrency:
# Cancel in-progress jobs for PRs only
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.sha || github.ref }}
cancel-in-progress: true
jobs:
ci:
runs-on: ${{ matrix.os }}
strategy:
matrix:
resolution: ["highest", "lowest-direct"]
os:
- macos-15
- ubuntu-24.04
- windows-2025
python:
- "3.10"
- "3.14"
coverage:
- "nocov"
# Test oldest and newest on all OS's, but others only on one
# to save CI load.
include:
- os: ubuntu-24.04
python: "3.11"
coverage: "nocov"
resolution: "lowest-direct"
- os: ubuntu-24.04
python: "3.12"
coverage: "nocov"
resolution: "lowest-direct"
- os: ubuntu-24.04
python: "3.13"
coverage: "nocov"
resolution: "lowest-direct"
# Enable coverage on just one job
- os: ubuntu-24.04
python: "3.14"
coverage: "cov"
resolution: "lowest-direct"
env:
# Shared env variables for all the tests
UV_RESOLUTION: "${{ matrix.resolution }}"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: ${{ matrix.python }}
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: protoc-gen-connect-python/go.mod
cache-dependency-path: "**/go.mod"
- run: uv sync --frozen
- name: run lints
if: startsWith(matrix.os, 'ubuntu-')
run: uv run poe lint
- name: check running generate does not create a diff
# NOTE: running on macOS as our sed command only works there
# We expect uv.lock to change when matrix.resolution == "lowest-direct", so we don't check it there.
if: ${{ startsWith(matrix.os, 'macos-') && matrix.resolution == 'highest' }}
run: uv run poe checkgenerate
env:
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
- name: run python tests
run: uv run poe test ${{ matrix.coverage == 'cov' && '--cov=connectrpc --cov-report=xml' || '' }}
- name: run OTel tests
run: uv run poe test-otel ${{ matrix.coverage == 'cov' && '--cov=connectrpc_otel --cov-report=xml' || '' }}
- name: run Go tests
run: go test ./...
working-directory: protoc-gen-connect-python
- name: run conformance tests
# TODO: Debug stdin/stdout issues on Windows
if: ${{ !startsWith(matrix.os, 'windows-') }}
run: uv run poe test-conformance ${{ matrix.coverage == 'cov' && '--cov=connectrpc --cov-report=xml' || '' }}
- uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
if: ${{ matrix.coverage == 'cov' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
publish:
runs-on: ubuntu-24.04
needs: ci
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- run: uv sync --frozen
- run: uv build
# Builds to root dist directory so published together with the main project.
- run: uv build
working-directory: connectrpc-otel
- name: build codegen archives
uses: goreleaser/goreleaser-action@1a80836c5c9d9e5755a25cb59ec6f45a3b5f41a8 # v7.2.1
with:
version: "~> v2"
args: release --snapshot --clean
workdir: protoc-gen-connect-python
- run: |
uv sync --frozen
uv run python scripts/generate_wheels.py
working-directory: protoc-gen-connect-python
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
if: github.event_name != 'pull_request'
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: publish protoc-gen-connect-python
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
if: github.event_name != 'pull_request'
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: protoc-gen-connect-python/dist
skip-existing: true