Jenkinsfile 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. parallel_nodes(['linux && cura', 'windows && cura'])
  2. {
  3. timeout(time: 2, unit: "HOURS")
  4. {
  5. // Prepare building
  6. stage('Prepare')
  7. {
  8. // Ensure we start with a clean build directory.
  9. step([$class: 'WsCleanup'])
  10. // Checkout whatever sources are linked to this pipeline.
  11. checkout scm
  12. }
  13. // If any error occurs during building, we want to catch it and continue with the "finale" stage.
  14. catchError
  15. {
  16. // Building and testing should happen in a subdirectory.
  17. dir('build')
  18. {
  19. // Perform the "build". Since Uranium is Python code, this basically only ensures CMake is setup.
  20. stage('Build')
  21. {
  22. def branch = env.BRANCH_NAME
  23. if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}"))
  24. {
  25. branch = "master"
  26. }
  27. // Ensure CMake is setup. Note that since this is Python code we do not really "build" it.
  28. def uranium_dir = get_workspace_dir("Ultimaker/Uranium/${branch}")
  29. cmake("..", "-DCMAKE_PREFIX_PATH=\"${env.CURA_ENVIRONMENT_PATH}/${branch}\" -DCMAKE_BUILD_TYPE=Release -DURANIUM_DIR=\"${uranium_dir}\"")
  30. }
  31. // Try and run the unit tests. If this stage fails, we consider the build to be "unstable".
  32. stage('Unit Test')
  33. {
  34. if (isUnix())
  35. {
  36. // For Linux
  37. try {
  38. sh 'make CTEST_OUTPUT_ON_FAILURE=TRUE test'
  39. } catch(e)
  40. {
  41. currentBuild.result = "UNSTABLE"
  42. }
  43. }
  44. else
  45. {
  46. // For Windows
  47. try
  48. {
  49. // This also does code style checks.
  50. bat 'ctest -V'
  51. } catch(e)
  52. {
  53. currentBuild.result = "UNSTABLE"
  54. }
  55. }
  56. }
  57. }
  58. }
  59. // Perform any post-build actions like notification and publishing of unit tests.
  60. stage('Finalize')
  61. {
  62. // Publish the test results to Jenkins.
  63. junit allowEmptyResults: true, testResults: 'build/junit*.xml'
  64. notify_build_result(env.CURA_EMAIL_RECIPIENTS, '#cura-dev', ['master', '2.'])
  65. }
  66. }
  67. }