Skip to content

Commit 488db92

Browse files
authored
Atualiza componentes (#13)
* Atualiza componentes base do projeto. * Atualiza componentes
1 parent bd31a02 commit 488db92

27 files changed

+4621
-1869
lines changed

Makefile

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ MAKEFLAGS+=--no-builtin-rules
1111
CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
1212
GIT_FOLDER=$(CURRENT_DIR)/.git
1313

14-
PROJECT_NAME=pybr25-site
15-
STACK_NAME=2025-pythonbrasil-org-br
16-
STACK_FILE=docker-compose-dev.yml
14+
REPOSITORY_SETTINGS := $(shell uvx repoplone settings dump)
1715

16+
PROJECT_NAME := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.name')
17+
STACK_NAME=pythonbrasil-pybr25-site
1818

19-
VOLTO_VERSION=$(shell cat frontend/mrs.developer.json | python -c "import sys, json; print(json.load(sys.stdin)['core']['tag'])")
20-
PLONE_VERSION=$(shell cat backend/version.txt)
19+
VOLTO_VERSION := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.frontend.volto_version')
20+
PLONE_VERSION := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.backend.base_package_version')
21+
IMAGE_PREFIX := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.container_images_prefix')
2122

2223
# We like colors
2324
# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects
@@ -35,6 +36,13 @@ all: install
3536
help: ## This help message
3637
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
3738

39+
.PHONY: debug-settings
40+
debug-settings: ## Debug settings
41+
@echo "Debug settings"
42+
@echo "PROJECT_NAME: $(PROJECT_NAME)"
43+
@echo "VOLTO_VERSION: $(VOLTO_VERSION)"
44+
@echo "PLONE_VERSION: $(PLONE_VERSION)"
45+
3846
###########################################
3947
# Frontend
4048
###########################################
@@ -110,7 +118,7 @@ format: ## Format codebase
110118

111119
.PHONY: lint
112120
lint: ## Format codebase
113-
@echo "Lint the codebasecodebase"
121+
@echo "Lint the codebase"
114122
$(MAKE) -C "./backend/" lint
115123
$(MAKE) -C "./frontend/" lint
116124

@@ -144,31 +152,32 @@ build-images: ## Build container images
144152
###########################################
145153
# Local Stack
146154
###########################################
147-
.PHONY: stack-start
148-
stack-start: ## Local Stack: Start Services
149-
@echo "Start local Docker stack"
150-
VOLTO_VERSION=$(VOLTO_VERSION) PLONE_VERSION=$(PLONE_VERSION) docker compose -f $(STACK_FILE) up -d --build
151-
@echo "Now visit: http://pybr25-site.localhost"
152-
153155
.PHONY: stack-create-site
154156
stack-create-site: ## Local Stack: Create a new site
155157
@echo "Create a new site in the local Docker stack"
156-
VOLTO_VERSION=$(VOLTO_VERSION) PLONE_VERSION=$(PLONE_VERSION) docker compose -f $(STACK_FILE) exec backend ./docker-entrypoint.sh create-site
158+
@echo "(Stack must not be running already.)"
159+
VOLTO_VERSION=$(VOLTO_VERSION) PLONE_VERSION=$(PLONE_VERSION) docker compose -f docker-compose.yml run --build backend ./docker-entrypoint.sh create-site
160+
161+
.PHONY: stack-start
162+
stack-start: ## Local Stack: Start Services
163+
@echo "Start local Docker stack"
164+
VOLTO_VERSION=$(VOLTO_VERSION) PLONE_VERSION=$(PLONE_VERSION) docker compose -f docker-compose.yml up -d --build
165+
@echo "Now visit: http://pybr25.localhost"
157166

158167
.PHONY: stack-status
159168
stack-status: ## Local Stack: Check Status
160169
@echo "Check the status of the local Docker stack"
161-
@docker compose -f $(STACK_FILE) ps
170+
@docker compose -f docker-compose.yml ps
162171

163172
.PHONY: stack-stop
164173
stack-stop: ## Local Stack: Stop Services
165174
@echo "Stop local Docker stack"
166-
@docker compose -f $(STACK_FILE) stop
175+
@docker compose -f docker-compose.yml stop
167176

168177
.PHONY: stack-rm
169178
stack-rm: ## Local Stack: Remove Services and Volumes
170179
@echo "Remove local Docker stack"
171-
@docker compose -f $(STACK_FILE) down
180+
@docker compose -f docker-compose.yml down
172181
@echo "Remove local volume data"
173182
@docker volume rm $(PROJECT_NAME)_vol-site-data
174183

@@ -194,12 +203,12 @@ acceptance-test:
194203
.PHONY: acceptance-frontend-image-build
195204
acceptance-frontend-image-build:
196205
@echo "Build acceptance frontend image"
197-
@docker build frontend -t pythonbrasil/pybr25-site-frontend:acceptance -f frontend/Dockerfile --build-arg VOLTO_VERSION=$(VOLTO_VERSION)
206+
@docker build frontend -t $(IMAGE_PREFIX)-frontend:acceptance -f frontend/Dockerfile --build-arg VOLTO_VERSION=$(VOLTO_VERSION)
198207

199208
.PHONY: acceptance-backend-image-build
200209
acceptance-backend-image-build:
201210
@echo "Build acceptance backend image"
202-
@docker build backend -t pythonbrasil/pybr25-site-backend:acceptance -f backend/Dockerfile.acceptance --build-arg PLONE_VERSION=$(PLONE_VERSION)
211+
@docker build backend -t $(IMAGE_PREFIX)-backend:acceptance -f backend/Dockerfile.acceptance --build-arg PLONE_VERSION=$(PLONE_VERSION)
203212

204213
.PHONY: acceptance-images-build
205214
acceptance-images-build: ## Build Acceptance frontend/backend images
@@ -209,12 +218,12 @@ acceptance-images-build: ## Build Acceptance frontend/backend images
209218
.PHONY: acceptance-frontend-container-start
210219
acceptance-frontend-container-start:
211220
@echo "Start acceptance frontend"
212-
@docker run --rm -p 3000:3000 --name pybr25-site-frontend-acceptance --link pybr25-site-backend-acceptance:backend -e RAZZLE_API_PATH=http://localhost:55001/plone -e RAZZLE_INTERNAL_API_PATH=http://backend:55001/plone -d pythonbrasil/pybr25-site-frontend:acceptance
221+
@docker run --rm -p 3000:3000 --name pybr25-frontend-acceptance --link pybr25-backend-acceptance:backend -e RAZZLE_API_PATH=http://localhost:55001/plone -e RAZZLE_INTERNAL_API_PATH=http://backend:55001/plone -d $(IMAGE_PREFIX)-frontend:acceptance
213222

214223
.PHONY: acceptance-backend-container-start
215224
acceptance-backend-container-start:
216225
@echo "Start acceptance backend"
217-
@docker run --rm -p 55001:55001 --name pybr25-site-backend-acceptance -d pythonbrasil/pybr25-site-backend:acceptance
226+
@docker run --rm -p 55001:55001 --name pybr25-backend-acceptance -d $(IMAGE_PREFIX)-backend:acceptance
218227

219228
.PHONY: acceptance-containers-start
220229
acceptance-containers-start: ## Start Acceptance containers
@@ -224,8 +233,8 @@ acceptance-containers-start: ## Start Acceptance containers
224233
.PHONY: acceptance-containers-stop
225234
acceptance-containers-stop: ## Stop Acceptance containers
226235
@echo "Stop acceptance containers"
227-
@docker stop pybr25-site-frontend-acceptance
228-
@docker stop pybr25-site-backend-acceptance
236+
@docker stop pybr25-frontend-acceptance
237+
@docker stop pybr25-backend-acceptance
229238

230239
.PHONY: ci-acceptance-test
231240
ci-acceptance-test:

backend/Makefile

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ RED=`tput setaf 1`
1414
GREEN=`tput setaf 2`
1515
RESET=`tput sgr0`
1616
YELLOW=`tput setaf 3`
17-
18-
IMAGE_NAME_PREFIX=ghcr.io/pythonbrasil/pybr25-site
19-
IMAGE_TAG=latest
20-
2117
# Python checks
2218
UV?=uv
2319

@@ -26,12 +22,19 @@ ifeq (, $(shell which $(UV) ))
2622
$(error "UV=$(UV) not found in $(PATH)")
2723
endif
2824

25+
REPOSITORY_SETTINGS := $(shell uvx repoplone settings dump)
26+
IMAGE_NAME_PREFIX := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.container_images_prefix')
27+
28+
IMAGE_TAG=latest
29+
IMAGE_NAME=$(IMAGE_NAME_PREFIX)-backend:$(IMAGE_TAG)
2930
PLONE_SITE_ID=Plone
3031
BACKEND_FOLDER=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
31-
PLONE_VERSION=$(shell cat $(BACKEND_FOLDER)/version.txt)
32-
EXAMPLE_CONTENT_FOLDER=${BACKEND_FOLDER}/src/pythonbrasil/site/setuphandlers/examplecontent
32+
PLONE_VERSION := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.backend.base_package_version')
33+
EXAMPLE_CONTENT_FOLDER := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.backend.code_path')/setuphandlers/examplecontent
34+
PACKAGE_NAME := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.backend.name')
3335

3436
VENV_FOLDER=$(BACKEND_FOLDER)/.venv
37+
export VIRTUAL_ENV=$(VENV_FOLDER)
3538
BIN_FOLDER=$(VENV_FOLDER)/bin
3639

3740
# Environment variables to be exported
@@ -46,25 +49,31 @@ all: build
4649
help: ## This help message
4750
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
4851

49-
$(VENV_FOLDER): ## Install dependencies
50-
@echo "$(GREEN)==> Install environment$(RESET)"
51-
@uv sync
52+
.PHONY: debug-settings
53+
debug-settings: ## Debug settings
54+
@echo "PLONE_VERSION: $(PLONE_VERSION)"
55+
@echo "EXAMPLE_CONTENT_FOLDER: $(EXAMPLE_CONTENT_FOLDER)"
56+
57+
.PHONY: update-constraints
58+
update-constraints: ## Update backend constraints
59+
@echo "$(GREEN)==> Update backend constraints$(RESET)"
60+
@uvx repoplone deps constraints
5261

5362
.PHONY: sync
54-
sync: $(VENV_FOLDER) ## Sync project dependencies
63+
sync: update-constraints ## Sync project dependencies
5564
@echo "$(GREEN)==> Sync project dependencies$(RESET)"
5665
@uv sync
5766

67+
.PHONY: install
68+
install: sync config ## Install Plone and dependencies
69+
5870
instance/etc/zope.ini instance/etc/zope.conf: instance.yaml ## Create instance configuration
5971
@echo "$(GREEN)==> Create instance configuration$(RESET)"
6072
@uvx cookiecutter -f --no-input -c 2.1.1 --config-file instance.yaml gh:plone/cookiecutter-zope-instance
6173

6274
.PHONY: config
6375
config: instance/etc/zope.ini
6476

65-
.PHONY: install
66-
install: $(VENV_FOLDER) config ## Install Plone and dependencies
67-
6877
.PHONY: clean
6978
clean: ## Clean installation and instance
7079
@echo "$(RED)==> Cleaning environment and build$(RESET)"
@@ -114,7 +123,7 @@ format: ## Check and fix code base according to Plone standards
114123
.PHONY: i18n
115124
i18n: $(VENV_FOLDER) ## Update locales
116125
@echo "$(GREEN)==> Updating locales$(RESET)"
117-
@uv run python -m pythonbrasil.site.locales
126+
@uv run python -m $(PACKAGE_NAME).locales
118127

119128
# Tests
120129
.PHONY: test
@@ -123,17 +132,18 @@ test: $(VENV_FOLDER) ## run tests
123132

124133
.PHONY: test-coverage
125134
test-coverage: $(VENV_FOLDER) ## run tests with coverage
126-
@uv run pytest --cov=pythonbrasil.site --cov-report term-missing
135+
@uv run pytest --cov=$(PACKAGE_NAME) --cov-report term-missing
127136

128137
# Build Docker images
129138
.PHONY: build-image
130139
build-image: ## Build Docker Images
131-
@docker build . -t $(IMAGE_NAME_PREFIX)-backend:$(IMAGE_TAG) -f Dockerfile --build-arg PLONE_VERSION=$(PLONE_VERSION)
140+
@echo "$(GREEN)==> Building image $(IMAGE_NAME) $(RESET)"
141+
@docker build . -t $(IMAGE_NAME) --progress plain -f Dockerfile
132142

133143
# Acceptance tests
134144
.PHONY: acceptance-backend-start
135145
acceptance-backend-start: ## Start backend acceptance server
136-
ZSERVER_HOST=0.0.0.0 ZSERVER_PORT=55001 LISTEN_PORT=55001 APPLY_PROFILES="pythonbrasil.site:default" CONFIGURE_PACKAGES="plone.restapi,plone.volto,plone.volto.cors,pythonbrasil.site" $(BIN_FOLDER)/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING
146+
ZSERVER_HOST=0.0.0.0 ZSERVER_PORT=55001 LISTEN_PORT=55001 APPLY_PROFILES="pybr25.core:default" CONFIGURE_PACKAGES="plone.restapi,plone.volto,plone.volto.cors,pybr25.core" $(BIN_FOLDER)/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING
137147

138148
.PHONY: acceptance-image-build
139149
acceptance-image-build: ## Build Docker Images

backend/news/+make.internal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Atualiza Makefile para uso do repoplone. @ericof

backend/news/+plone.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Atualiza Plone para versão 6.1.3. @ericof

backend/news/+socialmedia.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Atualiza plonegovbr.socialmedia para 2.0.0a10. @ericof

backend/news/+techevent.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Atualiza collective.techevent para versão 1.0.0b1. @ericof

0 commit comments

Comments
 (0)