Skip to content

Commit

Permalink
run uv in github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasertl committed Dec 4, 2024
1 parent d5404da commit e5563f7
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 74 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ on:
push:
pull_request:

jobs:
env:
UV_SYSTEM_PYTHON: 1

jobs:
run:
runs-on: ubuntu-latest

env:
DJANGO_CA_SECRET_KEY: dummy

steps:

- name: Acquire sources
Expand All @@ -23,17 +23,17 @@ jobs:
python-version: "3.12"
architecture: x64

- name: Apply caching of dependencies
uses: actions/cache@v4.0.0
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('**/requirements-*.txt') }}
enable-cache: true
cache-dependency-glob: "requirements.txt"

- name: Update setuptools/wheel
run: uv pip install -U setuptools wheel

- name: Install dependencies
run: |
pip install -U pip setuptools wheel
pip install -r requirements.txt
pip install -r requirements/requirements-docs.txt
run: uv pip install -r requirements.txt -r requirements/requirements-docs.txt

- name: doc8 style checks
run: doc8 docs/source/
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/faketime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
push:
pull_request:

env:
UV_SYSTEM_PYTHON: 1

jobs:
run:
runs-on: ubuntu-latest
Expand All @@ -21,16 +24,17 @@ jobs:
python-version: "3.13"
architecture: x64

- name: Apply caching of dependencies
uses: actions/cache@v4.0.0
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('**/requirements-*.txt') }}
enable-cache: true
cache-dependency-glob: "requirements.txt"

- name: Update setuptools/wheel
run: uv pip install -U setuptools wheel

- name: Install dependencies
run: |
pip install -U pip setuptools wheel
pip install -r requirements.txt -r requirements/requirements-test.txt
run: uv pip install -r requirements.txt -r requirements/requirements-test.txt

- name: Run tests
run: faketime -f +100y pytest -v --no-selenium --cov-report term-missing --durations=20
18 changes: 11 additions & 7 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
push:
pull_request:

env:
UV_SYSTEM_PYTHON: 1

jobs:
run:
runs-on: ubuntu-latest
Expand All @@ -21,16 +24,17 @@ jobs:
python-version: "3.13"
architecture: x64

- name: Apply caching of dependencies
uses: actions/cache@v4.0.0
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('**/requirements-*.txt') }}
enable-cache: true
cache-dependency-glob: "requirements.txt"

- name: Update setuptools/wheel
run: uv pip install -U setuptools wheel

- name: Install dependencies
run: |
pip install -U pip setuptools wheel
pip install -r requirements.txt -r requirements/requirements-mypy.txt
run: uv pip install -r requirements.txt -r requirements/requirements-mypy.txt

- name: run mypy
run: mypy .
31 changes: 15 additions & 16 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ on:
push:
pull_request:

jobs:
env:
UV_SYSTEM_PYTHON: 1

jobs:
run:
runs-on: ubuntu-latest

env:
DJANGO_CA_SECRET_KEY: dummy

steps:

- name: Acquire sources
Expand All @@ -22,24 +22,23 @@ jobs:
python-version: "3.13"
architecture: x64

- name: Apply caching of dependencies
uses: actions/cache@v4.0.0
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('**/requirements-*.txt') }}
enable-cache: true
cache-dependency-glob: "requirements.txt"

- name: Update setuptools/wheel
run: uv pip install -U setuptools wheel

- name: Install dependencies
run: |
pip install -U pip setuptools wheel
pip install -r requirements.txt
pip install -r requirements/requirements-test.txt
pip install -r requirements/requirements-lint.txt
uv pip install -r requirements.txt
uv pip install -r requirements/requirements-test.txt
uv pip install -r requirements/requirements-lint.txt
# Mitigate "Unable to import 'typing_extensions' (import-error)"
pip install typing-extensions
- name: Install program
run: pip install -e .
uv pip install typing-extensions
- name: Run ruff
run: python dev.py code-quality
Expand All @@ -53,7 +52,7 @@ jobs:

- name: Validate sdist/wheel
run: |
pip install -r requirements/requirements-dist.txt
uv pip install -r requirements/requirements-dist.txt
python -m build
twine check --strict dist/*
Expand Down
22 changes: 12 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ on:
push:
pull_request:

jobs:
env:
UV_SYSTEM_PYTHON: 1

jobs:
run:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ ubuntu-latest ]
Expand Down Expand Up @@ -35,19 +36,20 @@ jobs:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Apply caching of dependencies
uses: actions/cache@v4.0.0
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
path: ~/.cache/pip
key: os=${{ matrix.os }}-python=${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements-*.txt') }}
enable-cache: true
cache-dependency-glob: "requirements.txt"

- name: Update setuptools/wheel
run: uv pip install -U setuptools wheel

- name: Install dependencies
run: |
pip install -U pip setuptools wheel
pip install -r requirements.txt -r requirements/requirements-test.txt django~=${{ matrix.django-version }} cryptography~=${{ matrix.cryptography-version }} pydantic~=${{ matrix.pydantic-version }}
run: uv pip install -r requirements.txt -r requirements/requirements-test.txt django~=${{ matrix.django-version }} cryptography~=${{ matrix.cryptography-version }} pydantic~=${{ matrix.pydantic-version }}

- name: Initialize demo
run: python dev.py init-demo

- name: Run tests
run: pytest -v --cov-report term-missing --durations=20
run: pytest -v --cov-report term-missing --durations=20
23 changes: 0 additions & 23 deletions ca/django_ca/tests/migrations/test_0051.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,26 +155,3 @@ def setup_ocsp_keys(ca: Any) -> None:
)
]
assert ca.ocsp_key_backend_options == {"certificate": {}, "private_key": {}}


@pytest.mark.usefixtures("tmpcadir")
def test_with_invalid_storage_alias(
caplog: LogCaptureFixture, migrator: Migrator, tmpcadir: Path, settings: SettingsWrapper
) -> None:
"""Test running the migration with an improperly configured ocsp alias."""
ocsp_dest = tmpcadir / "ocsp"
ocsp_dest.mkdir(exist_ok=True, parents=True)

settings.CA_OCSP_KEY_BACKENDS = {
"default": {
"BACKEND": "django_ca.key_backends.storages.StoragesOCSPBackend",
"OPTIONS": {"storage_alias": "foobar"},
}
}

state = setup(migrator)

CertificateAuthority = state.apps.get_model("django_ca", "CertificateAuthority")
ca = CertificateAuthority.objects.get(serial="123")
assert "Cannot load OCSP key storage backend." in caplog.text
assert ca.ocsp_key_backend_options == {"certificate": {}, "private_key": {}}

0 comments on commit e5563f7

Please sign in to comment.