From 8bf4fba7b477fac0306af921c7836e3d2aa1c083 Mon Sep 17 00:00:00 2001 From: Ahmed Date: Fri, 27 Oct 2023 17:26:40 +1100 Subject: [PATCH] Improved test coverage of production build/config --- .github/workflows/ci.yml | 13 +++++++++++++ tests/test_docker.sh | 3 +++ tests/test_production_build.py | 5 +++++ 3 files changed, 21 insertions(+) create mode 100644 tests/test_production_build.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9916df9f..98a3a509b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,3 +113,16 @@ jobs: node-version: "18" - name: Bare Metal ${{ matrix.script.name }} run: sh tests/test_bare.sh ${{ matrix.script.args }} + + production-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + cache: pip + - name: Install production dependencies + run: pip install -r {{cookiecutter.project_slug}}/requirements/production.txt + - name: Run Django deployment checks + run: python manage.py check --deploy \ No newline at end of file diff --git a/tests/test_docker.sh b/tests/test_docker.sh index 8e4055e20..c4129bcbe 100755 --- a/tests/test_docker.sh +++ b/tests/test_docker.sh @@ -32,6 +32,9 @@ docker compose -f local.yml run django python manage.py makemessages --all # Make sure the check doesn't raise any warnings docker compose -f local.yml run django python manage.py check --fail-level WARNING +# Check for deployment-specific issues +docker compose -f local.yml run django python manage.py check --deploy + # Generate the HTML for the documentation docker compose -f local.yml run docs make html diff --git a/tests/test_production_build.py b/tests/test_production_build.py new file mode 100644 index 000000000..5abe98a57 --- /dev/null +++ b/tests/test_production_build.py @@ -0,0 +1,5 @@ +import subprocess + +def test_production_check(): + # This will raise an exception if there's an error + subprocess.check_call(['python', 'manage.py', 'check', '--deploy']) \ No newline at end of file