Skip to content

Commit

Permalink
Switch to uv in GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
dfsnow committed Nov 7, 2024
1 parent 9af8f19 commit dfbc025
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 25 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,30 @@ on:

name: lint

env:
PYTHONUNBUFFERED: "1"
UV_SYSTEM_PYTHON: 1

jobs:
lint-ruff:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup python
- 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: "3.x"
cache: "pip"
python-version-file: pyproject.toml

- name: Install dependencies
run: pip install . ruff
run: uv pip install . ruff

- name: Lint with ruff
run: ruff check --output-format=github .
22 changes: 16 additions & 6 deletions .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:

name: pages

env:
PYTHONUNBUFFERED: "1"
UV_SYSTEM_PYTHON: 1

jobs:
build-sphinx-site:
runs-on: ubuntu-latest
Expand All @@ -17,14 +21,20 @@ jobs:
- name: Configure pages
uses: actions/configure-pages@v5

- name: Setup python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
python-version: "3.x"
cache: "pip"
enable-cache: true
cache-dependency-glob: pyproject.toml
cache-suffix: docs

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

- name: Install dependencies
run: pip install .[docs]
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml

- name: Generate HTML
run: |
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/pypi-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:

name: pypi-publish

env:
PYTHONUNBUFFERED: "1"
UV_SYSTEM_PYTHON: 1

jobs:
pypi-publish:
name: pypi-publish
Expand All @@ -18,16 +22,22 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

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

- name: Install Python dependencies
run: uv pip install .

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install dependencies
run: pip install build
python-version-file: pyproject.toml

- name: Build Python dist
run: python -m build
run: uv build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
16 changes: 12 additions & 4 deletions .github/workflows/python-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,22 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

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

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install tox
run: pip install tox-gh>=1.3.0
shell: bash
run: |
uv tool install tox --with tox-uv
tox --version
- name: Test install with tox
run: tox -v --notest
run: tox r -v --notest
14 changes: 10 additions & 4 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,24 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

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

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

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

- name: Run pytest
run: |
pytest --doctest-modules \
uv run pytest --doctest-modules \
--junitxml=junit/test-results-${{ matrix.python-version }}.xml
- name: Upload artifacts
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,14 @@ testpaths = "assesspy/tests"
legacy_tox_ini = """
[tox]
min_version = 4.0
envlist = py39, py38, py310, py311, py312
envlist = py39, py310, py311, py312
[gh]
python =
3.12 = py312
3.11 = py311
3.10 = py310
3.9 = py39
3.8 = py38
"""

[tool.ruff]
Expand Down

0 comments on commit dfbc025

Please sign in to comment.