From 7b140277d6942d1c131bb50c2decb59961ed7b34 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 18 Oct 2018 17:27:15 +0200 Subject: [PATCH] Code style: Brackets on new line --- Jenkinsfile | 64 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3ca803d338..f9a3a9864a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,8 +1,11 @@ -parallel_nodes(['linux && cura', 'windows && cura']) { - timeout(time: 2, unit: "HOURS") { +parallel_nodes(['linux && cura', 'windows && cura']) +{ + timeout(time: 2, unit: "HOURS") + { // Prepare building - stage('Prepare') { + stage('Prepare') + { // Ensure we start with a clean build directory. step([$class: 'WsCleanup']) @@ -11,13 +14,17 @@ parallel_nodes(['linux && cura', 'windows && cura']) { } // If any error occurs during building, we want to catch it and continue with the "finale" stage. - catchError { + catchError + { // Building and testing should happen in a subdirectory. - dir('build') { + dir('build') + { // Perform the "build". Since Uranium is Python code, this basically only ensures CMake is setup. - stage('Build') { + stage('Build') + { def branch = env.BRANCH_NAME - if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}")) { + if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}")) + { branch = "master" } @@ -27,11 +34,14 @@ parallel_nodes(['linux && cura', 'windows && cura']) { } // Try and run the unit tests. If this stage fails, we consider the build to be "unstable". - stage('Unit Test') { - if (isUnix()) { + stage('Unit Test') + { + if (isUnix()) + { // For Linux to show everything def branch = env.BRANCH_NAME - if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}")) { + if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}")) + { branch = "master" } def uranium_dir = get_workspace_dir("Ultimaker/Uranium/${branch}") @@ -42,37 +52,48 @@ parallel_nodes(['linux && cura', 'windows && cura']) { export PYTHONPATH=.:"${uranium_dir}" ${env.CURA_ENVIRONMENT_PATH}/${branch}/bin/pytest -x --verbose --full-trace --capture=no ./tests """ - } catch(e) { + } catch(e) + { currentBuild.result = "UNSTABLE" } } - else { + else + { // For Windows - try { + try + { // This also does code style checks. bat 'ctest -V' - } catch(e) { + } catch(e) + { currentBuild.result = "UNSTABLE" } } } - stage('Code Style') { - if (isUnix()) { - // For Linux to show everything + stage('Code Style') + { + if (isUnix()) + { + // For Linux to show everything. + // CMake also runs this test, but if it fails then the test just shows "failed" without details of what exactly failed. def branch = env.BRANCH_NAME - if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}")) { + if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}")) + { branch = "master" } def uranium_dir = get_workspace_dir("Ultimaker/Uranium/${branch}") - try { + try + { sh """ cd .. export PYTHONPATH=.:"${uranium_dir}" ${env.CURA_ENVIRONMENT_PATH}/${branch}/bin/python3 run_mypy.py """ - } catch(e) { + } + catch(e) + { currentBuild.result = "UNSTABLE" } } @@ -81,7 +102,8 @@ parallel_nodes(['linux && cura', 'windows && cura']) { } // Perform any post-build actions like notification and publishing of unit tests. - stage('Finalize') { + stage('Finalize') + { // Publish the test results to Jenkins. junit allowEmptyResults: true, testResults: 'build/junit*.xml'