Skip to content

Commit d0a10ae

Browse files
authored
Switch CI and docs build to UV (#179)
1 parent 49a76fd commit d0a10ae

File tree

4 files changed

+34
-46
lines changed

4 files changed

+34
-46
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,20 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v6
12-
- uses: actions/setup-python@v6
13-
with:
14-
python-version: "3.x"
1512
- run: sudo apt-get update && sudo apt-get install -y gettext
16-
- name: Install Python dependencies
17-
run: python -m pip install --upgrade pip build wheel twine readme-renderer
18-
- run: python -m build --sdist --wheel
19-
- run: python -m twine check dist/*
13+
- uses: astral-sh/setup-uv@v7
14+
- run: uvx --from build pyproject-build --sdist --wheel
15+
- run: uvx twine check dist/*
2016
- uses: actions/upload-artifact@v6
2117
with:
2218
path: dist/*
2319
docs:
2420
runs-on: ubuntu-latest
2521
steps:
2622
- uses: actions/checkout@v6
27-
- uses: actions/setup-python@v6
28-
with:
29-
python-version: "3.11"
3023
- run: sudo apt-get update && sudo apt-get install -y gettext
31-
- run: python -m pip install -e '.[docs]'
32-
- run: python -m mkdocs build --strict
24+
- uses: astral-sh/setup-uv@v7
25+
- run: uv run mkdocs build --strict
3326
SQLite:
3427
needs: [dist, docs]
3528
runs-on: ubuntu-latest
@@ -54,13 +47,11 @@ jobs:
5447
django-version: "6.0"
5548
steps:
5649
- uses: actions/checkout@v6
57-
- uses: actions/setup-python@v6
50+
- run: sudo apt-get update && sudo apt-get install -y gettext
51+
- uses: astral-sh/setup-uv@v7
5852
with:
5953
python-version: ${{ matrix.python-version }}
60-
- run: sudo apt-get update && sudo apt-get install -y gettext
61-
- run: python -m pip install -e '.[test]'
62-
- run: python -m pip install Django~=${{ matrix.django-version }}.0
63-
- run: python -m pytest
54+
- run: uv run --with django~=${{ matrix.django-version }}.0 pytest
6455
- uses: codecov/codecov-action@v5
6556
with:
6657
token: ${{ secrets.CODECOV_TOKEN }}
@@ -70,32 +61,23 @@ jobs:
7061
runs-on: ubuntu-latest
7162
strategy:
7263
matrix:
73-
python-version: ["3.x"]
7464
wagtail-version:
7565
- "6.3"
7666
- "7.0"
7767
- "7.1"
7868
- "7.2"
7969
steps:
8070
- uses: actions/checkout@v6
81-
- name: Set up Python ${{ matrix.python-version }}
82-
uses: actions/setup-python@v6
83-
with:
84-
python-version: ${{ matrix.python-version }}
8571
- run: sudo apt-get update && sudo apt-get install -y gettext
86-
- run: python -m pip install -e ".[test,wagtail]"
87-
- run: python -m pip install wagtail~=${{ matrix.wagtail-version }}.0
88-
- run: python -m pytest
72+
- uses: astral-sh/setup-uv@v7
73+
- run: uv run --extra wagtail --with wagtail~=${{ matrix.wagtail-version }}.0 --with django~=5.2.0 pytest
8974
- uses: codecov/codecov-action@v5
9075
with:
9176
token: ${{ secrets.CODECOV_TOKEN }}
9277
flags: ${{ matrix.extras }}
9378
PostgreSQL:
9479
needs: [dist, docs]
9580
runs-on: ubuntu-latest
96-
strategy:
97-
matrix:
98-
python-version: ["3.x"]
9981
services:
10082
postgres:
10183
image: postgres
@@ -106,20 +88,16 @@ jobs:
10688
- 5432/tcp
10789
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
10890
steps:
109-
- name: Set up Python ${{ matrix.python-version }}
110-
uses: actions/setup-python@v6
111-
with:
112-
python-version: ${{ matrix.python-version }}
11391
- uses: actions/checkout@v6
11492
- run: sudo apt-get update && sudo apt-get install -y gettext
115-
- run: python -m pip install -e ".[test,postgres]"
11693
- run: psql template1 -c "CREATE EXTENSION citext;"
11794
env:
11895
PGHOST: localhost
11996
PGPORT: ${{ job.services.postgres.ports[5432] }}
12097
PGUSER: django
12198
PGPASSWORD: django
122-
- run: python -m pytest
99+
- uses: astral-sh/setup-uv@v7
100+
- run: uv run --extra postgres pytest
123101
env:
124102
DB_PORT: ${{ job.services.postgres.ports[5432] }}
125103
DB: pg

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ target/
6060
# mkdocs documentation
6161
/site/
6262

63+
# UV
64+
uv.lock
65+
6366
tests/local.py
6467
docs/_build/
6568
venv

.readthedocs.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ build:
88
python: "3"
99
apt_packages:
1010
- gettext
11-
python:
12-
install:
13-
- method: pip
14-
path: .
15-
extra_requirements:
16-
- docs
11+
jobs:
12+
install:
13+
- curl -LsSf https://astral.sh/uv/install.sh | sh
14+
build:
15+
html:
16+
- $HOME/.local/bin/uv run mkdocs build --site-dir $READTHEDOCS_OUTPUT/html
1717
mkdocs:
1818
configuration: mkdocs.yml

pyproject.toml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ dependencies = [
4848
]
4949

5050
[project.optional-dependencies]
51+
wagtail = [
52+
"wagtail>=6.3",
53+
]
54+
postgres = [
55+
"django-citext",
56+
"psycopg",
57+
]
58+
59+
[dependency-groups]
60+
dev = [
61+
{ include-group = "test" },
62+
{ include-group = "docs" },
63+
]
5164
test = [
5265
"pytest",
5366
"pytest-cov",
@@ -60,12 +73,6 @@ docs = [
6073
"markdown-callouts",
6174
"Pygments",
6275
]
63-
wagtail = [
64-
"wagtail>=6.3",
65-
]
66-
postgres = [
67-
"django-citext",
68-
]
6976

7077
[project.urls]
7178
Project-URL = "https://github.com/codingjoe/django-mail-auth"

0 commit comments

Comments
 (0)