Skip to content

Commit

Permalink
comment Cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ionlizarazu committed May 9, 2024
1 parent 87bdcb3 commit 4d6bb58
Showing 1 changed file with 59 additions and 59 deletions.
118 changes: 59 additions & 59 deletions Jenkinsfile
Expand Up @@ -122,68 +122,68 @@ pipeline {
}
}

stage('Integration tests') {
when {
anyOf {
allOf {
not { environment name: 'CHANGE_ID', value: '' }
environment name: 'CHANGE_TARGET', value: 'develop'
}
allOf {
environment name: 'CHANGE_ID', value: ''
anyOf {
not { changelog '.*^Automated release [0-9\\.]+$' }
branch 'master'
}
}
}
}
steps {
parallel(
// stage('Integration tests') {
// when {
// anyOf {
// allOf {
// not { environment name: 'CHANGE_ID', value: '' }
// environment name: 'CHANGE_TARGET', value: 'develop'
// }
// allOf {
// environment name: 'CHANGE_ID', value: ''
// anyOf {
// not { changelog '.*^Automated release [0-9\\.]+$' }
// branch 'master'
// }
// }
// }
// }
// steps {
// parallel(

"Cypress": {
node(label: 'docker') {
script {
try {
sh '''docker pull plone; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
sh '''docker pull plone/volto-addon-ci:15.x; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e VOLTO=$VOLTO -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=test plone/volto-addon-ci:15.x 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'])
}
sh '''touch empty_file; for ok_test in $(grep -E 'file=.*failures="0"' $(grep 'testsuites .*failures="0"' $(find cypress-results -name *.xml) empty_file | awk -F: '{print $1}') empty_file | sed 's/.* file="\\(.*\\)" time.*/\\1/' | sed 's#^cypress/integration/##g' | sed 's#^../../../node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done'''
archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: 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
// "Cypress": {
// node(label: 'docker') {
// script {
// try {
// sh '''docker pull plone; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
// sh '''docker pull plone/volto-addon-ci:15.x; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e VOLTO=$VOLTO -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=test plone/volto-addon-ci:15.x 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'])
// }
// sh '''touch empty_file; for ok_test in $(grep -E 'file=.*failures="0"' $(grep 'testsuites .*failures="0"' $(find cypress-results -name *.xml) empty_file | awk -F: '{print $1}') empty_file | sed 's/.* file="\\(.*\\)" time.*/\\1/' | sed 's#^cypress/integration/##g' | sed 's#^../../../node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done'''
// archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: 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') {
when {
Expand Down

0 comments on commit 4d6bb58

Please sign in to comment.