Skip to content

Add exception to metadata interceptors on_end #471

Add exception to metadata interceptors on_end

Add exception to metadata interceptors on_end #471

Workflow file for this run

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:
build:
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
- uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
with:
python-version: ${{ matrix.python }}
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: protoc-gen-connect-python/go.mod
cache-dependency-path: "**/go.mod"
- run: uv sync
- name: run lints
if: startsWith(matrix.os, 'ubuntu-')
run: |
uv run ruff format --check .
uv run ruff check .
uv run pyright
- name: run python tests
run: uv run pytest ${{ matrix.coverage == 'cov' && '--cov=connectrpc --cov-report=xml' || '' }}
- name: run conformance tests
# TODO: Debug stdin/stdout issues on Windows
if: ${{ !startsWith(matrix.os, 'windows-') }}
run: uv run pytest ${{ matrix.coverage == 'cov' && '--cov=connectrpc --cov-report=xml' || '' }}
working-directory: conformance
- name: run Go tests
run: go test ./...
working-directory: protoc-gen-connect-python
- name: check running `just 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 just checkgenerate
env:
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
if: ${{ matrix.coverage == 'cov' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
publish:
runs-on: ubuntu-24.04
needs: build
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
- run: uv sync --frozen
- run: uv build
- name: build codegen archives
uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.0
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@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.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@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.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