Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Ensure Python 3.12 and sync deps (dev)
working-directory: efile_app
run: |
uv python install 3.12
uv sync --group dev
Expand All @@ -39,20 +40,24 @@ jobs:
# ruff
- name: Ruff format (check only)
if: matrix.check == 'ruff'
working-directory: efile_app
run: uv run ruff format --check .

- name: Ruff lint
if: matrix.check == 'ruff'
working-directory: efile_app
run: uv run ruff check .

# type checking
- name: Type check (ty)
if: matrix.check == 'type'
working-directory: efile_app
run: uv run ty check

# tests
- name: Run tests
if: matrix.check == 'tests'
env:
DJANGO_SETTINGS_MODULE: efile.settings
working-directory: efile_app
run: uv run pytest -q
18 changes: 18 additions & 0 deletions .github/workflows/fly-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/

name: Fly Deploy
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
concurrency: deploy-group # optional: ensure only one action runs at a time
steps:
- uses: actions/checkout@v5
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ celerybeat.pid
# Environments
.env
.venv
.env.staging
.env.prod
.env.production
.env.local
env/
venv/
ENV/
Expand Down Expand Up @@ -150,3 +154,7 @@ cython_debug/

# Logs
*.log

# Sqlite database files
efile_app/db.sqlite3
efile_app/db.sqlite3-journal
9 changes: 5 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,23 @@ repos:
hooks:
- id: ty
name: ty (type check)
entry: uv run ty check
entry: bash -lc
language: system
types: [python]
stages: [pre-commit]
pass_filenames: false
args:
- cd efile_app && uv run ty check

# Run tests on pre-push to keep commits snappy
- repo: local
hooks:
- id: pytest
name: pytest (pre-push)
entry: uv run pytest
entry: bash -lc
language: system
stages: [pre-push]
pass_filenames: false
args:
- -q
- cd efile_app && uv run pytest -q
# If needed, override Django settings here instead of pyproject:
# - --ds=efile.settings
22 changes: 15 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,29 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:${PATH}"

WORKDIR /app
WORKDIR /app/efile_app

# Copy project metadata first for better layer caching
COPY pyproject.toml uv.lock* ./
# Copy project metadata first for better layer caching (project now rooted at efile_app/)
COPY efile_app/pyproject.toml efile_app/uv.lock* ./

# Install dependencies without installing the project code yet (faster rebuilds)
RUN uv sync --frozen --no-install-project

# Copy the rest of the source code
COPY . .
# Copy the rest of the source code into /app
COPY . /app

# Install the project itself (editable-like install)
RUN uv sync --frozen

# Collect static files at build time so WhiteNoise can serve them at runtime
# Use staging settings to ensure DEBUG=False and STATIC_ROOT is set
# Provide a non-insecure SECRET_KEY for build to satisfy settings_staging
RUN DJANGO_SETTINGS_MODULE=efile.settings_staging \
DJANGO_SECRET_KEY=build-static-collect-key \
DATABASE_URL=sqlite:////tmp/build-collectstatic.sqlite3 \
uv run python manage.py collectstatic --noinput

EXPOSE 8000

# For Django dev server; override in compose for different commands
CMD ["uv", "run", "python", "efile_app/manage.py", "runserver", "0.0.0.0:8000"]
# Use Gunicorn with Uvicorn workers (ASGI) and log to stdout/stderr (debug level)
CMD ["uv", "run", "gunicorn", "efile.asgi:application", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8000", "--workers", "2", "--timeout", "60", "--access-logfile", "-", "--error-logfile", "-", "--log-level", "debug", "--access-logformat", "%(h)s - %(l)s %(u)s [%(t)s] \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\" in %(L)ss"]
Binary file removed efile_app/efile/__pycache__/__init__.cpython-313.pyc
Binary file not shown.
Binary file removed efile_app/efile/__pycache__/forms.cpython-313.pyc
Binary file not shown.
Binary file not shown.
Binary file removed efile_app/efile/__pycache__/urls.cpython-313.pyc
Binary file not shown.
Binary file removed efile_app/efile/__pycache__/views.cpython-313.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed efile_app/efile/__pycache__/wsgi.cpython-313.pyc
Binary file not shown.
Loading