2024-02-24 00:13:16 +00:00
|
|
|
MY_USER := $(shell id -u)
|
|
|
|
MY_GROUP := $(shell id -g)
|
|
|
|
ME := $(MY_USER):$(MY_GROUP)
|
|
|
|
|
2024-02-27 14:13:02 +00:00
|
|
|
SUDO ?= sudo
|
|
|
|
|
|
|
|
ARENA_CONTAINER ?= spiff-arena
|
|
|
|
ARENA_DEV_OVERLAY ?= dev.docker-compose.yml
|
|
|
|
|
2024-02-24 00:13:16 +00:00
|
|
|
BACKEND_CONTAINER ?= spiffworkflow-backend
|
|
|
|
BACKEND_DEV_OVERLAY ?= spiffworkflow-backend/dev.docker-compose.yml
|
|
|
|
|
2024-02-23 00:31:55 +00:00
|
|
|
FRONTEND_CONTAINER ?= spiffworkflow-frontend
|
|
|
|
FRONTEND_DEV_OVERLAY ?= spiffworkflow-frontend/dev.docker-compose.yml
|
|
|
|
|
2024-02-24 00:13:16 +00:00
|
|
|
DOCKER_COMPOSE ?= RUN_AS=$(ME) docker compose $(YML_FILES)
|
2024-02-27 14:13:02 +00:00
|
|
|
IN_ARENA ?= $(DOCKER_COMPOSE) run $(ARENA_CONTAINER)
|
2024-02-24 00:13:16 +00:00
|
|
|
IN_BACKEND ?= $(DOCKER_COMPOSE) run $(BACKEND_CONTAINER)
|
|
|
|
IN_FRONTEND ?= $(DOCKER_COMPOSE) run $(FRONTEND_CONTAINER)
|
|
|
|
|
2024-02-29 14:55:09 +00:00
|
|
|
SPIFFWORKFLOW_BACKEND_ENV ?= local_development
|
|
|
|
|
2024-02-24 00:13:16 +00:00
|
|
|
YML_FILES := -f docker-compose.yml \
|
2024-02-27 14:13:02 +00:00
|
|
|
-f $(BACKEND_DEV_OVERLAY) \
|
|
|
|
-f $(FRONTEND_DEV_OVERLAY) \
|
|
|
|
-f $(ARENA_DEV_OVERLAY)
|
2024-02-24 00:13:16 +00:00
|
|
|
|
2024-02-27 14:13:02 +00:00
|
|
|
all: dev-env start-dev run-pyl
|
2024-02-24 00:13:16 +00:00
|
|
|
@/bin/true
|
|
|
|
|
|
|
|
build-images:
|
|
|
|
$(DOCKER_COMPOSE) build
|
|
|
|
|
2024-02-29 10:27:06 +00:00
|
|
|
dev-env: stop-dev build-images poetry-i be-poetry-i be-recreate-db fe-npm-i
|
2024-02-24 00:13:16 +00:00
|
|
|
@/bin/true
|
2024-02-23 00:31:55 +00:00
|
|
|
|
2024-02-24 00:13:16 +00:00
|
|
|
start-dev: stop-dev
|
|
|
|
$(DOCKER_COMPOSE) up -d
|
2024-02-23 00:31:55 +00:00
|
|
|
|
|
|
|
stop-dev:
|
2024-02-24 00:13:16 +00:00
|
|
|
$(DOCKER_COMPOSE) down
|
|
|
|
|
2024-02-27 14:13:02 +00:00
|
|
|
be-clear-log-file:
|
|
|
|
$(IN_BACKEND) rm -f log/unit_testing.log
|
|
|
|
|
2024-02-27 23:17:14 +00:00
|
|
|
be-logs:
|
|
|
|
docker logs -f $(BACKEND_CONTAINER)
|
|
|
|
|
2024-02-27 14:13:02 +00:00
|
|
|
be-mypy:
|
|
|
|
$(IN_BACKEND) poetry run mypy src tests
|
|
|
|
|
2024-02-29 10:27:06 +00:00
|
|
|
be-poetry-i:
|
|
|
|
$(IN_BACKEND) poetry install
|
|
|
|
|
2024-02-24 00:13:16 +00:00
|
|
|
be-recreate-db:
|
|
|
|
$(IN_BACKEND) ./bin/recreate_db clean
|
|
|
|
|
2024-02-27 14:13:02 +00:00
|
|
|
be-ruff:
|
|
|
|
$(IN_BACKEND) poetry run ruff --fix .
|
|
|
|
|
2024-02-24 00:13:16 +00:00
|
|
|
be-sh:
|
|
|
|
$(IN_BACKEND) /bin/bash
|
|
|
|
|
2024-02-29 14:55:09 +00:00
|
|
|
be-sqlite:
|
|
|
|
@if [ ! -f "$(BACKEND_CONTAINER)/src/instance/db_$(SPIFFWORKFLOW_BACKEND_ENV).sqlite3" ]; then \
|
|
|
|
echo "SQLite database file does not exist: $(BACKEND_CONTAINER)/src/instance/db_$(SPIFFWORKFLOW_BACKEND_ENV).sqlite3"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
$(IN_BACKEND) sqlite3 src/instance/db_$(SPIFFWORKFLOW_BACKEND_ENV).sqlite3
|
|
|
|
|
2024-02-27 14:13:02 +00:00
|
|
|
be-tests: be-clear-log-file
|
2024-02-24 00:13:16 +00:00
|
|
|
$(IN_BACKEND) poetry run pytest
|
|
|
|
|
2024-02-27 14:13:02 +00:00
|
|
|
be-tests-par: be-clear-log-file
|
2024-02-24 00:13:16 +00:00
|
|
|
$(IN_BACKEND) poetry run pytest -n auto -x --random-order
|
2024-02-23 00:31:55 +00:00
|
|
|
|
|
|
|
fe-lint-fix:
|
2024-02-24 00:13:16 +00:00
|
|
|
$(IN_FRONTEND) npm run lint:fix
|
|
|
|
|
2024-02-27 23:17:14 +00:00
|
|
|
fe-logs:
|
|
|
|
docker logs -f $(FRONTEND_CONTAINER)
|
|
|
|
|
2024-02-24 00:13:16 +00:00
|
|
|
fe-npm-i:
|
2024-02-28 14:49:45 +00:00
|
|
|
$(IN_FRONTEND) npm i && git checkout -- spiffworkflow-frontend/package-lock.json
|
2024-02-23 00:31:55 +00:00
|
|
|
|
|
|
|
fe-sh:
|
2024-02-24 00:13:16 +00:00
|
|
|
$(IN_FRONTEND) /bin/bash
|
|
|
|
|
2024-02-29 10:27:06 +00:00
|
|
|
poetry-i:
|
|
|
|
$(IN_ARENA) poetry install --no-root
|
|
|
|
|
2024-02-27 14:13:02 +00:00
|
|
|
pre-commit:
|
|
|
|
$(IN_ARENA) poetry run pre-commit run --verbose --all-files
|
|
|
|
|
|
|
|
run-pyl: fe-lint-fix pre-commit be-mypy be-tests-par
|
|
|
|
@/bin/true
|
|
|
|
|
|
|
|
sh:
|
|
|
|
$(IN_ARENA) /bin/bash
|
|
|
|
|
2024-02-24 00:13:16 +00:00
|
|
|
take-ownership:
|
2024-02-27 14:13:02 +00:00
|
|
|
$(SUDO) chown -R $(ME) .
|
2024-02-23 00:31:55 +00:00
|
|
|
|
2024-02-24 00:13:16 +00:00
|
|
|
.PHONY: build-images dev-env \
|
|
|
|
start-dev stop-dev \
|
2024-02-29 14:55:09 +00:00
|
|
|
be-clear-log-file be-logs be-mypy be-poetry-i be-recreate-db be-ruff be-sh be-sqlite be-tests be-tests-par \
|
2024-02-27 23:17:14 +00:00
|
|
|
fe-lint-fix fe-logs fe-npm-i fe-sh \
|
2024-02-29 10:27:06 +00:00
|
|
|
poetry-i pre-commit run-pyl \
|
2024-02-24 00:13:16 +00:00
|
|
|
take-ownership
|