Skip to content

Commit

Permalink
Merge pull request #89 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
avoinea committed Nov 22, 2023
2 parents d0f8e85 + b98b3c7 commit 358af0b
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 51 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [7.0.0](https://github.com/eea/volto-columns-block/compare/6.4.0...7.0.0) - 22 November 2023

#### :boom: Breaking Change

- breaking(columns): removed extra div that wrapped the column children [David Ichim - [`a9a4b00`](https://github.com/eea/volto-columns-block/commit/a9a4b00d815894189c49391a0f29ef6933b6d817)]

#### :hammer_and_wrench: Others

### [6.4.0](https://github.com/eea/volto-columns-block/compare/6.3.5...6.4.0) - 2 November 2023

#### :house: Internal changes
Expand Down
22 changes: 15 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
pipeline {
tools {
jdk 'Java17'
}
agent {
node { label 'docker-host' }
}
Expand Down Expand Up @@ -74,7 +77,7 @@ pipeline {
stage('Build test image') {
steps {
checkout scm
sh '''docker build --build-arg="VOLTO_VERSION=$VOLTO" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend'''
sh '''docker build --pull --build-arg="VOLTO_VERSION=$VOLTO" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend'''
}
}

Expand Down Expand Up @@ -159,12 +162,13 @@ pipeline {
script {
try {
sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
sh '''docker run --link $IMAGE_NAME-plone:plone --entrypoint=make --name="$IMAGE_NAME-cypress" --workdir=/app/src/addons/${GIT_NAME} -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" $IMAGE_NAME-frontend cypress-ci'''
sh '''docker run -d --shm-size=3g --link $IMAGE_NAME-plone:plone --name="$IMAGE_NAME-cypress" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend start-ci'''
sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make cypress-ci'''
} finally {
try {
sh '''rm -rf cypress-videos cypress-results cypress-coverage cypress-screenshots'''
sh '''mkdir -p cypress-videos cypress-results cypress-coverage cypress-screenshots'''
sh '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos/'''
videos = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos/''', returnStatus: true
sh '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/reports cypress-results/'''
screenshots = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/screenshots cypress-screenshots''', returnStatus: true

Expand All @@ -181,12 +185,18 @@ pipeline {
reportName: 'CypressCoverage',
reportTitles: 'Integration Tests Code Coverage'])
}
sh '''for file in $(find cypress-results -name *.xml); do if [ $(grep -E 'failures="[1-9].*"' $file | wc -l) -eq 0 ]; then testname=$(grep -E 'file=.*failures="0"' $file | sed 's#.* file=".*\\/\\(.*\\.[jsxt]\\+\\)" time.*#\\1#' ); rm -f cypress-videos/videos/$testname.mp4; fi; done'''
archiveArtifacts artifacts: 'cypress-videos/**', fingerprint: true, allowEmptyArchive: true
if ( videos == 0 ) {
sh '''for file in $(find cypress-results -name *.xml); do if [ $(grep -E 'failures="[1-9].*"' $file | wc -l) -eq 0 ]; then testname=$(grep -E 'file=.*failures="0"' $file | sed 's#.* file=".*\\/\\(.*\\.[jsxt]\\+\\)" time.*#\\1#' ); rm -f cypress-videos/videos/$testname.mp4; fi; done'''
archiveArtifacts artifacts: 'cypress-videos/**/*.mp4', fingerprint: true, allowEmptyArchive: true
}
} finally {
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
}
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
sh '''docker logs $IMAGE_NAME-cypress'''
}
sh script: "docker stop $IMAGE_NAME-cypress", returnStatus: true
sh script: "docker stop $IMAGE_NAME-plone", returnStatus: true
sh script: "docker rm -v $IMAGE_NAME-plone", returnStatus: true
sh script: "docker rm -v $IMAGE_NAME-cypress", returnStatus: true
Expand Down Expand Up @@ -231,8 +241,6 @@ pipeline {
withSonarQubeEnv('Sonarqube') {
sh '''sed -i "s#/app/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
sh '''sed -i "s#src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
sh '''cat xunit-reports/coverage/lcov.info'''
sh '''cat cypress-coverage/coverage/lcov.info'''
sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
sh '''try=5; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 15; try=\$(( \$try - 1 )); fi; done'''
}
Expand Down
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ VOLTO_VERSION?=16
ADDON_PATH="${DIR}"
ADDON_NAME="@eeacms/${ADDON_PATH}"
DOCKER_COMPOSE=PLONE_VERSION=${PLONE_VERSION} VOLTO_VERSION=${VOLTO_VERSION} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH} docker compose
RAZZLE_INTERNAL_API_PATH?="${RAZZLE_DEV_PROXY_API_PATH}"
RAZZLE_INTERNAL_API_PATH?="http://localhost:8080/Plone"
RAZZLE_DEV_PROXY_API_PATH?="${RAZZLE_INTERNAL_API_PATH}"
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}"

Expand Down Expand Up @@ -86,7 +86,7 @@ cypress-open: ## Open cypress integration tests

.PHONY: cypress-run
cypress-run: ## Run cypress integration tests
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chromium

.PHONY: test
test: ## Run jest tests
Expand Down Expand Up @@ -151,14 +151,12 @@ test-ci:

.PHONY: start-ci
start-ci:
cp .coverage.babel.config.js /app/babel.config.js
cd ../..
yarn start &
yarn start

.PHONY: cypress-ci
cypress-ci:
cp .coverage.babel.config.js /app/babel.config.js
make start-ci
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
NODE_ENV=development make cypress-run


6 changes: 3 additions & 3 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ const { defineConfig } = require('cypress');

module.exports = defineConfig({
viewportWidth: 1280,
defaultCommandTimeout: 5000,
defaultCommandTimeout: 8888,
chromeWebSecurity: false,
reporter: 'junit',
video: true,
video: false,
retries: {
runMode: 1,
runMode: 2,
openMode: 0,
},
reporterOptions: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-columns-block",
"version": "6.4.0",
"version": "7.0.0",
"description": "volto-columns-block: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
1 change: 1 addition & 0 deletions src/ColumnsBlock/ColumnVariations.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ test('renders column variations component', () => {
intl: {
locale: 'en',
formatMessage: () => 'Select layout',
messages: {},
},
});

Expand Down
34 changes: 6 additions & 28 deletions src/ColumnsBlock/ColumnsBlockView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@ import cx from 'classnames';
import { getColumns } from './utils';
import { getStyle } from '@eeacms/volto-columns-block/Styles';

const getSide = (side, v) => {
const v_unit = v.unit ? v.unit : 'px';
return `${v?.[side] ? `${v[side]}${v_unit}` : '0'}`;
};

const getSides = (v) => {
return `${getSide('top', v)} ${getSide('right', v)} ${getSide(
'bottom',
v,
)} ${getSide('left', v)}`;
};

const ColumnsBlockView = (props) => {
const location = useLocation();
const { gridSizes } = config.blocks.blocksConfig[COLUMNSBLOCK];
Expand Down Expand Up @@ -52,22 +40,12 @@ const ColumnsBlockView = (props) => {
)}
{...getStyle(column.settings || {})}
>
<div
style={
column.settings?.padding
? {
padding: getSides(column.settings?.padding),
}
: {}
}
>
<RenderBlocks
{...props}
location={location}
metadata={metadata}
content={column}
/>
</div>
<RenderBlocks
{...props}
location={location}
metadata={metadata}
content={column}
/>
</Grid.Column>
);
})}
Expand Down
8 changes: 2 additions & 6 deletions src/ColumnsBlock/__snapshots__/ColumnsBlockView.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@ exports[`renders 2 columns 1`] = `
<div
class="six wide computer twelve wide mobile six wide tablet column column-blocks-wrapper"
>
<div>
left marker
</div>
left marker
</div>
<div
class="six wide computer twelve wide mobile six wide tablet column column-blocks-wrapper"
>
<div>
right
</div>
right
</div>
</div>
</div>
Expand Down
14 changes: 14 additions & 0 deletions src/Styles/utils.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
const getSide = (side, v) => {
const v_unit = v.unit ? v.unit : 'px';
return `${v?.[side] ? `${v[side]}${v_unit}` : '0'}`;
};

const getSides = (v) => {
if (!v) return null;
return `${getSide('top', v)} ${getSide('right', v)} ${getSide(
'bottom',
v,
)} ${getSide('left', v)}`;
};

export function getStyle(props) {
return {
verticalAlign: props.grid_vertical_align,
style: {
backgroundColor: props.backgroundColor,
padding: getSides(props.padding),
},
};
}

0 comments on commit 358af0b

Please sign in to comment.