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

chore: Update dev dependencies #15

Merged
merged 3 commits into from
Feb 24, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ on: [push]
env:
ADDON_NAME: "@plonegovbr/volto-code-block"
ADDON_PATH: "volto-code-block"
VOLTO_VERSION: "16"
VOLTO_VERSION: "17"

jobs:

acceptance:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Install Cypress
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:

steps:
- name: Main checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Linting
run: make lint
2 changes: 1 addition & 1 deletion .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Generate Storybook
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:

steps:
- name: Main checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Linting
run: make test-ci
105 changes: 51 additions & 54 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RESET=`tput sgr0`
YELLOW=`tput setaf 3`

PLONE_VERSION=6
VOLTO_VERSION=16.26.0
VOLTO_VERSION=17.15.2

ADDON_NAME='@plonegovbr/volto-code-block'
ADDON_PATH='volto-code-block'
Expand All @@ -32,45 +32,43 @@ CMD=CURRENT_DIR=${CURRENT_DIR} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH}
DOCKER_COMPOSE=${CMD} -p ${ADDON_PATH} -f ${DEV_COMPOSE}
ACCEPTANCE=${CMD} -p ${ADDON_PATH}-acceptance -f ${ACCEPTANCE_COMPOSE}

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 ${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
${DOCKER_COMPOSE} build addon-storybook
${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

.PHONY: start-storybook
start-storybook: ## Starts Storybook
@echo "$(GREEN)==> Start Storybook $(RESET)"
${DOCKER_COMPOSE} up addon-storybook

.PHONY: debug
debug: ## Starts Dev container
@echo "$(GREEN)==> Start Addon Development container $(RESET)"
${DOCKER_COMPOSE} exec -it addon-dev bash

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

.PHONY: dev
dev: ## Develop the addon
Expand All @@ -84,73 +82,72 @@ dev: ## Develop the addon
help: ## Show this help.
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"

## Setup the local environment
.PHONY: install
install: ## Install the local environment, Cypress, build acceptance containers
yarn
make install-acceptance

# Dev Helpers
.PHONY: i18n
i18n: ## Sync i18n
${DOCKER_COMPOSE} run addon-dev i18n

.PHONY: build-storybook
build-storybook: ## Build storybook
@echo "$(GREEN)==> Build storybook $(RESET)"
if [ ! -d .storybook ]; then mkdir .storybook; fi
${DOCKER_COMPOSE} run addon-storybook build-storybook

.PHONY: release
release: ## Release package
yarn
npx release-it

.PHONY: dry-run-release
dry-run-release: ## Dry Run Release package
yarn
npx release-it --dry-run
@echo "$(YELLOW)==> Do not forget to setup the local environment (make install) $(RESET)"
yarn 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 --rm addon-dev lint:fix
${DEV_COMPOSE} run --rm addon-dev prettier:fix
${DEV_COMPOSE} run --rm 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 --rm addon-dev lint
${DEV_COMPOSE} run --rm addon-dev prettier
${DEV_COMPOSE} run --rm addon-dev stylelint --allow-empty-input

.PHONY: test
test: ## Run unit tests
${DOCKER_COMPOSE} run addon-dev test --watchAll
${DEV_COMPOSE} run --rm 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: release
release: ## Release a version of the add-on
yarn release
11 changes: 2 additions & 9 deletions acceptance/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
args:
ADDON_NAME: "${ADDON_NAME}"
ADDON_PATH: "${ADDON_PATH}"
VOLTO_VERSION: ${VOLTO_VERSION:-16}
VOLTO_VERSION: ${VOLTO_VERSION:-17}
environment:
RAZZLE_INTERNAL_API_PATH: http://backend-acceptance:55001/plone
RAZZLE_API_PATH: http://localhost:55001/plone
Expand All @@ -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
Binary file added acceptance/cypress/fixtures/halfdome2022.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 2 additions & 4 deletions acceptance/cypress/support/reset-fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ function setup() {
method: 'POST',
url: `${api_url}/RobotRemote`,
headers: { Accept: 'text/xml', 'content-type': 'text/xml' },
body:
'<?xml version="1.0"?><methodCall><methodName>run_keyword</methodName><params><param><value><string>remote_zodb_setup</string></value></param><param><value><array><data><value><string>plone.app.robotframework.testing.PLONE_ROBOT_TESTING</string></value></data></array></value></param></params></methodCall>',
body: '<?xml version="1.0"?><methodCall><methodName>run_keyword</methodName><params><param><value><string>remote_zodb_setup</string></value></param><param><value><array><data><value><string>plone.app.robotframework.testing.PLONE_ROBOT_TESTING</string></value></data></array></value></param></params></methodCall>',
}).then(() => cy.log('Setting up API fixture'));
}

