diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 721b09d2..2fef0c79 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,38 +21,26 @@ jobs: matrix: python-version: [3.8] steps: - - name: ๐Ÿ›ซ Checkout - uses: actions/checkout@v3 - - - name: ๐Ÿ Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + - uses: ocadotechnology/codeforlife-workspace/.github/actions/python/test@main with: python-version: ${{ matrix.python-version }} - - name: ๐Ÿ›  Install Dependencies - run: | - python -m pip install --upgrade pip - python -m pip install pipenv - pipenv install --dev - - - name: ๐Ÿ”Ž Check Code Format - run: if ! pipenv run black --check .; then exit 1; fi - - - name: ๐Ÿ”Ž Check Migrations - run: pipenv run python manage.py makemigrations --check --dry-run - - # TODO: assert code coverage target. - - name: ๐Ÿงช Test Code Units - run: pipenv run pytest + docs: + runs-on: ubuntu-latest + needs: [test] + steps: + - uses: ocadotechnology/codeforlife-workspace/.github/actions/python/docs@main + with: + python-version: ${{ env.PYTHON_VERSION }} release: concurrency: release runs-on: ubuntu-latest - needs: [test] + needs: [docs] if: github.ref_name == 'main' steps: - name: ๐Ÿ›ซ Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} fetch-depth: 0 @@ -67,10 +55,7 @@ jobs: python -m pip install --upgrade pip python -m pip install python-semantic-release~=7.33 - - name: โš™๏ธ Configure Git - run: | - git config --local user.name cfl-bot - git config --local user.email codeforlife-bot@ocado.com + - uses: ocadotechnology/codeforlife-workspace/.github/actions/git/setup-bot@main - name: ๐Ÿš€ Publish Semantic Release env: diff --git a/.gitignore b/.gitignore index ff08be71..f530e735 100644 --- a/.gitignore +++ b/.gitignore @@ -40,10 +40,10 @@ pip-log.txt pip-delete-this-directory.txt # Any graphs generated in the docs -docs/*.png +# docs/*.png # Any dot files generated by pydot -*.dot +# *.dot # Unit test / coverage reports htmlcov/ diff --git a/.vscode/settings.json b/.vscode/settings.json index 48cc2f5e..a2abc386 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,6 +23,7 @@ "--load-plugins=pylint_django" ], "python.testing.pytestArgs": [ + "-n=auto", "-c=pyproject.toml", "." ], diff --git a/Pipfile b/Pipfile index 7f76e7fb..abc05a14 100644 --- a/Pipfile +++ b/Pipfile @@ -27,6 +27,8 @@ django-stubs = {version = "==4.2.6", extras = ["compatible-mypy"]} djangorestframework-stubs = {version = "==3.14.4", extras = ["compatible-mypy"]} pylint = "==3.0.2" pylint-django = "==2.5.5" +pygraphviz = "==1.11" +pytest-xdist = {version = "==3.5.0", extras = ["psutil"]} [requires] python_version = "3.8" diff --git a/Pipfile.lock b/Pipfile.lock index 40e060d1..72fcd673 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "860196ab795a6de76b8a385ea76f4b38f982839b4aa23ea3b16248af01b555a7" + "sha256": "e83dcf7f8ea1eb6a7ed9c51bef5f904553456b43356438b3143ede9a2eef69ef" }, "pipfile-spec": 6, "requires": { @@ -537,6 +537,14 @@ "markers": "python_version < '3.11'", "version": "==1.2.0" }, + "execnet": { + "hashes": [ + "sha256:88256416ae766bc9e8895c76a87928c0012183da3cc4fc18016e6f050e025f41", + "sha256:cc59bc4423742fd71ad227122eb0dd44db51efb3dc4095b45ac9a08c770096af" + ], + "markers": "python_version >= '3.7'", + "version": "==2.0.2" + }, "idna": { "hashes": [ "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca", @@ -555,11 +563,11 @@ }, "isort": { "hashes": [ - "sha256:56a51732c25f94ca96f6721be206dd96a95f42950502eb26c1015d333bc6edb7", - "sha256:aaed790b463e8703fb1eddb831dfa8e8616bacde2c083bd557ef73c8189b7263" + "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109", + "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6" ], "markers": "python_full_version >= '3.8.0'", - "version": "==5.13.1" + "version": "==5.13.2" }, "mccabe": { "hashes": [ @@ -642,6 +650,27 @@ "markers": "python_version >= '3.8'", "version": "==1.3.0" }, + "psutil": { + "hashes": [ + "sha256:032f4f2c909818c86cea4fe2cc407f1c0f0cde8e6c6d702b28b8ce0c0d143340", + "sha256:0bd41bf2d1463dfa535942b2a8f0e958acf6607ac0be52265ab31f7923bcd5e6", + "sha256:1132704b876e58d277168cd729d64750633d5ff0183acf5b3c986b8466cd0284", + "sha256:1d4bc4a0148fdd7fd8f38e0498639ae128e64538faa507df25a20f8f7fb2341c", + "sha256:3c4747a3e2ead1589e647e64aad601981f01b68f9398ddf94d01e3dc0d1e57c7", + "sha256:3f02134e82cfb5d089fddf20bb2e03fd5cd52395321d1c8458a9e58500ff417c", + "sha256:44969859757f4d8f2a9bd5b76eba8c3099a2c8cf3992ff62144061e39ba8568e", + "sha256:4c03362e280d06bbbfcd52f29acd79c733e0af33d707c54255d21029b8b32ba6", + "sha256:5794944462509e49d4d458f4dbfb92c47539e7d8d15c796f141f474010084056", + "sha256:b27f8fdb190c8c03914f908a4555159327d7481dac2f01008d483137ef3311a9", + "sha256:c727ca5a9b2dd5193b8644b9f0c883d54f1248310023b5ad3e92036c5e2ada68", + "sha256:e469990e28f1ad738f65a42dcfc17adaed9d0f325d55047593cb9033a0ab63df", + "sha256:ea36cc62e69a13ec52b2f625c27527f6e4479bca2b340b7a452af55b34fcbe2e", + "sha256:f37f87e4d73b79e6c5e749440c3113b81d1ee7d26f21c19c47371ddea834f414", + "sha256:fe361f743cb3389b8efda21980d93eb55c1f1e3898269bc9a2a1d0bb7b1f6508", + "sha256:fe8b7f07948f1304497ce4f4684881250cd859b16d06a1dc4d7941eeb6233bfe" + ], + "version": "==5.9.7" + }, "pydot": { "hashes": [ "sha256:248081a39bcb56784deb018977e428605c1c758f10897a339fce1dd728ff007d", @@ -650,6 +679,13 @@ "index": "pypi", "version": "==1.4.2" }, + "pygraphviz": { + "hashes": [ + "sha256:a97eb5ced266f45053ebb1f2c6c6d29091690503e3a5c14be7f908b37b06f2d4" + ], + "index": "pypi", + "version": "==1.11" + }, "pylint": { "hashes": [ "sha256:0d4c286ef6d2f66c8bfb527a7f8a629009e42c99707dec821a03e1b51a4c1496", @@ -706,6 +742,17 @@ "index": "pypi", "version": "==0.8.1" }, + "pytest-xdist": { + "extras": [ + "psutil" + ], + "hashes": [ + "sha256:cbb36f3d67e0c478baa57fa4edc8843887e0f6cfc42d677530a36d7472b32d8a", + "sha256:d075629c7e00b611df89f490a5063944bee7a4362a5ff11c7cc7824a03dfce24" + ], + "index": "pypi", + "version": "==3.5.0" + }, "pytz": { "hashes": [ "sha256:7b4fddbeb94a1eba4b557da24f19fdf9db575192544270a9101d8509f9f43d7b", diff --git a/codeforlife/settings/third_party.py b/codeforlife/settings/third_party.py index 11afa12e..49914e45 100644 --- a/codeforlife/settings/third_party.py +++ b/codeforlife/settings/third_party.py @@ -23,3 +23,16 @@ ], "DEFAULT_PAGINATION_CLASS": "codeforlife.pagination.LimitOffsetPagination", } + +# Django Extensions - Graph Models +# https://django-extensions.readthedocs.io/en/latest/graph_models.html?highlight=graph_models#default-settings + +GRAPH_MODELS = { + "all_applications": True, + "group_models": True, + "pygraphviz": True, + "output": "docs/entity_relationship_diagram.png", + "arrow_shape": "normal", + "color_code_deletions": True, + "rankdir": "BT", +} diff --git a/codeforlife/user/migrations/0001_initial.py b/codeforlife/user/migrations/0001_initial.py index b346fa28..9cbc11f4 100644 --- a/codeforlife/user/migrations/0001_initial.py +++ b/codeforlife/user/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.20 on 2023-12-15 17:11 +# Generated by Django 3.2.20 on 2023-12-18 11:09 from django.conf import settings import django.core.validators diff --git a/docs/entity_relationship_diagram.png b/docs/entity_relationship_diagram.png new file mode 100644 index 00000000..f130f72b Binary files /dev/null and b/docs/entity_relationship_diagram.png differ diff --git a/manage.py b/manage.py index b374b966..879546bb 100644 --- a/manage.py +++ b/manage.py @@ -13,6 +13,7 @@ "django.contrib.staticfiles", "django.contrib.sites", "codeforlife.user", + "django_extensions", ] MIDDLEWARE = [