Skip to content

Commit d58c678

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

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,35 +47,34 @@ 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-
- uses: actions/cache@v4
57-
id: cache
58-
with:
59-
path: ${{ env.pythonLocation }}
60-
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-tests.txt') }}-{{ matrix.pydantic-version }}
56+
- name: Install uv
57+
uses: astral-sh/setup-uv@v7
6158
# Allow debugging with tmate
6259
- name: Setup tmate session
6360
uses: mxschmitt/action-tmate@v3
6461
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
6562
with:
6663
limit-access-to-actor: true
6764
- name: Install Dependencies
68-
if: steps.cache.outputs.cache-hit != 'true'
69-
run: pip install -r requirements-tests.txt
65+
run: uv sync --locked --all-extras --dev
7066
- name: Install Pydantic v1
7167
if: matrix.pydantic-version == 'v1'
72-
run: pip install "pydantic<2.0.0"
68+
run: uv pip install "pydantic<2.0.0"
7369
- name: Lint
7470
run: bash scripts/lint.sh
71+
env:
72+
UV_NO_SYNC: "1"
7573
- run: mkdir coverage
7674
- name: Test
7775
run: bash scripts/test.sh
7876
env:
77+
UV_NO_SYNC: "1"
7978
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
8079
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
8180
- name: Store coverage files
@@ -94,9 +93,9 @@ jobs:
9493
GITHUB_CONTEXT: ${{ toJson(github) }}
9594
run: echo "$GITHUB_CONTEXT"
9695
- uses: actions/checkout@v5
97-
- uses: actions/setup-python@v5
96+
- uses: actions/setup-python@v6
9897
with:
99-
python-version: '3.8'
98+
python-version-file: "pyproject.toml"
10099
# Issue ref: https://github.com/actions/setup-python/issues/436
101100
# cache: "pip"
102101
# 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 mypy src tests
7+
uv run ruff check src tests scripts
8+
uv run 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 coverage run -m pytest tests ${@}

0 commit comments

Comments
 (0)