Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
124 lines (95 loc) · 3.66 KB
/
Copy pathMakefile
File metadata and controls
124 lines (95 loc) · 3.66 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
# Makefile
.DEFAULT_GOAL := help
# Docker config.
DOCKER_PATH=./docker/docker-compose.yml
DOCKER_NAME=postgres
DOCKER_CONTAINER_NAME=hawapi-postgres
DOCKER_PORT=5432
# Database
DB_TYPE=postgres
DB_NAME=hawapi
DB_VERSION=15.1
# Colors
RED := $(shell tput -Txterm setaf 1)
GREEN := $(shell tput -Txterm setaf 2)
BLUE := $(shell tput -Txterm setaf 4)
CYAN := $(shell tput -Txterm setaf 6)
RESET := $(shell tput -Txterm sgr0)
## Application
dev: docker-start ## Start docker database and run spring application
@./mvnw spring-boot:run -e -Dmaven.test.skip=true -DskipTests
run: clean ## Run the spring application
@./mvnw spring-boot:run -e -Dmaven.test.skip=true -DskipTests
get: ## Get all pom dependencies
@./mvnw dependency:resolve-plugins
javadoc: ## Generate javadoc files
@./mvnw javadoc:javadoc
test: ## Run ALL tests of the spring application
@./mvnw test
test-unit: ## Run ONLY unit tests of the spring application
@./mvnw -Dtest="!*IntegrationTest" test
test-int: ## Run ONLY integration tests of the spring application
@./mvnw -Dtest="*IntegrationTest" test
compile: clean ## Compile the spring application
@./mvnw compile
build: clean ## Build website, test and package the spring application
@./scripts/get-website.sh --clean-before
@./mvnw javadoc:javadoc
@./mvnw package --file pom.xml
build-wot: clean ## Build website without test and package the spring application
@./scripts/get-website.sh --clean-before
@./mvnw javadoc:javadoc
@./mvnw package --file pom.xml -Dmaven.test.skip=true -DskipTests
verify: clean ## Verify the spring application
@./mvnw verify
clean: ## Clear the spring application
@./mvnw clean
## Website
website-build: ## Build the website
@./scripts/get-website.sh --clean-before
website-clean: ## Remove '.hawapi/' and 'resources/static/'
@./scripts/clean-website.sh --clean-hawapi --clean-static
## Docker
docker-status: ## Check the docker container status.
@docker ps --filter "name=${DOCKER_CONTAINER_NAME}"
docker-run: ## Build & Run the local docker.
@docker compose -f ${DOCKER_PATH} build ${DOCKER_NAME}
@docker compose -f ${DOCKER_PATH} up ${DOCKER_NAME}
docker-start: ## Start the local docker.
@docker compose -f ${DOCKER_PATH} start ${DOCKER_NAME}
@sleep 2
docker-stop: ## Stop the local docker.
@docker compose -f ${DOCKER_PATH} stop ${DOCKER_NAME}
docker-reset: ## Stop, Delete, Build and Start the local docker.
@docker compose -f ${DOCKER_PATH} stop ${DOCKER_NAME}
@docker compose -f ${DOCKER_PATH} rm ${DOCKER_NAME}
@docker compose -f ${DOCKER_PATH} build ${DOCKER_NAME}
@docker compose -f ${DOCKER_PATH} up ${DOCKER_NAME}
docker-prune: ## Delete local docker volumes.
@docker compose -f ${DOCKER_PATH} rm ${DOCKER_NAME}
@cd ./docker
@docker volume prune
## Help
config: ## Show all configuration (Docker, database, etc...)
@echo
@echo 'Configuration:'
@echo ' ${BLUE}Docker:${RESET}'
@echo ' ${CYAN}Port: ${GREEN}${DOCKER_PORT} ${RESET}'
@echo ' ${CYAN}Path: ${GREEN}${DOCKER_PATH} ${RESET}'
@echo ' ${CYAN}Name (Container): ${GREEN}${DOCKER_CONTAINER_NAME} ${RESET}'
@echo ' ${BLUE}Database: ${RESET}'
@echo ' ${CYAN}Name: ${GREEN}${DB_NAME} ${RESET}'
@echo ' ${CYAN}Type: ${GREEN}${DB_TYPE} ${RESET}'
@echo ' ${CYAN}Version: ${GREEN}${DB_VERSION} ${RESET}'
@echo
# https://gist.github.com/thomaspoignant/5b72d579bd5f311904d973652180c705
help: ## Show this help.
@echo
@echo 'Usage:'
@echo ' ${CYAN}make${RESET} ${GREEN}<target>${RESET}'
@echo
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} { \
if (/[a-zA-Z_\-]+:.*?##.*$$/) {printf " ${CYAN}%-25s${GREEN}%s${RESET}\n", $$1, $$2} \
else if (/^## .*$$/) {printf " ${BLUE}%s${RESET}\n", substr($$1,4)} \
}' $(MAKEFILE_LIST)