Code style: Brackets on new line

This commit is contained in:
Ghostkeeper 2018-10-18 17:27:15 +02:00
parent 4e54f13145
commit 7b140277d6
No known key found for this signature in database
GPG Key ID: 86BEF881AE2CF276

64
Jenkinsfile vendored
View File

@ -1,8 +1,11 @@
parallel_nodes(['linux && cura', 'windows && cura']) { parallel_nodes(['linux && cura', 'windows && cura'])
timeout(time: 2, unit: "HOURS") { {
timeout(time: 2, unit: "HOURS")
{
// Prepare building // Prepare building
stage('Prepare') { stage('Prepare')
{
// Ensure we start with a clean build directory. // Ensure we start with a clean build directory.
step([$class: 'WsCleanup']) 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. // 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. // 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. // Perform the "build". Since Uranium is Python code, this basically only ensures CMake is setup.
stage('Build') { stage('Build')
{
def branch = env.BRANCH_NAME def branch = env.BRANCH_NAME
if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}")) { if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}"))
{
branch = "master" 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". // Try and run the unit tests. If this stage fails, we consider the build to be "unstable".
stage('Unit Test') { stage('Unit Test')
if (isUnix()) { {
if (isUnix())
{
// For Linux to show everything // For Linux to show everything
def branch = env.BRANCH_NAME def branch = env.BRANCH_NAME
if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}")) { if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}"))
{
branch = "master" branch = "master"
} }
def uranium_dir = get_workspace_dir("Ultimaker/Uranium/${branch}") def uranium_dir = get_workspace_dir("Ultimaker/Uranium/${branch}")
@ -42,37 +52,48 @@ parallel_nodes(['linux && cura', 'windows && cura']) {
export PYTHONPATH=.:"${uranium_dir}" export PYTHONPATH=.:"${uranium_dir}"
${env.CURA_ENVIRONMENT_PATH}/${branch}/bin/pytest -x --verbose --full-trace --capture=no ./tests ${env.CURA_ENVIRONMENT_PATH}/${branch}/bin/pytest -x --verbose --full-trace --capture=no ./tests
""" """
} catch(e) { } catch(e)
{
currentBuild.result = "UNSTABLE" currentBuild.result = "UNSTABLE"
} }
} }
else { else
{
// For Windows // For Windows
try { try
{
// This also does code style checks. // This also does code style checks.
bat 'ctest -V' bat 'ctest -V'
} catch(e) { } catch(e)
{
currentBuild.result = "UNSTABLE" currentBuild.result = "UNSTABLE"
} }
} }
} }
stage('Code Style') { stage('Code Style')
if (isUnix()) { {
// For Linux to show everything 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 def branch = env.BRANCH_NAME
if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}")) { if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}"))
{
branch = "master" branch = "master"
} }
def uranium_dir = get_workspace_dir("Ultimaker/Uranium/${branch}") def uranium_dir = get_workspace_dir("Ultimaker/Uranium/${branch}")
try { try
{
sh """ sh """
cd .. cd ..
export PYTHONPATH=.:"${uranium_dir}" export PYTHONPATH=.:"${uranium_dir}"
${env.CURA_ENVIRONMENT_PATH}/${branch}/bin/python3 run_mypy.py ${env.CURA_ENVIRONMENT_PATH}/${branch}/bin/python3 run_mypy.py
""" """
} catch(e) { }
catch(e)
{
currentBuild.result = "UNSTABLE" 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. // Perform any post-build actions like notification and publishing of unit tests.
stage('Finalize') { stage('Finalize')
{
// Publish the test results to Jenkins. // Publish the test results to Jenkins.
junit allowEmptyResults: true, testResults: 'build/junit*.xml' junit allowEmptyResults: true, testResults: 'build/junit*.xml'