Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docker environment #23

Merged
merged 3 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cypress
node_modules
acceptance
48 changes: 48 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"extends": ["react-app", "prettier", "plugin:jsx-a11y/recommended"],
"plugins": ["prettier", "react-hooks", "jsx-a11y"],
"env": {
"es6": true,
"browser": true,
"node": true,
"mocha": true,
"jasmine": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"legacyDecorators": true
}
},
"rules": {
"import/no-unresolved": 0,
"no-alert": 1,
"no-console": 1,
"no-debugger": 1,
"prettier/prettier": [
"error",
{ "trailingComma": "all", "singleQuote": true }
],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/react-in-jsx-scope": "off"
},
"globals": {
"root": true,
"__DEVELOPMENT__": true,
"__CLIENT__": true,
"__SERVER__": true,
"__DISABLE_SSR__": true,
"__DEVTOOLS__": true,
"__DEBUG__": true,
"__SSR__": true,
"__SENTRY__": true,
"cy": true,
"Cypress": true,
"jest": true,
"socket": true,
"webpackIsomorphicTools": true
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
build
.changelog.draft

# yarn 3
.pnp.*
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CHANGELOG.md
README.md
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"trailingComma": "all",
"singleQuote": true,
"overrides": [
{
"files": "*.overrides",
"options": {
"parser": "less"
}
}
]
}
33 changes: 33 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"extends": [
"stylelint-config-prettier",
"stylelint-config-idiomatic-order"
],
"plugins": [
"stylelint-prettier"
],
"overrides": [
{
"files": [
"**/*.less"
],
"customSyntax": "postcss-less"
},
{
"files": [
"**/*.overrides"
],
"customSyntax": "postcss-less"
},
{
"files": [
"**/*.scss"
],
"customSyntax": "postcss-scss"
}
],
"rules": {
"prettier/prettier": true,
"order/properties-alphabetical-order": null
}
}
69 changes: 42 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# https://tech.davis-hansson.com/p/make/
SHELL:=bash
.ONESHELL:
.SHELLFLAGS:=-xeu -o pipefail -O inherit_errexit -c
.SHELLFLAGS:=-eu -o pipefail -c
.SILENT:
.DELETE_ON_ERROR:
MAKEFLAGS+=--warn-undefined-variables
Expand All @@ -24,38 +24,45 @@ YELLOW=`tput setaf 3`
PLONE_VERSION=6
VOLTO_VERSION=16.20.3

ADDON_NAME='@kitconcept/volto-slider-block'
ADDON_PATH='volto-slider-block'
DEV_COMPOSE=dockerfiles/docker-compose.yml
ADDON_NAME='@kitconcept/volto-light-theme'
ADDON_PATH='volto-light-theme'
COMPOSE_FILE=dockerfiles/docker-compose.yml
ACCEPTANCE_COMPOSE=acceptance/docker-compose.yml
CMD=CURRENT_DIR=${CURRENT_DIR} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH} VOLTO_VERSION=${VOLTO_VERSION} PLONE_VERSION=${PLONE_VERSION} docker compose
DOCKER_COMPOSE=${CMD} -p ${ADDON_PATH} -f ${DEV_COMPOSE}
DOCKER_COMPOSE=${CMD} -p ${ADDON_PATH} -f ${COMPOSE_FILE}
DEV_COMPOSE=COMPOSE_PROFILES=dev ${DOCKER_COMPOSE}
LIVE_COMPOSE=COMPOSE_PROFILES=dev ${DOCKER_COMPOSE}
ACCEPTANCE=${CMD} -p ${ADDON_PATH}-acceptance -f ${ACCEPTANCE_COMPOSE}

.PHONY: build-backend
build-backend: ## Build
@echo "$(GREEN)==> Build Backend Container $(RESET)"
${DOCKER_COMPOSE} build backend
${DEV_COMPOSE} build backend

.PHONY: start-backend
start-backend: ## Starts Docker backend
@echo "$(GREEN)==> Start Docker-based Plone Backend $(RESET)"
${DOCKER_COMPOSE} up backend -d
${DEV_COMPOSE} up backend -d

.PHONY: stop-backend
stop-backend: ## Stop Docker backend
@echo "$(GREEN)==> Stop Docker-based Plone Backend $(RESET)"
${DOCKER_COMPOSE} stop backend
${DEV_COMPOSE} stop backend

.PHONY: build-live
build-live: ## Build Addon live
@echo "$(GREEN)==> Build Addon development container $(RESET)"
${LIVE_COMPOSE} build addon-live

.PHONY: build-addon
build-addon: ## Build Addon dev
@echo "$(GREEN)==> Build Addon development container $(RESET)"
${DOCKER_COMPOSE} build addon-dev
${DEV_COMPOSE} build addon-dev

.PHONY: start-dev
start-dev: ## Starts Dev container
@echo "$(GREEN)==> Start Addon Development container $(RESET)"
${DOCKER_COMPOSE} up addon-dev
${DEV_COMPOSE} up addon-dev

.PHONY: dev
dev: ## Develop the addon
Expand All @@ -72,54 +79,62 @@ help: ## Show this help.
# Dev Helpers
.PHONY: i18n
i18n: ## Sync i18n
${DOCKER_COMPOSE} run addon-dev i18n
${DEV_COMPOSE} run addon-dev i18n

