Skip to content

Commit 47ee1d7

Browse files
Add dependency resolution to test matrix (#355)
via https://docs.astral.sh/uv/reference/cli/#uv-run--resolution: > By default, uv will use the latest compatible version of each package (highest). And uv suggests for libraries to test with lowest or lowest-direct resolution: > When publishing libraries, it is recommended to separately run tests > with --resolution lowest or --resolution lowest-direct in continuous > integration to ensure compatibility with the declared lower bounds. Ref: https://docs.astral.sh/uv/concepts/resolution/#resolution-strategy
1 parent 6b59c4e commit 47ee1d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+194
-158
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
21+
resolution: ["highest", "lowest-direct"]
2122
steps:
2223
- name: Checkout code
2324
uses: actions/checkout@v5
@@ -31,13 +32,17 @@ jobs:
3132
- uses: astral-sh/setup-uv@v6
3233
with:
3334
python-version: ${{ matrix.python-version }}
35+
- name: Install dependencies with resolution ${{ matrix.resolution }}
36+
run: UV_RESOLUTION=${{ matrix.resolution }} make install
3437
- name: Execute tests
3538
run: make test
3639
- name: Lint
3740
run: make lint
3841
- name: Format
3942
run: make format
40-
- name: Check generated
43+
# When running with matrix.resolution == lowest, we expect uv.lock to change, but we don't want that file checked in.
44+
- if: matrix.resolution == 'highest'
45+
name: Check generated
4146
run: make checkgenerate
4247
env:
4348
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}

.github/workflows/conformance.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
21+
resolution: ["highest", "lowest-direct"]
2122
steps:
2223
- name: Checkout code
2324
uses: actions/checkout@v5
@@ -29,7 +30,7 @@ jobs:
2930
go-version: stable
3031
cache: false
3132
- uses: astral-sh/setup-uv@v6
32-
- name: Install Python ${{ matrix.python-version }}
33-
run: uv python install ${{ matrix.python-version }}
33+
with:
34+
python-version: ${{ matrix.python-version }}
3435
- name: Test conformance
35-
run: make conformance
36+
run: UV_RESOLUTION=${{ matrix.resolution }} make conformance

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ lint: install $(BIN)/buf ## Lint code
7070
uv run -- ruff format --check --diff protovalidate test
7171
uv run -- mypy protovalidate
7272
uv run -- ruff check protovalidate test
73-
uv sync --locked
73+
uv lock --check
7474

7575
.PHONY: install
7676
install: ## Install dependencies

buf.gen.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ version: v2
22
managed:
33
enabled: true
44
plugins:
5-
- remote: buf.build/protocolbuffers/python:v30.1
5+
# NOTE: v30.0 is the earliest version supporting protobuf==6.
6+
- remote: buf.build/protocolbuffers/python:v30.0
67
out: gen
7-
- remote: buf.build/protocolbuffers/pyi:v30.1
8+
- remote: buf.build/protocolbuffers/pyi:v30.0
89
out: gen

gen/buf/validate/conformance/cases/bool_pb2.py

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/buf/validate/conformance/cases/bytes_pb2.py

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/buf/validate/conformance/cases/custom_rules/custom_rules_pb2.py

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/buf/validate/conformance/cases/enums_pb2.py

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/buf/validate/conformance/cases/filename_with_dash_pb2.py

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/buf/validate/conformance/cases/ignore_empty_proto2_pb2.py

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)