Cleanup protoc-gen-connect-python (#8) #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | |
| os: | |
| - macos-15 | |
| - ubuntu-24.04 | |
| - windows-2025 | |
| python: | |
| - "3.10" | |
| - "3.13" | |
| 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" | |
| - os: ubuntu-24.04 | |
| python: "3.12" | |
| coverage: "nocov" | |
| # Enable coverage on just one job | |
| - os: ubuntu-24.04 | |
| python: "3.13" | |
| coverage: "cov" | |
| - os: ubuntu-24.04 | |
| python: "3.14.0-rc.2" | |
| coverage: "nocov" | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v6.6.1 | |
| - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.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 tests with minimal dependencies | |
| run: uv run --exact pytest ${{ matrix.coverage == 'cov' && '--cov=connectrpc --cov-report=xml' || '' }} | |
| working-directory: noextras | |
| - name: run Go tests | |
| run: go test ./... | |
| working-directory: protoc-gen-connect-python | |
| - uses: codecov/codecov-action@v5 | |
| if: ${{ matrix.coverage == 'cov' }} | |
| publish: | |
| runs-on: ubuntu-24.04 | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version-file: pyproject.toml | |
| - run: uv sync --frozen | |
| - run: uv build | |
| - name: build codegen archives | |
| uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.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@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 | |
| 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@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 | |
| if: github.event_name != 'pull_request' | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| packages-dir: protoc-gen-connect-python/dist | |
| skip-existing: true |