Expand All @@ -15,8 +14,7 @@ function teardown() {
method: 'POST',
url: `${api_url}/RobotRemote`,
headers: { Accept: 'text/xml', 'content-type': 'text/xml' },
body:
'<?xml version="1.0"?><methodCall><methodName>run_keyword</methodName><params><param><value><string>remote_zodb_teardown</string></value></param><param><value><array><data><value><string>plone.app.robotframework.testing.PLONE_ROBOT_TESTING</string></value></data></array></value></param></params></methodCall>',
body: '<?xml version="1.0"?><methodCall><methodName>run_keyword</methodName><params><param><value><string>remote_zodb_teardown</string></value></param><param><value><array><data><value><string>plone.app.robotframework.testing.PLONE_ROBOT_TESTING</string></value></data></array></value></param></params></methodCall>',
}).then(() => cy.log('Tearing down API fixture'));
}

Expand Down
14 changes: 14 additions & 0 deletions acceptance/cypress/support/slate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const createSlateBlock = () => {
cy.get('.ui.basic.icon.button.block-add-button').first().click();
cy.get('.blocks-chooser .title').contains('Text').click();
cy.get('.ui.basic.icon.button.slate').contains('Text').click();
return getSelectedSlateEditor();
};

export const getSelectedSlateEditor = () => {
return cy.get('.slate-editor.selected [contenteditable=true]').click();
};

export const getSlateEditorAndType = (selector, type) => {
return cy.get(selector).focus().click().wait(1000).type(type).wait(1000);
};
5 changes: 0 additions & 5 deletions acceptance/cypress/tests/blocks.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ context('Blocks Acceptance Tests', () => {
path: '/document',
});
cy.visit('/document');
cy.waitForResourceToLoad('@navigation');
cy.waitForResourceToLoad('@breadcrumbs');
cy.waitForResourceToLoad('@actions');
cy.waitForResourceToLoad('@types');
cy.waitForResourceToLoad('document');
cy.navigate('/document/edit');
});

Expand Down
9 changes: 6 additions & 3 deletions acceptance/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ services:
addon-dev:
build:
context: ../
dockerfile: ./dockerfiles/Dockerfile.dev
dockerfile: ./dockerfiles/Dockerfile.acceptance
args:
ADDON_NAME: "${ADDON_NAME}"
ADDON_PATH: "${ADDON_PATH}"
VOLTO_VERSION: ${VOLTO_VERSION:-16}
VOLTO_VERSION: ${VOLTO_VERSION:-17}
volumes:
- ${CURRENT_DIR}:/app/src/addons/${ADDON_PATH}/
environment:
RAZZLE_INTERNAL_API_PATH: http://backend-acceptance:55001/plone
RAZZLE_API_PATH: http://localhost:55001/plone
HOST: 0.0.0.0
ports:
- 3000:3000
- 3001:3001
tty: true
depends_on:
- backend-acceptance
profiles:
Expand All @@ -30,10 +32,11 @@ services:
args:
ADDON_NAME: "${ADDON_NAME}"
ADDON_PATH: "${ADDON_PATH}"
VOLTO_VERSION: ${VOLTO_VERSION:-16}
VOLTO_VERSION: ${VOLTO_VERSION:-17}
environment:
RAZZLE_INTERNAL_API_PATH: http://backend-acceptance:55001/plone
RAZZLE_API_PATH: http://localhost:55001/plone
HOST: 0.0.0.0
ports:
- 3000:3000
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion acceptance/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dependencies": {
"@plone/volto-testing": "^3.1.0"
"@plone/volto-testing": "^4.0.0"
}
}
Loading
Loading