From f43fe328b3f3f669dc5a325971a7987c466f01ed Mon Sep 17 00:00:00 2001 From: Ashutosh Palhare Date: Tue, 27 Oct 2026 22:01:29 +0530 Subject: [PATCH 1/5] ci: add Django tests and system checks --- .github/workflows/django-ci.yml | 57 +++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/django-ci.yml diff --git a/.github/workflows/django-ci.yml b/.github/workflows/django-ci.yml new file mode 100644 index 0000000..c44f2f7 --- /dev/null +++ b/.github/workflows/django-ci.yml @@ -0,0 +1,57 @@ +name: Django CI + +on: + push: + branches: [main, phase-1-ci-validation] + pull_request: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: django-ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Tests and Django checks + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + cache-dependency-path: requirements.txt + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + + - name: Run Django tests + env: + DJANGO_DEBUG: "True" + DJANGO_SECRET_KEY: ci-only-not-a-production-secret + DJANGO_ALLOWED_HOSTS: localhost,127.0.0.1,testserver + run: python manage.py test + + - name: Run Django system check + env: + DJANGO_DEBUG: "True" + DJANGO_SECRET_KEY: ci-only-not-a-production-secret + DJANGO_ALLOWED_HOSTS: localhost,127.0.0.1,testserver + run: python manage.py check + + - name: Check for missing migrations + env: + DJANGO_DEBUG: "True" + DJANGO_SECRET_KEY: ci-only-not-a-production-secret + DJANGO_ALLOWED_HOSTS: localhost,127.0.0.1,testserver + run: python manage.py makemigrations --check --dry-run From e5d696fc5f522128caeb121775410a2a96e6b276 Mon Sep 17 00:00:00 2001 From: Ashutosh Palhare Date: Tue, 27 Oct 2026 22:02:05 +0530 Subject: [PATCH 2/5] ci: exercise Django tests with debug disabled --- .github/workflows/django-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/django-ci.yml b/.github/workflows/django-ci.yml index c44f2f7..8f9a6ed 100644 --- a/.github/workflows/django-ci.yml +++ b/.github/workflows/django-ci.yml @@ -37,21 +37,21 @@ jobs: - name: Run Django tests env: - DJANGO_DEBUG: "True" + DJANGO_DEBUG: "False" DJANGO_SECRET_KEY: ci-only-not-a-production-secret DJANGO_ALLOWED_HOSTS: localhost,127.0.0.1,testserver run: python manage.py test - name: Run Django system check env: - DJANGO_DEBUG: "True" + DJANGO_DEBUG: "False" DJANGO_SECRET_KEY: ci-only-not-a-production-secret DJANGO_ALLOWED_HOSTS: localhost,127.0.0.1,testserver run: python manage.py check - name: Check for missing migrations env: - DJANGO_DEBUG: "True" + DJANGO_DEBUG: "False" DJANGO_SECRET_KEY: ci-only-not-a-production-secret DJANGO_ALLOWED_HOSTS: localhost,127.0.0.1,testserver run: python manage.py makemigrations --check --dry-run From cb53465cbdfe5b904f6a5a8f4db958e3309a7fe8 Mon Sep 17 00:00:00 2001 From: Ashutosh Palhare Date: Tue, 27 Oct 2026 22:02:27 +0530 Subject: [PATCH 3/5] docs: document automated Django CI checks --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 8f98557..fcb1670 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,8 @@ Open http://127.0.0.1:8000/ and create an account. ## Tests and checks +GitHub Actions runs the test suite, Django system check, and migration consistency check on pull requests to `main` and pushes to `main`. See `.github/workflows/django-ci.yml`. + Run the project's Django tests: ```bash From 4a9d5a4e93cc8529174291d6e918b1a383050055 Mon Sep 17 00:00:00 2001 From: Ashutosh Palhare Date: Tue, 27 Oct 2026 22:02:44 +0530 Subject: [PATCH 4/5] test: render custom error page with debug disabled --- notes/tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/notes/tests.py b/notes/tests.py index 63d6cf9..b17a456 100644 --- a/notes/tests.py +++ b/notes/tests.py @@ -3,7 +3,7 @@ from django.contrib.auth import get_user_model from django.core.management import call_command -from django.test import TestCase +from django.test import TestCase, override_settings from django.urls import reverse from django.utils import timezone @@ -279,6 +279,7 @@ def test_parse_tags(self): self.assertEqual(parse_tags(" Work , #ideas,WORK,, "), ["work", "ideas"]) self.assertEqual(parse_tags(""), []) + @override_settings(DEBUG=False) def test_error_pages_render(self): self.assertEqual(self.client.get("/definitely-missing/").status_code, 404) self.assertContains(self.client.get("/definitely-missing/"), "Note not found", status_code=404) From 55747c7cc6f3b0dd7d0b78778264d1dbbaeb531b Mon Sep 17 00:00:00 2001 From: Ashutosh Palhare Date: Tue, 27 Oct 2026 22:03:27 +0530 Subject: [PATCH 5/5] fix: add shared template for custom error pages --- templates/error.html | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 templates/error.html diff --git a/templates/error.html b/templates/error.html new file mode 100644 index 0000000..c511f1f --- /dev/null +++ b/templates/error.html @@ -0,0 +1,29 @@ + + + + + + + + {% block title %}Something went wrong – Ember{% endblock %} + + + +
+
{% block code %}ERROR{% endblock %}
+

{% block heading %}Something went wrong{% endblock %}

+

{% block text %}The page could not be loaded. Please try again.{% endblock %}

+ Back to Ember +
+ +