Skip to content

Commit

Permalink
Merge pull request #120 from eea/develop
Browse files Browse the repository at this point in the history
Release 8.0.0 - Volto 17 support
  • Loading branch information
avoinea authored Apr 22, 2024
2 parents 64ffe5a + f76373a commit 8ad0227
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 417 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +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.2.0](https://github.com/eea/volto-block-data-figure/compare/7.1.0...7.2.0) - 25 March 2024
### [8.0.0](https://github.com/eea/volto-block-data-figure/compare/7.2.0...8.0.0) - 22 April 2024

#### :rocket: New Features

- feat: Release 8.0.0 - Volto 17 support [alin - [`e3bab75`](https://github.com/eea/volto-block-data-figure/commit/e3bab7512c6a20c10e22dd74112096b770b0700d)]
- feat: Volto 17 support - refs #264527 [EEA Jenkins - [`cf966f4`](https://github.com/eea/volto-block-data-figure/commit/cf966f46b2b860af1c352ced2fcf61c8b59f3fe8)]

### [7.2.0](https://github.com/eea/volto-block-data-figure/compare/7.1.0...7.2.0) - 26 March 2024

#### :nail_care: Enhancements

Expand Down
179 changes: 135 additions & 44 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ pipeline {
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 {
}
}
}

10 changes: 5 additions & 5 deletions 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 Expand Up @@ -98,15 +98,15 @@ test-update: ## Update jest tests snapshots

.PHONY: stylelint
stylelint: ## Stylelint
$(NODE_MODULES)/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'
$(NODE_MODULES)/.bin/stylelint --allow-empty-input 'src/**/*.{css,less}'

.PHONY: stylelint-overrides
stylelint-overrides:
$(NODE_MODULES)/.bin/stylelint --custom-syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'

.PHONY: stylelint-fix
stylelint-fix: ## Fix stylelint
$(NODE_MODULES)/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}' --fix
$(NODE_MODULES)/.bin/stylelint --allow-empty-input 'src/**/*.{css,less}' --fix
$(NODE_MODULES)/.bin/stylelint --custom-syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides' --fix

.PHONY: prettier
Expand All @@ -119,11 +119,11 @@ prettier-fix: ## Fix prettier

.PHONY: lint
lint: ## ES Lint
$(NODE_MODULES)/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}'
$(NODE_MODULES)/.bin/eslint --max-warnings=0 'src/**/*.{js,jsx}'

.PHONY: lint-fix
lint-fix: ## Fix ES Lint
$(NODE_MODULES)/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'
$(NODE_MODULES)/.bin/eslint --fix 'src/**/*.{js,jsx}'

.PHONY: i18n
i18n: ## i18n
Expand Down
4 changes: 0 additions & 4 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ export const slateBeforeEach = (contentType = 'Document') => {
path: 'cypress',
});
cy.visit('/cypress/my-page');
cy.waitForResourceToLoad('@navigation');
cy.waitForResourceToLoad('@breadcrumbs');
cy.waitForResourceToLoad('@actions');
cy.waitForResourceToLoad('@types');
cy.waitForResourceToLoad('my-page');
cy.navigate('/cypress/my-page/edit');
};
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
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-block-data-figure",
"version": "7.2.0",
"version": "8.0.0",
"description": "volto-block-data-figure: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
3 changes: 1 addition & 2 deletions src/components/manage/Blocks/DataFigure/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ const messages = defineMessages({
defaultMessage: 'Minimum image resolution should be {resolution}.',
},
imageNameError: {
id:
'Invalid image. Image name can NOT start with image_. Please rename it first.',
id: 'Invalid image. Image name can NOT start with image_. Please rename it first.',
defaultMessage:
'Invalid image. Image name can NOT start with image_. Please rename it first.',
},
Expand Down
Loading

0 comments on commit 8ad0227

Please sign in to comment.