From a161c31535cf33621c7513ddc5d8954ff9532c4a Mon Sep 17 00:00:00 2001 From: Alin Voinea Date: Mon, 15 Nov 2021 18:57:15 +0200 Subject: [PATCH] Revert "Disable cypress" This reverts commit a406e2dc4be788f924642d43d82c677577a6877a. --- Jenkinsfile | 106 ++++++++++++++++++++++++++-------------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index dfa94543..9d2bcd1f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -76,58 +76,58 @@ pipeline { } } - // stage('Integration tests') { - // // Exclude Pull-Requests. Already running on branch - // when { - // allOf { - // environment name: 'CHANGE_ID', value: '' - // } - // } - // steps { - // parallel( - - // "Cypress": { - // node(label: 'docker') { - // script { - // try { - // sh '''docker pull plone; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e ADDONS="$PLONE_ADDONS" -e VERSIONS="$PLONE_VERSIONS" -e PROFILES="profile-plone.restapi:blocks" plone fg''' - // sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" plone/volto-addon-ci cypress''' - // } finally { - // try { - // sh '''rm -rf cypress-reports cypress-results cypress-coverage''' - // sh '''mkdir -p cypress-reports cypress-results cypress-coverage''' - // sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/videos cypress-reports/''' - // sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/reports cypress-results/''' - // coverage = sh script: '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/coverage cypress-coverage/''', returnStatus: true - // if ( coverage == 0 ) { - // publishHTML (target : [allowMissing: false, - // alwaysLinkToLastBuild: true, - // keepAll: true, - // reportDir: 'cypress-coverage/coverage/lcov-report', - // reportFiles: 'index.html', - // reportName: 'CypressCoverage', - // reportTitles: 'Integration Tests Code Coverage']) - // } - // archiveArtifacts artifacts: 'cypress-reports/videos/*.mp4', fingerprint: true - // stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true - // } - // finally { - // catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') { - // junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true - // } - // sh script: "docker stop $BUILD_TAG-plone", returnStatus: true - // sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true - // sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true - - // } - // } - // } - // } - // } - - // ) - // } - // } + stage('Integration tests') { + // Exclude Pull-Requests. Already running on branch + when { + allOf { + environment name: 'CHANGE_ID', value: '' + } + } + steps { + parallel( + + "Cypress": { + node(label: 'docker') { + script { + try { + sh '''docker pull plone; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e ADDONS="$PLONE_ADDONS" -e VERSIONS="$PLONE_VERSIONS" -e PROFILES="profile-plone.restapi:blocks" plone fg''' + sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" plone/volto-addon-ci cypress''' + } finally { + try { + sh '''rm -rf cypress-reports cypress-results cypress-coverage''' + sh '''mkdir -p cypress-reports cypress-results cypress-coverage''' + sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/videos cypress-reports/''' + sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/reports cypress-results/''' + coverage = sh script: '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/coverage cypress-coverage/''', returnStatus: true + if ( coverage == 0 ) { + publishHTML (target : [allowMissing: false, + alwaysLinkToLastBuild: true, + keepAll: true, + reportDir: 'cypress-coverage/coverage/lcov-report', + reportFiles: 'index.html', + reportName: 'CypressCoverage', + reportTitles: 'Integration Tests Code Coverage']) + } + archiveArtifacts artifacts: 'cypress-reports/videos/*.mp4', fingerprint: true + stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true + } + finally { + catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') { + junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true + } + sh script: "docker stop $BUILD_TAG-plone", returnStatus: true + sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true + sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true + + } + } + } + } + } + + ) + } + } stage('Report to SonarQube') { // Exclude Pull-Requests @@ -141,7 +141,7 @@ pipeline { script{ checkout scm unstash "xunit-reports" - // unstash "cypress-coverage" + unstash "cypress-coverage" def scannerHome = tool 'SonarQubeScanner'; def nodeJS = tool 'NodeJS11'; withSonarQubeEnv('Sonarqube') {