Skip to content

Commit

Permalink
Merge pull request #32 from eea/develop
Browse files Browse the repository at this point in the history
Release 7.0.0 - Volto 17 support
  • Loading branch information
avoinea authored Apr 22, 2024
2 parents 6e16f07 + cd2bbea commit eda463b
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 185 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ 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-block-divider/compare/6.2.0...7.0.0) - 22 April 2024

#### :rocket: New Features

- feat: Release 7.0.0 - Volto 17 support [alin - [`3b3263c`](https://github.com/eea/volto-block-divider/commit/3b3263c7b4ed8d015670ee29f1179faaacda2c0c)]
- feat: Volto 17 support - refs #264527 [EEA Jenkins - [`fab65e2`](https://github.com/eea/volto-block-divider/commit/fab65e2de0a3358739d01aa855d1a491f9071d28)]

#### :house: Internal changes

- chore: Cleanup package.json [alin - [`6b4e3ef`](https://github.com/eea/volto-block-divider/commit/6b4e3ef931071d145b79ad1e614430e8a5e9e7f3)]

#### :hammer_and_wrench: Others

### [6.2.0](https://github.com/eea/volto-block-divider/compare/6.1.6...6.2.0) - 28 March 2024

#### :rocket: New Features
Expand Down
181 changes: 136 additions & 45 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ pipeline {
environment {
GIT_NAME = "volto-block-divider"
NAMESPACE = "@eeacms"
SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,prod-www.eea.europa.eu,water.europa.eu-marine,demo-kitkat.dev2aws.eea.europa.eu,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en,insitu-frontend.eionet.europa.eu"
SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,prod-www.eea.europa.eu,water.europa.eu-marine,demo-kitkat.dev2aws.eea.europa.eu,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en,insitu-frontend.eionet.europa.eu,insitu.copernicus.eu"
DEPENDENCIES = ""
BACKEND_PROFILES = "eea.kitkat:testing"
BACKEND_ADDONS = ""
VOLTO = "16"
VOLTO = "17"
VOLTO16_BREAKING_CHANGES = "no"
IMAGE_NAME = BUILD_TAG.toLowerCase()
}

Expand Down Expand Up @@ -44,6 +45,7 @@ pipeline {
}
steps {
script {
checkout scm
withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) {
check_result = sh script: '''docker run --pull always -i --rm --name="$IMAGE_NAME-gitflow-check" -e GIT_TOKEN="$GITHUB_TOKEN" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_ORG="$GIT_ORG" -e GIT_NAME="$GIT_NAME" eeacms/gitflow /check_if_testing_needed.sh''', returnStatus: true

Expand All @@ -61,33 +63,34 @@ pipeline {
allOf {
not { environment name: 'CHANGE_ID', value: '' }
environment name: 'CHANGE_TARGET', value: 'develop'
environment name: 'SKIP_TESTS', value: ''
}
allOf {
environment name: 'CHANGE_ID', value: ''
anyOf {
not { changelog '.*^Automated release [0-9\\.]+$' }
branch 'master'
}
environment name: 'SKIP_TESTS', value: ''
}
}
}
stages {
stage('Build test image') {
steps {
checkout scm
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'''
parallel {

stage('Volto 17') {
agent { node { label 'docker-1.13'} }
stages {
stage('Build test image') {
steps {
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'''
}
}
}

stage('Fix code') {
when {

stage('Fix code') {
when {
environment name: 'CHANGE_ID', value: ''
not { branch 'master' }
}
steps {
script {
}
steps {
script {
fix_result = sh(script: '''docker run --name="$IMAGE_NAME-fix" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend ci-fix''', returnStatus: true)
sh '''docker cp $IMAGE_NAME-fix:/app/src/addons/$GIT_NAME/src .'''
sh '''docker rm -v $IMAGE_NAME-fix'''
Expand All @@ -105,31 +108,31 @@ pipeline {
sh '''exit 1'''
}
}
}
}
}

stage('ES lint') {
steps {
sh '''docker run --rm --name="$IMAGE_NAME-eslint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend lint'''
stage('ES lint') {
when { environment name: 'SKIP_TESTS', value: '' }
steps {
sh '''docker run --rm --name="$IMAGE_NAME-eslint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend lint'''
}
}
}

stage('Style lint') {
steps {
sh '''docker run --rm --name="$IMAGE_NAME-stylelint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend stylelint'''
stage('Style lint') {
when { environment name: 'SKIP_TESTS', value: '' }
steps {
sh '''docker run --rm --name="$IMAGE_NAME-stylelint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend stylelint'''
}
}
}

stage('Prettier') {
steps {
sh '''docker run --rm --name="$IMAGE_NAME-prettier" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend prettier'''
stage('Prettier') {
when { environment name: 'SKIP_TESTS', value: '' }
steps {
sh '''docker run --rm --name="$IMAGE_NAME-prettier" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend prettier'''
}
}
}

stage('Coverage Tests') {
parallel {

stage('Unit tests') {
stage('Unit tests') {
when { environment name: 'SKIP_TESTS', value: '' }
steps {
script {
try {
Expand All @@ -155,9 +158,10 @@ pipeline {
}
}
}
}
}

stage('Integration tests') {
stage('Integration tests') {
when { environment name: 'SKIP_TESTS', value: '' }
steps {
script {
try {
Expand Down Expand Up @@ -211,26 +215,19 @@ pipeline {
}
}
}
}
}
}
}
post {
always {
sh script: "docker rmi $IMAGE_NAME-frontend", returnStatus: true
}
}
}

stage('Report to SonarQube') {
when {
anyOf {
allOf {
not { environment name: 'CHANGE_ID', value: '' }
environment name: 'CHANGE_TARGET', value: 'develop'
environment name: 'SKIP_TESTS', value: ''
}
allOf {
environment name: 'CHANGE_ID', value: ''
environment name: 'SKIP_TESTS', value: ''
anyOf {
allOf {
branch 'develop'
Expand All @@ -255,14 +252,107 @@ pipeline {
}
}


}
}

stage('Volto 16') {
agent { node { label 'integration'} }
when {
environment name: 'SKIP_TESTS', value: ''
not { environment name: 'VOLTO16_BREAKING_CHANGES', value: 'yes' }
}
stages {
stage('Build test image') {
steps {
sh '''docker build --pull --build-arg="VOLTO_VERSION=16" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend16'''
}
}

stage('Unit tests Volto 16') {
steps {
script {
try {
sh '''docker run --name="$IMAGE_NAME-volto16" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend16 test-ci'''
sh '''rm -rf xunit-reports16'''
sh '''mkdir -p xunit-reports16'''
sh '''docker cp $IMAGE_NAME-volto16:/app/junit.xml xunit-reports16/'''
} finally {
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
junit testResults: 'xunit-reports16/junit.xml', allowEmptyResults: true
}
sh script: '''docker rm -v $IMAGE_NAME-volto16''', returnStatus: true
}
}
}
}

stage('Integration tests Volto 16') {
steps {
script {
try {
sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone16" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
sh '''docker run -d --shm-size=4g --link $IMAGE_NAME-plone16:plone --name="$IMAGE_NAME-cypress16" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend16 start-ci'''
frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress16 make check-ci''', returnStatus: true
if ( frontend != 0 ) {
sh '''docker logs $IMAGE_NAME-cypress16; exit 1'''
}
sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress16 make cypress-ci'''
} finally {
try {
if ( frontend == 0 ) {
sh '''rm -rf cypress-videos16 cypress-results16 cypress-coverage16 cypress-screenshots16'''
sh '''mkdir -p cypress-videos16 cypress-results16 cypress-coverage16 cypress-screenshots16'''
videos = sh script: '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos16/''', returnStatus: true
sh '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/reports cypress-results16/'''
screenshots = sh script: '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/screenshots cypress-screenshots16''', returnStatus: true

archiveArtifacts artifacts: 'cypress-screenshots16/**', fingerprint: true, allowEmptyArchive: true

if ( videos == 0 ) {
sh '''for file in $(find cypress-results16 -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-videos16/videos/$testname.mp4; fi; done'''
archiveArtifacts artifacts: 'cypress-videos16/**/*.mp4', fingerprint: true, allowEmptyArchive: true
}
}
} finally {
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
junit testResults: 'cypress-results16/**/*.xml', allowEmptyResults: true
}
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
sh '''docker logs $IMAGE_NAME-cypress16'''
}
sh script: "docker stop $IMAGE_NAME-cypress16", returnStatus: true
sh script: "docker stop $IMAGE_NAME-plone16", returnStatus: true
sh script: "docker rm -v $IMAGE_NAME-plone16", returnStatus: true
sh script: "docker rm -v $IMAGE_NAME-cypress16", returnStatus: true
}
}
}
}
}

}
}
}
post {
always {
sh script: "docker rmi $IMAGE_NAME-frontend", returnStatus: true
sh script: "docker rmi $IMAGE_NAME-frontend16", returnStatus: true
}
}
}


stage('SonarQube compare to master') {
when {
anyOf {
allOf {
not { environment name: 'CHANGE_ID', value: '' }
environment name: 'CHANGE_TARGET', value: 'develop'
environment name: 'SKIP_TESTS', value: ''
}
allOf {
environment name: 'SKIP_TESTS', value: ''
environment name: 'CHANGE_ID', value: ''
branch 'develop'
not { changelog '.*^Automated release [0-9\\.]+$' }
Expand Down Expand Up @@ -323,3 +413,4 @@ pipeline {
}
}
}

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ endif
DIR=$(shell basename $$(pwd))
NODE_MODULES?="../../../node_modules"
PLONE_VERSION?=6
VOLTO_VERSION?=16
VOLTO_VERSION?=17
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
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/02-dexterity-controlpanel-layout.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('ControlPanel: Dexterity Content-Types Layout', () => {
cy.getSlateTitle().type('My First Book');
cy.get('.documentFirstHeading').contains('My First Book');
cy.get('.dividerBlock .divider').click();
cy.get('.field-wrapper-text #field-text').click().type('Book Divider')
cy.get('.field-wrapper-text #field-text').click().type('Book Divider');

cy.get('#toolbar-save').click();
cy.get('.documentFirstHeading').contains('My First Book');
Expand Down
3 changes: 3 additions & 0 deletions jest-addon.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ module.exports = {
'@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
'@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
'@eeacms/search/(.*)$': '<rootDir>/src/addons/volto-searchlib/searchlib/$1',
'@eeacms/search': '<rootDir>/src/addons/volto-searchlib/searchlib',
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
'@plone/volto-slate$':
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
Expand All @@ -28,6 +30,7 @@ module.exports = {
],
transform: {
'^.+\\.js(x)?$': 'babel-jest',
'^.+\\.ts(x)?$': 'babel-jest',
'^.+\\.(png)$': 'jest-file',
'^.+\\.(jpg)$': 'jest-file',
'^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-block-divider",
"version": "6.2.0",
"version": "7.0.0",
"description": "volto-block-divider: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand All @@ -23,13 +23,13 @@
"devDependencies": {
"@cypress/code-coverage": "^3.10.0",
"@plone/scripts": "*",
"postcss-less": "6.0.0",
"razzle-plugin-scss": "4.2.18",
"babel-plugin-transform-class-properties": "^6.24.1",
"dotenv": "^16.3.2",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"md5": "^2.3.0"
"md5": "^2.3.0",
"postcss-less": "6.0.0",
"razzle-plugin-scss": "4.2.18"
},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx,json}": [
Expand Down
Loading

0 comments on commit eda463b

Please sign in to comment.