Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (76 loc) · 3.14 KB
/
Copy pathMakefile
File metadata and controls
96 lines (76 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
VENV_FOLDER=.venv
WEBCOMPONENTS_DIR=src/imio.smartweb.core/src/imio/smartweb/core/webcomponents
# Generic image checks from IMIO/gha; point it at a local clone to work on them.
PLONE_IMAGE_TEST ?= git+https://github.com/IMIO/gha@WEB-3639\#subdirectory=plone-image-test-notify
ifeq (, $(shell which uv ))
$(error "[ERROR] The 'uv' command is missing from your PATH. Install it from: https://docs.astral.sh/uv/getting-started/installation/")
endif
.PHONY: help
help: ## Display this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: install
install: $(VENV_FOLDER)/bin/buildout .git/hooks/pre-commit ## Install development environment
$(VENV_FOLDER)/bin/buildout
cd $(WEBCOMPONENTS_DIR) && npm install
.PHONY: start
start: bin/instance .git/hooks/pre-commit solr-background ## Start the instance
bin/instance fg
.PHONY: dev
dev: bin/instance .git/hooks/pre-commit solr-background $(WEBCOMPONENTS_DIR)/node_modules ## Start the instance + Vite dev server (webcomponents HMR)
@trap 'kill 0' EXIT INT TERM; \
VITE_DEV_URL=http://localhost:2000 bin/instance fg & \
(cd $(WEBCOMPONENTS_DIR) && npm run watch) & \
wait
.PHONY: build
build: $(WEBCOMPONENTS_DIR)/node_modules ## Build the webcomponents production bundle (Vite)
cd $(WEBCOMPONENTS_DIR) && npm run build
.PHONY: cleanall
cleanall: ## Clean development environment
rm -fr .git/hooks/pre-commit .installed.cfg .mr.developer.cfg .venv bin buildout.cfg develop-eggs downloads eggs include lib lib64 local parts pyvenv.cfg
.PHONY: upgrade-steps
upgrade-steps: ## Run upgrade steps
bin/instance -O Plone run scripts/run_portal_upgrades.py
.PHONY: test
test: ## Build the prod image, boot it with Postgres/Solr/memcached and run the smoke tests
uvx --from "$(PLONE_IMAGE_TEST)" plone-image-test \
--compose-file tests/docker-compose.test.yml \
--addons imio.smartweb.policy \
--log-allowlist tests/log_allowlist.txt \
-v tests
.PHONY: lint
lint: ## Run pre-commit hooks
uvx pre-commit run --all
.PHONY: release
release: ## Run full release with uvx zest.releaser
uvx --from zest.releaser fullrelease
.PHONY: solr
solr: ## Start solr container (foreground)
@if [ -d solr ] && [ "$$(stat -c %a solr)" != "777" ]; then \
sudo chmod -R 777 solr; \
fi
docker compose up solr
.PHONY: solr-background
solr-background: ## Start solr container (background)
@if [ -d solr ] && [ "$$(stat -c %a solr)" != "777" ]; then \
sudo chmod -R 777 solr; \
fi
docker compose up solr -d
.PHONY: solr-cluster
solr-cluster: ## Start solr cluster
docker compose -f docker-compose-solr-cluster.yml up
.venv:
@echo "Creating virtual environment with uv"
uv venv
buildout.cfg:
ln -fs dev.cfg buildout.cfg
$(VENV_FOLDER)/bin/buildout: .venv buildout.cfg
@echo "Installing requirements with uv pip interface"
uv pip install -r requirements.txt
bin/instance: $(VENV_FOLDER)/bin/buildout
@echo "Bootstrapping environment with buildout"
$(VENV_FOLDER)/bin/buildout
$(WEBCOMPONENTS_DIR)/node_modules:
cd $(WEBCOMPONENTS_DIR) && npm install
.git/hooks/pre-commit: .venv
@echo "Installing pre-commit hooks"
uvx pre-commit install