cmake - How to use Jenkin declarative pipeline to build and test on multiple platforms -


i'm trying feel should simple do, can't figure out how.

basically have jenkins master (running on linux) , 2 slaves, 1 on windows , other on macos.

i want build project on 3 platforms , run gtest tests on 3 platforms too.

i can build , run test, junit step doesn't seem collect test results.

i tried put post block everywhere, doesn't work. if try put post block in test stage or sibling of stages, following error:

required context class hudson.filepath missing perhaps forgot surround code step provides this, such as: node caused agent none - post block doesn't know run.

so tried put post block inside node block in parallel step test stage, doesn't seem - doesn't show in console output.

here's jenkinsfile:

pipeline {     agent none     stages {         stage ('clean') {             steps {                 parallel (                     "linux" : {                         node ("linux") {                             dir("build") {                                 deletedir()                                 writefile file:'dummy', text:'' // creates directory                             }                         }                     },                     "windows" : {                         node('windows') {                             dir("build") {                                 deletedir()                                 writefile file:'dummy', text:'' // creates directory                             }                         }                     },                     "mac" : {                         node('mac') {                             dir("build") {                                 deletedir()                                 writefile file:'dummy', text:''  // creates directory                             }                         }                     }                 )             }         }          stage ('build') {             steps {                 parallel (                     "linux" : {                         node ("linux") {                             checkout scm                             dir("build") {                                 sh '/opt/cmake/bin/cmake .. -dcmake_build_type=release'                                 sh 'make'                             }                         }                     },                     "windows" : {                         node('windows') {                             checkout(changelog: false, scm: scm) // changelog false, otherwise jenkins shows duplicates. linux (the jenkins master) has changelog enabled.                             dir("build") {                                 bat 'cmake .. -g "visual studio 15 2017 win64" -dcmake_prefix_path=c:/qt/5.9.1/msvc2017_64'                                 bat "\"${tool 'msbuild'}\" project.sln /p:configuration=release /p:platform=\"x64\" /p:productversion=1.0.0.${env.build_number} /m"                             }                         }                     },                     "mac" : {                         node('mac') {                             checkout(changelog: false, scm: scm) // changelog false, otherwise jenkins shows duplicates. linux (the jenkins master) has changelog enabled.                             dir("build") {                                 sh 'cmake .. -dcmake_prefix_path=/usr/local/cellar/qt/5.9.1 -dcmake_build_type=release'                                 sh 'make'                             }                         }                     }                 )             }         }          stage ('test') {             steps {                 parallel (                     "linux" : {                         node ("linux") {                             dir('build') {                                 sh './bin/project-tests --gtest_output=xml:project-tests-results.xml'                                 // add other test executables here.                             }                              post {                                 {                                     junit '*-tests-results.xml'                                 }                             }                         }                     },                     "windows" : {                         node('windows') {                             dir("build") {                                 bat 'tests\\project\\release\\project-tests --gtest_output=xml:project-tests-results.xml'                                 // add other test executables here.                             }                              post {                                 {                                     junit '*-tests-results.xml'                                 }                             }                         }                     },                     "mac" : {                         node('mac') {                             dir("build") {                                 sh './bin/project-tests --gtest_output=xml:project-tests-results.xml'                                 // add other test executables here.                             }                             post {                                 {                                     junit '*-tests-results.xml'                                 }                             }                         }                     }                 )             }         }     }  } 

what doing wrong?


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -