Skip to content

Commit

Permalink
Use uv, bump dependencies (#312)
Browse files Browse the repository at this point in the history
* Migrate to uv
* Upgrade all dependencies and handle Django breaking changes
* Update frontend testing instructions to use bun

---------

Co-authored-by: Thomas Ngulube <47449914+Porcupine1@users.noreply.github.com>
  • Loading branch information
julianweng and Porcupine1 committed Feb 24, 2025
1 parent 2581ca9 commit 8319b85
Show file tree
Hide file tree
Showing 15 changed files with 543 additions and 328 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Docker
Dockerfile
.dockerignore
.venv

# git
.circleci
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +1,37 @@
# Generated by cdkactions. Do not modify
# Generated as part of the 'cfa' stack.
name: Build and Deploy
on: push
jobs:
django-check:
name: Django Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.local/share/virtualenvs
key: v0-${{ hashFiles('./Pipfile.lock') }}
path: .venv
key: v0-${{ hashFiles('./uv.lock') }}
- name: Install Dependencies
run: |-
cd .
pip install pipenv
pipenv install --deploy --dev
uv sync --frozen
- name: Test (run in parallel)
run: |-
cd .
pipenv run coverage run --concurrency=multiprocessing manage.py test --settings=penncfa.settings.ci --parallel
pipenv run coverage combine
uv run coverage run --concurrency=multiprocessing manage.py test --settings=penncfa.settings.ci --parallel
uv run coverage combine
- name: Upload Code Coverage
run: |-
ROOT=$(pwd)
cd .
pipenv run codecov --root $ROOT --flags backend
uv run codecov --root $ROOT --flags backend
container:
image: python:3.8-buster
image: ghcr.io/astral-sh/uv:0.6.2-python3.12-bookworm
env:
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
services:
postgres:
image: postgres:12
image: postgres:17
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
Expand All @@ -44,11 +41,11 @@ jobs:
name: Publish backend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: buildx-publish-backend
Expand All @@ -70,7 +67,7 @@ jobs:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- id: synth
name: Synth cdk8s manifests
run: |-
Expand Down
15 changes: 6 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
FROM pennlabs/django-base:3cadd22f7ad51359c5e86b6a3cba2fc155c1c6ab
FROM ghcr.io/astral-sh/uv:0.6.2-python3.12-bookworm

LABEL maintainer="Penn Labs"

# Copy project dependencies
COPY Pipfile* /app/

# Install project dependencies
RUN pipenv install --system

# Copy project files
COPY . /app/

WORKDIR /app
RUN uv sync --frozen

ENV DJANGO_SETTINGS_MODULE penncfa.settings.production
ENV SECRET_KEY 'temporary key just to build the docker image'

# Collect static files
RUN python3 /app/manage.py collectstatic --noinput
# Implicitly sync dependencies and collect static files
RUN uv run /app/manage.py collectstatic --noinput
21 changes: 0 additions & 21 deletions Pipfile

This file was deleted.

239 changes: 0 additions & 239 deletions Pipfile.lock

This file was deleted.

Loading

0 comments on commit 8319b85

Please sign in to comment.