-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
216 lines (165 loc) · 8 KB
/
Makefile
File metadata and controls
216 lines (165 loc) · 8 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# Project settings
include variables.mk
# Allow setting the language for backend-docker-start. Default is `en`.
SITE_DEFAULT_LANGUAGE ?=en
# Sphinx variables
# You can set these variables from the command line.
SPHINXOPTS ?=
VALEOPTS ?=
# Internal variables.
SPHINXBUILD = "$(realpath bin/sphinx-build)"
SPHINXAUTOBUILD = "$(realpath bin/sphinx-autobuild)"
DOCS_DIR = ./docs/
BUILDDIR = ../_build
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(SPHINXOPTS) .
VALEFILES := $(shell find $(DOCS_DIR) -type f -name "*.md" -print)
# Recipe snippets for reuse
CHECKOUT_BASENAME="$(shell basename $(shell realpath ./))"
CHECKOUT_BRANCH=$(shell git branch --show-current)
CHECKOUT_TMP=../$(CHECKOUT_BASENAME).tmp
CHECKOUT_TMP_ABS="$(shell realpath $(CHECKOUT_TMP))"
.PHONY: test-colors
test-colors:
@echo "$(RED)This is red$(RESET)"
@echo "$(GREEN)This is green$(RESET)"
@echo "$(YELLOW)This is yellow$(RESET)"
@echo "$(CYAN)This is cyan$(RESET)"
# Top-level targets
.PHONY: all
all: help
# Add the following 'help' target to your Makefile
# and add help text after each target name starting with ' ##'
# to return a pretty list of targets and their descriptions.
.PHONY: help
help: ## This help message
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/$(CYAN)\1$(RESET):\2/' | column -c2 -t -s :)"
.PHONY: start
start: ## Starts Seven in development mode
pnpm start
.PHONY: start-publicui
start-publicui: ## Starts Seven in development mode (Public UI only)
pnpm start:publicui
.PHONY: build
build: ## Build a production bundle for distribution
pnpm build
.PHONY: build-publicui
build-publicui: ## Build a production bundle for distribution (Public UI only)
pnpm build:publicui
.PHONY: test
test: ## Run Seven unit tests
pnpm test
.PHONY: clean
clean: ## Clean development environment
find . -name "node_modules" -type d -prune -not -path "./packages/**/__tests__/*" -exec rm -rf {} \;
.PHONY: install
install: ## Set up development environment
# Setup ESlint for VSCode
pnpm i
node packages/scripts/vscodesettings.js
make build-deps
##### Documentation
bin/python: ## Create a Python virtual environment with the latest pip, and install documentation requirements
python3 -m venv . || virtualenv --clear --python=python3 .
bin/python -m pip install --upgrade pip
@echo "Python environment created."
bin/pip install -r requirements-docs.txt
@echo "Requirements installed."
.PHONY: docs-distclean
docs-distclean: ## Clean Python virtual environment
rm -rf bin include lib
@echo "Cleaned Python virtual environment."
.PHONY: docs-clean
docs-clean: ## Clean docs build directory
cd $(DOCS_DIR) && rm -rf $(BUILDDIR)/
@echo "Cleaned docs build directory."
.PHONY: docs-news
docs-news: ## Create or update the symlink from docs to volto package
if [ -f /tmp/foo.txt ]; then rm docs/news; fi
ln -snf ../packages/volto/news docs/news
@echo "Symlink to Seven news created or updated.";
.PHONY: docs-html
docs-html: bin/python docs-news ## Build html
cd $(DOCS_DIR) && $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
.PHONY: docs-livehtml
docs-livehtml: bin/python docs-news ## Rebuild Sphinx documentation on changes, with live-reload in the browser
cd "$(DOCS_DIR)" && ${SPHINXAUTOBUILD} \
--ignore "*.swp" \
-b html . "$(BUILDDIR)/html" $(SPHINXOPTS)
.PHONY: docs-linkcheck
docs-linkcheck: bin/python docs-news ## Run linkcheck
cd $(DOCS_DIR) && $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/ ."
.PHONY: docs-linkcheckbroken
docs-linkcheckbroken: bin/python docs-news ## Run linkcheck and show only broken links
cd $(DOCS_DIR) && $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck | GREP_COLORS='0;31' grep -wi "broken\|redirect" --color=always | GREP_COLORS='0;31' grep -vi "https://github.com/plone/volto/issues/" --color=always && if test $$? -eq 0; then exit 1; fi || test $$? -ne 0
.PHONY: docs-vale
docs-vale: bin/python docs-news ## Install (once) and run Vale style, grammar, and spell checks
bin/vale sync
bin/vale --no-wrap $(VALEOPTS) $(VALEFILES)
@echo
@echo "Vale is finished; look for any errors in the above output."
.PHONY: docs-rtd-pr-preview
docs-rtd-pr-preview: ## Build previews of pull requests that have documentation changes on Read the Docs via CI
pip install -r requirements-docs.txt
cd $(DOCS_DIR) && sphinx-build -b html $(ALLSPHINXOPTS) ${READTHEDOCS_OUTPUT}/html/
.PHONY: docs-test
docs-test: docs-clean docs-linkcheckbroken docs-vale ## Clean docs build, then run linkcheckbroken, vale
##### Build
packages/registry/dist: $(shell find packages/registry/src -type f)
pnpm build:registry
packages/components/dist: $(shell find packages/components/src -type f)
pnpm build:components
packages/client/dist: $(shell find packages/client/src -type f)
pnpm build:client
packages/helpers/dist: $(shell find packages/helpers/src -type f)
pnpm build:helpers
packages/react-router/dist: $(shell find packages/react-router/src -type f)
pnpm build:react-router
.PHONY: build-deps
build-deps: packages/registry/dist packages/components/dist packages/client/dist packages/react-router/dist packages/helpers/dist ## Build dependencies
##### Release
.PHONY: release-notes-copy-to-docs
release-notes-copy-to-docs: ## Copy release notes into documentation
cp CHANGELOG.md docs/release-notes/index.md
git add docs/release-notes/index.md
##### Docker containers
.PHONY: backend-docker-start
backend-docker-start: ## Starts a Docker-based backend for development
docker run -it --rm --name=backend -p 8080:8080 -v volto-backend-data:/data -e SITE=Plone -e ADDONS='$(KGS)' -e SITE_DEFAULT_LANGUAGE='$(SITE_DEFAULT_LANGUAGE)' $(DOCKER_IMAGE)
.PHONY: backend-docker-start-no-cors
backend-docker-start-no-cors: ## Starts the Docker-based backend without CORS in detached mode (daemon)
docker run -it --rm --name=backend -p 8080:8080 -e SITE=Plone -e ADDONS='$(KGS)' -e CORS_=true $(DOCKER_IMAGE)
.PHONY: frontend-docker-start
frontend-docker-start: ## Starts a Docker-based frontend for development
echo "This should start a container with the Seven frontend for demo purposes..."
##### Acceptance tests
######### Dev mode Acceptance tests
.PHONY: acceptance-frontend-dev-start
acceptance-frontend-dev-start: ## Start acceptance frontend in development mode
PLONE_API_PATH=http://localhost:55001/plone pnpm --filter seven start
######### Seven Acceptance tests
.PHONY: acceptance-backend-start
acceptance-backend-start: ## Start backend acceptance server
docker run -it --rm -p 55001:55001 -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,plone.volto:default,plone.app.discussion:default $(DOCKER_IMAGE_ACCEPTANCE)
.PHONY: ci-acceptance-backend-start
ci-acceptance-backend-start: ## Start backend acceptance server in headless mode for CI
docker run -i --rm -p 55001:55001 -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,plone.volto:default,plone.app.discussion:default $(DOCKER_IMAGE_ACCEPTANCE)
.PHONY: acceptance-frontend-prod-start
acceptance-frontend-prod-start: ## Start acceptance frontend in production mode
pnpm --filter seven build && PLONE_API_PATH=http://localhost:55001/plone pnpm --filter seven start:prod
.PHONY: acceptance-test
acceptance-test: ## Start Cypress in interactive mode
pnpm exec playwright test --ui
.PHONY: ci-acceptance-test
ci-acceptance-test: ## Run cypress tests in headless mode for CI
pnpm exec playwright test
.PHONY: ci-acceptance-test-run-all
ci-acceptance-test-run-all: ## With a single command, start both the acceptance frontend and backend acceptance server, and run Cypress tests in headless mode
$(NODEBIN)/start-test "make ci-acceptance-backend-start" http-get://localhost:55001/plone "make acceptance-frontend-prod-start" http://localhost:3000 "make ci-acceptance-test"
# include local overrides if present
-include Makefile.local
-include ../../../Makefile.local