Skip to content

Commit 92a8153

Browse files
authored
Merge pull request #99 from eea/develop
Release 7.0.0 - Volto 17 support
2 parents 5f43419 + 44ebe56 commit 92a8153

16 files changed

+313
-111
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file. Dates are d
44

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

7+
### [7.0.0](https://github.com/eea/volto-block-style/compare/6.1.0...7.0.0) - 22 April 2024
8+
9+
#### :rocket: New Features
10+
11+
- feat: Release 7.0.0 - Volto 17 support [alin - [`b73e6cf`](https://github.com/eea/volto-block-style/commit/b73e6cf73f17c0842141cfedbc6b105abb9b6782)]
12+
- feat: Volto 17 support - refs #264527 [EEA Jenkins - [`00c4627`](https://github.com/eea/volto-block-style/commit/00c4627f4ea194adbf8c6c9954f226fa64c9fa8a)]
13+
14+
#### :bug: Bug Fixes
15+
16+
- fix: Don't hard fail when block is missing [alin - [`4b38c0e`](https://github.com/eea/volto-block-style/commit/4b38c0e3023a2515356921eb484e4460d4d87c61)]
17+
18+
#### :hammer_and_wrench: Others
19+
720
### [6.1.0](https://github.com/eea/volto-block-style/compare/6.0.0...6.1.0) - 1 February 2024
821

922
#### :bug: Bug Fixes

Jenkinsfile

Lines changed: 136 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ pipeline {
99
environment {
1010
GIT_NAME = "volto-block-style"
1111
NAMESPACE = "@eeacms"
12-
SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,sustainability.eionet.europa.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en"
12+
SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,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"
1313
DEPENDENCIES = ""
1414
BACKEND_PROFILES = "eea.kitkat:testing"
1515
BACKEND_ADDONS = ""
16-
VOLTO = "16"
16+
VOLTO = "17"
17+
VOLTO16_BREAKING_CHANGES = "no"
1718
IMAGE_NAME = BUILD_TAG.toLowerCase()
1819
}
1920

@@ -44,6 +45,7 @@ pipeline {
4445
}
4546
steps {
4647
script {
48+
checkout scm
4749
withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) {
4850
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
4951

@@ -61,33 +63,34 @@ pipeline {
6163
allOf {
6264
not { environment name: 'CHANGE_ID', value: '' }
6365
environment name: 'CHANGE_TARGET', value: 'develop'
64-
environment name: 'SKIP_TESTS', value: ''
6566
}
6667
allOf {
6768
environment name: 'CHANGE_ID', value: ''
6869
anyOf {
6970
not { changelog '.*^Automated release [0-9\\.]+$' }
7071
branch 'master'
7172
}
72-
environment name: 'SKIP_TESTS', value: ''
7373
}
7474
}
7575
}
76-
stages {
77-
stage('Build test image') {
78-
steps {
79-
checkout scm
80-
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'''
76+
parallel {
77+
78+
stage('Volto 17') {
79+
agent { node { label 'docker-1.13'} }
80+
stages {
81+
stage('Build test image') {
82+
steps {
83+
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'''
84+
}
8185
}
82-
}
83-
84-
stage('Fix code') {
85-
when {
86+
87+
stage('Fix code') {
88+
when {
8689
environment name: 'CHANGE_ID', value: ''
8790
not { branch 'master' }
88-
}
89-
steps {
90-
script {
91+
}
92+
steps {
93+
script {
9194
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)
9295
sh '''docker cp $IMAGE_NAME-fix:/app/src/addons/$GIT_NAME/src .'''
9396
sh '''docker rm -v $IMAGE_NAME-fix'''
@@ -105,31 +108,31 @@ pipeline {
105108
sh '''exit 1'''
106109
}
107110
}
111+
}
108112
}
109-
}
110113

111-
stage('ES lint') {
112-
steps {
113-
sh '''docker run --rm --name="$IMAGE_NAME-eslint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend lint'''
114+
stage('ES lint') {
115+
when { environment name: 'SKIP_TESTS', value: '' }
116+
steps {
117+
sh '''docker run --rm --name="$IMAGE_NAME-eslint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend lint'''
118+
}
114119
}
115-
}
116120

117-
stage('Style lint') {
118-
steps {
119-
sh '''docker run --rm --name="$IMAGE_NAME-stylelint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend stylelint'''
121+
stage('Style lint') {
122+
when { environment name: 'SKIP_TESTS', value: '' }
123+
steps {
124+
sh '''docker run --rm --name="$IMAGE_NAME-stylelint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend stylelint'''
125+
}
120126
}
121-
}
122127

123-
stage('Prettier') {
124-
steps {
125-
sh '''docker run --rm --name="$IMAGE_NAME-prettier" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend prettier'''
128+
stage('Prettier') {
129+
when { environment name: 'SKIP_TESTS', value: '' }
130+
steps {
131+
sh '''docker run --rm --name="$IMAGE_NAME-prettier" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend prettier'''
132+
}
126133
}
127-
}
128-
129-
stage('Coverage Tests') {
130-
parallel {
131-
132-
stage('Unit tests') {
134+
stage('Unit tests') {
135+
when { environment name: 'SKIP_TESTS', value: '' }
133136
steps {
134137
script {
135138
try {
@@ -155,9 +158,10 @@ pipeline {
155158
}
156159
}
157160
}
158-
}
161+
}
159162

160-
stage('Integration tests') {
163+
stage('Integration tests') {
164+
when { environment name: 'SKIP_TESTS', value: '' }
161165
steps {
162166
script {
163167
try {
@@ -211,26 +215,19 @@ pipeline {
211215
}
212216
}
213217
}
214-
}
215218
}
216-
}
217-
}
218-
post {
219-
always {
220-
sh script: "docker rmi $IMAGE_NAME-frontend", returnStatus: true
221-
}
222-
}
223-
}
224219

225220
stage('Report to SonarQube') {
226221
when {
227222
anyOf {
228223
allOf {
229224
not { environment name: 'CHANGE_ID', value: '' }
230225
environment name: 'CHANGE_TARGET', value: 'develop'
226+
environment name: 'SKIP_TESTS', value: ''
231227
}
232228
allOf {
233229
environment name: 'CHANGE_ID', value: ''
230+
environment name: 'SKIP_TESTS', value: ''
234231
anyOf {
235232
allOf {
236233
branch 'develop'
@@ -255,14 +252,107 @@ pipeline {
255252
}
256253
}
257254

255+
256+
}
257+
}
258+
259+
stage('Volto 16') {
260+
agent { node { label 'integration'} }
261+
when {
262+
environment name: 'SKIP_TESTS', value: ''
263+
not { environment name: 'VOLTO16_BREAKING_CHANGES', value: 'yes' }
264+
}
265+
stages {
266+
stage('Build test image') {
267+
steps {
268+
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'''
269+
}
270+
}
271+
272+
stage('Unit tests Volto 16') {
273+
steps {
274+
script {
275+
try {
276+
sh '''docker run --name="$IMAGE_NAME-volto16" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend16 test-ci'''
277+
sh '''rm -rf xunit-reports16'''
278+
sh '''mkdir -p xunit-reports16'''
279+
sh '''docker cp $IMAGE_NAME-volto16:/app/junit.xml xunit-reports16/'''
280+
} finally {
281+
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
282+
junit testResults: 'xunit-reports16/junit.xml', allowEmptyResults: true
283+
}
284+
sh script: '''docker rm -v $IMAGE_NAME-volto16''', returnStatus: true
285+
}
286+
}
287+
}
288+
}
289+
290+
stage('Integration tests Volto 16') {
291+
steps {
292+
script {
293+
try {
294+
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'''
295+
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'''
296+
frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress16 make check-ci''', returnStatus: true
297+
if ( frontend != 0 ) {
298+
sh '''docker logs $IMAGE_NAME-cypress16; exit 1'''
299+
}
300+
sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress16 make cypress-ci'''
301+
} finally {
302+
try {
303+
if ( frontend == 0 ) {
304+
sh '''rm -rf cypress-videos16 cypress-results16 cypress-coverage16 cypress-screenshots16'''
305+
sh '''mkdir -p cypress-videos16 cypress-results16 cypress-coverage16 cypress-screenshots16'''
306+
videos = sh script: '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos16/''', returnStatus: true
307+
sh '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/reports cypress-results16/'''
308+
screenshots = sh script: '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/screenshots cypress-screenshots16''', returnStatus: true
309+
310+
archiveArtifacts artifacts: 'cypress-screenshots16/**', fingerprint: true, allowEmptyArchive: true
311+
312+
if ( videos == 0 ) {
313+
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'''
314+
archiveArtifacts artifacts: 'cypress-videos16/**/*.mp4', fingerprint: true, allowEmptyArchive: true
315+
}
316+
}
317+
} finally {
318+
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
319+
junit testResults: 'cypress-results16/**/*.xml', allowEmptyResults: true
320+
}
321+
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
322+
sh '''docker logs $IMAGE_NAME-cypress16'''
323+
}
324+
sh script: "docker stop $IMAGE_NAME-cypress16", returnStatus: true
325+
sh script: "docker stop $IMAGE_NAME-plone16", returnStatus: true
326+
sh script: "docker rm -v $IMAGE_NAME-plone16", returnStatus: true
327+
sh script: "docker rm -v $IMAGE_NAME-cypress16", returnStatus: true
328+
}
329+
}
330+
}
331+
}
332+
}
333+
334+
}
335+
}
336+
}
337+
post {
338+
always {
339+
sh script: "docker rmi $IMAGE_NAME-frontend", returnStatus: true
340+
sh script: "docker rmi $IMAGE_NAME-frontend16", returnStatus: true
341+
}
342+
}
343+
}
344+
345+
258346
stage('SonarQube compare to master') {
259347
when {
260348
anyOf {
261349
allOf {
262350
not { environment name: 'CHANGE_ID', value: '' }
263351
environment name: 'CHANGE_TARGET', value: 'develop'
352+
environment name: 'SKIP_TESTS', value: ''
264353
}
265354
allOf {
355+
environment name: 'SKIP_TESTS', value: ''
266356
environment name: 'CHANGE_ID', value: ''
267357
branch 'develop'
268358
not { changelog '.*^Automated release [0-9\\.]+$' }
@@ -323,3 +413,4 @@ pipeline {
323413
}
324414
}
325415
}
416+

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ endif
4646
DIR=$(shell basename $$(pwd))
4747
NODE_MODULES?="../../../node_modules"
4848
PLONE_VERSION?=6
49-
VOLTO_VERSION?=16
49+
VOLTO_VERSION?=17
5050
ADDON_PATH="${DIR}"
5151
ADDON_NAME="@eeacms/${ADDON_PATH}"
5252
DOCKER_COMPOSE=PLONE_VERSION=${PLONE_VERSION} VOLTO_VERSION=${VOLTO_VERSION} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH} docker compose
@@ -98,15 +98,15 @@ test-update: ## Update jest tests snapshots
9898

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

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

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

112112
.PHONY: prettier
@@ -119,11 +119,11 @@ prettier-fix: ## Fix prettier
119119

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

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

128128
.PHONY: i18n
129129
i18n: ## i18n

cypress.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
const { defineConfig } = require('cypress');
2+
const fs = require('fs');
3+
const path = require('path');
24

35
module.exports = defineConfig({
46
viewportWidth: 1280,
@@ -19,6 +21,21 @@ module.exports = defineConfig({
1921
setupNodeEvents(on, config) {
2022
// e2e testing node events setup code
2123
require('@cypress/code-coverage/task')(on, config);
24+
25+
on('task', {
26+
getVoltoVersion() {
27+
const baseProjectRoot = path.resolve(__dirname, '../../../');
28+
const packageJsonPath = path.join(
29+
baseProjectRoot,
30+
'node_modules/@plone/volto/package.json',
31+
);
32+
33+
const contents = fs.readFileSync(packageJsonPath, 'utf-8');
34+
const file = JSON.parse(contents);
35+
return file.version;
36+
},
37+
});
38+
2239
return config;
2340
},
2441
baseUrl: 'http://localhost:3000',

0 commit comments

Comments
 (0)