Skip to content
Merged
Changes from 1 commit
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
117 changes: 68 additions & 49 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
include scripts/shared.mk
include scripts/terraform/terraform.mk

.DEFAULT_GOAL := help

.PHONY: assets build clean config db deploy diagrams githooks-config githooks-run help local migrate models rebuild-db run seed seed-demo-data shell test test-end-to-end test-integration test-lint test-lint-templates test-ui test-unit dependencies _clean-docker _install-poetry
.SILENT: help run

# ---------------------------------------------------------------------------
# Help & Meta
# ---------------------------------------------------------------------------
help: # Print help @Others
printf "\nUsage: \033[3m\033[93m[arg1=val1] [arg2=val2] \033[0m\033[0m\033[32mmake\033[0m\033[34m <command>\033[0m\n\n"
perl -e '$(HELP_SCRIPT)' $(MAKEFILE_LIST)

# ---------------------------------------------------------------------------
# Cleaning & Utility
# ---------------------------------------------------------------------------
clean:: _clean-docker # Clean-up project resources (main) @Operations

_clean-docker:
docker compose --env-file manage_breast_screening/config/.env down -v # remove the volume if it exists

diagrams:
docker run -it --rm -p 8080:8080 -v ${PWD}/docs/diagrams:/usr/local/structurizr structurizr/lite

# ---------------------------------------------------------------------------
# Bootstrap & Environment
# ---------------------------------------------------------------------------
# Configure development environment (main) @Configuration
config: manage_breast_screening/config/.env \
_install-tools \
Expand All @@ -20,12 +44,6 @@ assets: # Compile assets @Pipeline
npm run compile
poetry run playwright install

build: # Build the project artefact @Pipeline
docker build -t "app:$$(git rev-parse HEAD)" .

deploy: # Deploy the project artefact to the target environment @Pipeline
# TODO: Implement the artefact deployment step

githooks-config:
if ! command -v pre-commit >/dev/null 2>&1; then \
pip install pre-commit; \
Expand All @@ -37,35 +55,20 @@ githooks-run: # Run git hooks configured in this repository @Operations
--config scripts/config/pre-commit.yaml \
--all-files

help: # Print help @Others
printf "\nUsage: \033[3m\033[93m[arg1=val1] [arg2=val2] \033[0m\033[0m\033[32mmake\033[0m\033[34m <command>\033[0m\n\n"
perl -e '$(HELP_SCRIPT)' $(MAKEFILE_LIST)

test: test-unit test-ui test-lint # Run all tests @Testing

test-unit: # Run unit tests @Testing
poetry run pytest -m 'not system' --ignore manage_breast_screening/notifications/tests/dependencies --ignore manage_breast_screening/notifications/tests/integration --ignore manage_breast_screening/notifications/tests/end_to_end --cov --cov-report term-missing:skip-covered
npm test -- --coverage

test-lint: # Lint files @Testing
npm run lint
poetry run ruff check manage_breast_screening

# Enable this once we have fixed all the issues
# make test-lint-templates

test-lint-templates: # Lint just the templates @Testing
poetry run djlint -e jinja --lint --profile jinja manage_breast_screening

test-ui: # Run UI tests @Testing
poetry run pytest -m system --ignore manage_breast_screening/notifications

test-integration:
cd manage_breast_screening/notifications && ./tests/integration/run.sh
_install-poetry:
@if ! poetry --version >/dev/null 2>&1; then \
echo "Installing poetry..."; \
pip install poetry; \
else \
echo "poetry already installed"; \
fi

test-end-to-end:
cd manage_breast_screening/notifications && ./tests/end_to_end/run.sh
manage_breast_screening/config/.env:
cp manage_breast_screening/config/.env.tpl manage_breast_screening/config/.env

# ---------------------------------------------------------------------------
# Development Workflow
# ---------------------------------------------------------------------------
run: manage_breast_screening/config/.env # Start the development server @Development
poetry run ./manage.py runserver

Expand All @@ -92,23 +95,39 @@ models:
shell:
poetry run ./manage.py shell

_install-poetry:
@if ! poetry --version >/dev/null 2>&1; then \
echo "Installing poetry..."; \
pip install poetry; \
else \
echo "poetry already installed"; \
fi
# ---------------------------------------------------------------------------
# Testing
# ---------------------------------------------------------------------------
test: test-unit test-ui test-lint # Run all tests @Testing

_clean-docker:
docker compose --env-file manage_breast_screening/config/.env down -v # remove the volume if it exists
test-unit: # Run unit tests @Testing
poetry run pytest -m 'not system' --ignore manage_breast_screening/notifications/tests/dependencies --ignore manage_breast_screening/notifications/tests/integration --ignore manage_breast_screening/notifications/tests/end_to_end --cov --cov-report term-missing:skip-covered
npm test -- --coverage

manage_breast_screening/config/.env:
cp manage_breast_screening/config/.env.tpl manage_breast_screening/config/.env
test-lint: # Lint files @Testing
npm run lint
poetry run ruff check manage_breast_screening

diagrams:
docker run -it --rm -p 8080:8080 -v ${PWD}/docs/diagrams:/usr/local/structurizr structurizr/lite
# Enable this once we have fixed all the issues
# make test-lint-templates

.DEFAULT_GOAL := help
.PHONY: clean config dependencies build deploy githooks-config githooks-run help test test-unit test-lint test-ui run _install-poetry _clean-docker rebuild-db db migrate seed shell
.SILENT: help run
test-lint-templates: # Lint just the templates @Testing
poetry run djlint -e jinja --lint --profile jinja manage_breast_screening

test-ui: # Run UI tests @Testing
poetry run pytest -m system --ignore manage_breast_screening/notifications

test-integration:
cd manage_breast_screening/notifications && ./tests/integration/run.sh

test-end-to-end:
cd manage_breast_screening/notifications && ./tests/end_to_end/run.sh

# ---------------------------------------------------------------------------
# Build & Deploy
# ---------------------------------------------------------------------------
build: # Build the project artefact @Pipeline
docker build -t "app:$$(git rev-parse HEAD)" .

deploy: # Deploy the project artefact to the target environment @Pipeline
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we never implemented this command from the template but we have separate terraform commands instead.

maybe we can just drop it? what do you think @saliceti ?

# TODO: Implement the artefact deployment step