-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
164 lines (136 loc) · 4.52 KB
/
Makefile
File metadata and controls
164 lines (136 loc) · 4.52 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
### Defensive settings for make:
# https://tech.davis-hansson.com/p/make/
SHELL:=bash
.ONESHELL:
.SHELLFLAGS:=-xeu -o pipefail -O inherit_errexit -c
.SILENT:
.DELETE_ON_ERROR:
MAKEFLAGS+=--warn-undefined-variables
MAKEFLAGS+=--no-builtin-rules
CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
GIT_FOLDER=$(CURRENT_DIR)/.git
PROJECT_NAME=keycloak-and-plone
STACK_NAME=keycloak-and-plone-example-com
VOLTO_VERSION=$(shell cat frontend/mrs.developer.json | python -c "import sys, json; print(json.load(sys.stdin)['core']['tag'])")
PLONE_VERSION=$(shell cat backend/version.txt)
# We like colors
# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects
RED=`tput setaf 1`
GREEN=`tput setaf 2`
RESET=`tput sgr0`
YELLOW=`tput setaf 3`
.PHONY: all
all: install
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
.PHONY: help
help: ## This help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
###########################################
# Frontend
###########################################
.PHONY: frontend-install
frontend-install: ## Install React Frontend
$(MAKE) -C "./frontend/" install
.PHONY: frontend-build
frontend-build: ## Build React Frontend
$(MAKE) -C "./frontend/" build
.PHONY: frontend-start
frontend-start: ## Start React Frontend
$(MAKE) -C "./frontend/" start
.PHONY: frontend-test
frontend-test: ## Test frontend codebase
@echo "Test frontend"
$(MAKE) -C "./frontend/" test
###########################################
# Backend
###########################################
.PHONY: backend-install
backend-install: ## Create virtualenv and install Plone
$(MAKE) -C "./backend/" install
$(MAKE) backend-create-site
.PHONY: backend-build
backend-build: ## Build Backend
$(MAKE) -C "./backend/" install
.PHONY: backend-create-site
backend-create-site: ## Create a Plone site with default content
$(MAKE) -C "./backend/" create-site
.PHONY: backend-update-example-content
backend-update-example-content: ## Export example content inside package
$(MAKE) -C "./backend/" update-example-content
.PHONY: backend-start
backend-start: ## Start Plone Backend
$(MAKE) -C "./backend/" start
.PHONY: backend-test
backend-test: ## Test backend codebase
@echo "Test backend"
$(MAKE) -C "./backend/" test
###########################################
# Environment
###########################################
.PHONY: install
install: ## Install
@echo "Install Backend & Frontend"
$(MAKE) backend-install
$(MAKE) frontend-install
.PHONY: clean
clean: ## Clean installation
@echo "Clean installation"
$(MAKE) -C "./backend/" clean
$(MAKE) -C "./frontend/" clean
###########################################
# QA
###########################################
.PHONY: format
format: ## Format codebase
@echo "Format the codebase"
$(MAKE) -C "./backend/" format
$(MAKE) -C "./frontend/" format
.PHONY: lint
lint: ## Format codebase
@echo "Lint the codebasecodebase"
$(MAKE) -C "./backend/" lint
$(MAKE) -C "./frontend/" lint
.PHONY: check
check: format lint ## Lint and Format codebase
###########################################
# i18n
###########################################
.PHONY: i18n
i18n: ## Update locales
@echo "Update locales"
$(MAKE) -C "./backend/" i18n
$(MAKE) -C "./frontend/" i18n
###########################################
# Testing
###########################################
.PHONY: test
test: backend-test frontend-test ## Test codebase
###########################################
# Container images
###########################################
.PHONY: build-images
build-images: ## Build container images
@echo "Build"
$(MAKE) -C "./backend/" build-image
$(MAKE) -C "./frontend/" build-image
###########################################
# Local Stack
###########################################
.PHONY: stack-start
stack-start: ## Local Stack: Start Services
@echo "Start local Docker stack"
@docker compose -f docker-compose.yml up -d --build
@echo "Now visit: http://sso.localhost"
.PHONY: stack-status
stack-status: ## Local Stack: Check Status
@echo "Check the status of the local Docker stack"
@docker compose -f docker-compose.yml ps
.PHONY: stack-stop
stack-stop: ## Local Stack: Stop Services
@echo "Stop local Docker stack"
@docker compose -f docker-compose.yml stop
.PHONY: stack-rm
stack-rm: ## Local Stack: Remove Services and Volumes
@echo "Remove local Docker stack"
@docker compose -f docker-compose.yml down