Jenkinsfile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. try {
  15. sh """
  16. echo 'Check for duplicate shortcut keys in all translation files.'
  17. ${env.CURA_ENVIRONMENT_PATH}/master/bin/python3 scripts/check_shortcut_keys.py
  18. """
  19. } catch(e) {
  20. currentBuild.result = "UNSTABLE"
  21. }
  22. }
  23. }
  24. // Building and testing should happen in a subdirectory.
  25. dir('build') {
  26. // Perform the "build". Since Uranium is Python code, this basically only ensures CMake is setup.
  27. stage('Build') {
  28. def branch = env.BRANCH_NAME
  29. if(!fileExists("${env.CURA_ENVIRONMENT_PATH}/${branch}")) {
  30. branch = "master"
  31. }
  32. // Ensure CMake is setup. Note that since this is Python code we do not really "build" it.
  33. def uranium_dir = get_workspace_dir("Ultimaker/Uranium/${branch}")
  34. cmake("..", "-DCMAKE_PREFIX_PATH=\"${env.CURA_ENVIRONMENT_PATH}/${branch}\" -DCMAKE_BUILD_TYPE=Release -DURANIUM_DIR=\"${uranium_dir}\"")
  35. }
  36. // Try and run the unit tests. If this stage fails, we consider the build to be "unstable".
  37. stage('Unit Test') {
  38. try {
  39. make('test')
  40. } catch(e) {
  41. currentBuild.result = "UNSTABLE"
  42. }
  43. }
  44. }
  45. }
  46. // Perform any post-build actions like notification and publishing of unit tests.
  47. stage('Finalize') {
  48. // Publish the test results to Jenkins.
  49. junit allowEmptyResults: true, testResults: 'build/junit*.xml'
  50. notify_build_result(env.CURA_EMAIL_RECIPIENTS, '#cura-dev', ['master', '2.'])
  51. }
  52. }
  53. }