Jenkinsfile 2.9 KB

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