Skip to content

Commit

Permalink
Fix tox + uv caching (#29)
Browse files Browse the repository at this point in the history
* Split tox setup and run

* Add env cache

* Pass UV_CACHE_DIR

* Disable cache pruning

* Add full uv workflow and caching

* Finalize GH workflows with uv

* Change uv cache suffixes

* Use system Python for tox

* Use uv python for tox

* Drop caching from pages

* Disable cache on lint workflow

* Cache for each Python version

* Drop dedicated linting PR
  • Loading branch information
dfsnow authored Dec 2, 2024
1 parent 5e309db commit 494da48
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 60 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/lint.yaml

This file was deleted.

14 changes: 4 additions & 10 deletions .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ name: pages

env:
PYTHONUNBUFFERED: "1"
UV_SYSTEM_PYTHON: 1

jobs:
build-sphinx-site:
Expand All @@ -22,22 +21,17 @@ jobs:
uses: actions/configure-pages@v5

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
cache-suffix: docs
uses: astral-sh/setup-uv@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
shell: bash
run: uv venv

- name: Install Python dependencies
run: uv pip install .[docs]

- name: Generate HTML
run: sphinx-build -d _build/doctrees docs/source _build/html
run: uv run sphinx-build -d _build/doctrees docs/source _build/html

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/pypi-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ name: pypi-publish

env:
PYTHONUNBUFFERED: "1"
UV_SYSTEM_PYTHON: 1

jobs:
pypi-publish:
Expand All @@ -23,18 +22,7 @@ jobs:
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: pyproject.toml

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml

- name: Install Python dependencies
run: uv pip install .
uses: astral-sh/setup-uv@v4

- name: Build Python dist
run: uv build
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/python-build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:

name: python-build-and-test

env:
PYTHONUNBUFFERED: "1"

jobs:
build-and-test:
runs-on: ubuntu-latest
Expand All @@ -19,11 +22,11 @@ jobs:
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
cache-suffix: tox
cache-suffix: ${{ matrix.python-version }}-tox

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ python =
[testenv]
extras = dev
commands = pytest
passenv =
UV_CACHE_DIR
PYTHONUNBUFFERED
[testenv:py{39, 310}-lowest]
uv_resolution = lowest-direct
Expand Down

0 comments on commit 494da48

Please sign in to comment.