.PHONY: format
format: ## Format codebase
${DOCKER_COMPOSE} run addon-dev lint:fix
${DOCKER_COMPOSE} run addon-dev prettier:fix
${DOCKER_COMPOSE} run addon-dev stylelint:fix
${DEV_COMPOSE} run addon-dev lint:fix
${DEV_COMPOSE} run addon-dev prettier:fix
${DEV_COMPOSE} run addon-dev stylelint:fix

.PHONY: lint
lint: ## Lint Codebase
${DOCKER_COMPOSE} run addon-dev lint
${DOCKER_COMPOSE} run addon-dev prettier
${DOCKER_COMPOSE} run addon-dev stylelint
${DEV_COMPOSE} run addon-dev lint
${DEV_COMPOSE} run addon-dev prettier
${DEV_COMPOSE} run addon-dev stylelint --allow-empty-input

.PHONY: test
test: ## Run unit tests
${DOCKER_COMPOSE} run addon-dev test --watchAll
${DEV_COMPOSE} run addon-dev test --watchAll

.PHONY: test-ci
test-ci: ## Run unit tests in CI
${DOCKER_COMPOSE} run -e CI=1 addon-dev test
${DEV_COMPOSE} run -e CI=1 addon-dev test

## Acceptance
.PHONY: install-acceptance
install-acceptance: ## Install Cypress, build containers
install-acceptance: ## Install Cypress, build acceptance containers
(cd acceptance && yarn)
${ACCEPTANCE} --profile dev --profile prod build

.PHONY: start-test-acceptance-server
start-test-acceptance-server: ## Start acceptance server
${ACCEPTANCE} --profile dev up -d
start-test-acceptance-server: ## Start acceptance server (for use it in while developing)
${ACCEPTANCE} --profile dev up

.PHONY: start-test-acceptance-server-prod
start-test-acceptance-server-prod: ## Start acceptance server
start-test-acceptance-server-prod: ## Start acceptance server in prod (used by CI)
${ACCEPTANCE} --profile prod up -d

.PHONY: test-acceptance
test-acceptance: ## Start Cypress
test-acceptance: ## Start Cypress (for use it while developing)
(cd acceptance && ./node_modules/.bin/cypress open)

.PHONY: test-acceptance-headless
test-acceptance-headless: ## Run cypress tests in CI
(cd acceptance && ./node_modules/.bin/cypress run)

.PHONY: stop-test-acceptance-server
stop-test-acceptance-server: ## Stop acceptance server
${ACCEPTANCE} down
stop-test-acceptance-server: ## Stop acceptance server (for use it while finished developing)
${ACCEPTANCE} --profile dev down

.PHONY: status-test-acceptance-server
status-test-acceptance-server: ## Status of Acceptance Server
status-test-acceptance-server: ## Status of Acceptance Server (for use it while developing)
${ACCEPTANCE} ps

.PHONY: debug-frontend
debug-frontend: ## Run bash in the Frontend container (for debug infrastructure purposes)
${DEV_COMPOSE} run --entrypoint bash addon-dev

.PHONY: pull-backend-image
pull-backend-image: ## Pulls and updates the backend image (for use it while developing)
docker pull ghcr.io/kitconcept/voltolighttheme:latest
9 changes: 1 addition & 8 deletions acceptance/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,7 @@ services:
- prod

backend-acceptance:
image: plone/plone-backend:${PLONE_VERSION:-6}
command: ./bin/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING
environment:
ZSERVER_HOST: 0.0.0.0
ZSERVER_PORT: 55001
ADDONS: 'plone.app.robotframework==2.0.0'
APPLY_PROFILES: plone.app.contenttypes:plone-content,plone.restapi:default,plone.volto:default-homepage
CONFIGURE_PACKAGES: plone.app.contenttypes,plone.restapi,plone.volto,plone.volto.cors
image: plone/server-acceptance:${PLONE_VERSION:-6}
ports:
- 55001:55001
profiles:
Expand Down
9 changes: 1 addition & 8 deletions acceptance/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,7 @@ services:
- prod

backend-acceptance:
image: plone/plone-backend:${PLONE_VERSION:-6}
command: ./bin/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING
environment:
ZSERVER_HOST: 0.0.0.0
ZSERVER_PORT: 55001
ADDONS: 'plone.app.robotframework==2.0.0'
APPLY_PROFILES: plone.app.contenttypes:plone-content,plone.restapi:default,plone.volto:default-homepage
CONFIGURE_PACKAGES: plone.app.contenttypes,plone.restapi,plone.volto,plone.volto.cors
image: plone/server-acceptance:${PLONE_VERSION:-6}
ports:
- 55001:55001
profiles:
Expand Down
1 change: 1 addition & 0 deletions news/23.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update docker environment @sneridagh
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
}
},
"devDependencies": {
"@plone/scripts": "^2.3.0",
"release-it": "^14.14.2"
"@plone/scripts": "^3.0.0",
"release-it": "^16.1.3"
},
"dependencies": {
"deepmerge": "4.2.2",
Expand Down
Loading