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 1, 2024
1 parent d5404da commit fa37137
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 29 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,27 @@ 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
pyproject.toml
requirements/requirements*.txt
- 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 }}
uv pip install --system -U setuptools wheel
uv pip install --system -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

# Prune cache, see:
# https://docs.astral.sh/uv/concepts/cache/#caching-in-continuous-integration
- name: Prune uv cache
run: uv cache prune --ci
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 fa37137

Please sign in to comment.