Skip to content

Commit 4d7a531

Browse files
committed
Migrate the test workflow to uv
1 parent b59d64d commit 4d7a531

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,19 @@ jobs:
4747
run: echo "$GITHUB_CONTEXT"
4848
- uses: actions/checkout@v5
4949
- name: Set up Python
50-
uses: actions/setup-python@v5
50+
uses: actions/setup-python@v6
5151
with:
5252
python-version: ${{ matrix.python-version }}
5353
# Issue ref: https://github.com/actions/setup-python/issues/436
5454
# cache: "pip"
5555
# cache-dependency-path: pyproject.toml
56+
- name: Install uv
57+
uses: astral-sh/setup-uv@v7
5658
- uses: actions/cache@v4
5759
id: cache
5860
with:
5961
path: ${{ env.pythonLocation }}
60-
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-tests.txt') }}-{{ matrix.pydantic-version }}
62+
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'uv.lock') }}-{{ matrix.pydantic-version }}
6163
# Allow debugging with tmate
6264
- name: Setup tmate session
6365
uses: mxschmitt/action-tmate@v3
@@ -66,10 +68,10 @@ jobs:
6668
limit-access-to-actor: true
6769
- name: Install Dependencies
6870
if: steps.cache.outputs.cache-hit != 'true'
69-
run: pip install -r requirements-tests.txt
71+
run: uv sync --locked --all-extras --dev
7072
- name: Install Pydantic v1
7173
if: matrix.pydantic-version == 'v1'
72-
run: pip install "pydantic<2.0.0"
74+
run: uv pip install "pydantic<2.0.0"
7375
- name: Lint
7476
run: bash scripts/lint.sh
7577
- run: mkdir coverage
@@ -94,9 +96,9 @@ jobs:
9496
GITHUB_CONTEXT: ${{ toJson(github) }}
9597
run: echo "$GITHUB_CONTEXT"
9698
- uses: actions/checkout@v5
97-
- uses: actions/setup-python@v5
99+
- uses: actions/setup-python@v6
98100
with:
99-
python-version: '3.8'
101+
python-version-file: "pyproject.toml"
100102
# Issue ref: https://github.com/actions/setup-python/issues/436
101103
# cache: "pip"
102104
# cache-dependency-path: pyproject.toml

scripts/lint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
set -e
44
set -x
55

6-
mypy src tests
7-
ruff check src tests scripts
8-
ruff format src tests --check
6+
uv run --no-sync mypy src tests
7+
uv run --no-sync ruff check src tests scripts
8+
uv run --no-sync ruff format src tests --check

scripts/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
set -e
44
set -x
55

6-
coverage run -m pytest tests ${@}
6+
uv run --no-sync coverage run -m pytest tests ${@}

0 commit comments

Comments
 (0)