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
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ DB_ENGINE=mysql
# If using SQLite, DB_NAME is the path to the database file
DB_NAME_SQLITE=db.sqlite3

# Test database
# By default, `manage.py test` uses an isolated SQLite test database.
# Set this to true to run tests against the configured DB_ENGINE instead.
USE_CONFIGURED_TEST_DATABASE=false
TEST_DB_NAME=:memory:

# MySQL specific
DB_NAME_MYSQL=your_db_name
DB_USER=root
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Tests & Coverage

on:
push:
branches:
- development
- master
pull_request:
branches:
- development
- master

permissions:
contents: read

jobs:
coverage:
runs-on: ubuntu-latest

env:
ENVIRONMENT: dev
DB_ENGINE: sqlite
DB_NAME: ":memory:"
SECRET_KEY: ci-test-secret-key-for-coverage-checks-not-for-production

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y default-libmysqlclient-dev pkg-config

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12.4"

- name: Set up uv
uses: astral-sh/setup-uv@v5

- name: Install project dependencies
run: uv sync --dev

- name: Run tests with coverage
run: uv run coverage run manage.py test --keepdb --no-progress --no-color

- name: Print coverage summary
run: uv run coverage report --fail-under=80

- name: Write coverage XML
run: uv run coverage xml -o coverage.xml

- name: Check Codecov token
run: |
if [ -z "${{ secrets.CODECOV_TOKEN }}" ]; then
echo "CODECOV_TOKEN is required for coverage uploads."
echo "Add it under GitHub repository Settings > Secrets and variables > Actions."
exit 1
fi

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: coverage.xml
flags: django
name: mealstack-django
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
11 changes: 5 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,14 @@ pip-selfcheck.json
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.idea/MypyPlugin.xml
.idea/git_toolbox_prj.xml
.idea/misc.xml

# AWS User-specific
.idea/**/aws.xml
Expand Down Expand Up @@ -142,8 +144,8 @@ pip-selfcheck.json
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
.idea/modules.xml
.idea/*.iml
# .idea/modules
# *.iml
# *.ipr
Expand Down Expand Up @@ -184,8 +186,5 @@ fabric.properties
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

# idea folder, uncomment if you don't need it
.idea

# Ignore uv lock file
uv.lock
31 changes: 0 additions & 31 deletions .idea/MealStack.iml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ RUN /root/.local/bin/uv sync

# Compile localization files
# This will generate .po files if not present and compile .mo files
RUN uv run python manage.py makemessages -a || true # -a: all languages, ignore if no changes
RUN uv run python manage.py compilemessages --ignore "*/site-packages/*"
RUN SECRET_KEY=build-time-only uv run python manage.py makemessages -a || true # -a: all languages, ignore if no changes
RUN SECRET_KEY=build-time-only uv run python manage.py compilemessages --ignore "*/site-packages/*"

EXPOSE 8000

# Default command is to run Django, but can override
ENTRYPOINT ["uv", "run", "python", "manage.py"]
CMD ["runserver", "0.0.0.0:8000"]
CMD ["runserver", "0.0.0.0:8000"]
Loading
Loading