2019-02-05 16:42:34 -04:00
|
|
|
#!/usr/bin/env groovy
|
|
|
|
|
|
|
|
pipeline {
|
|
|
|
agent none
|
|
|
|
|
|
|
|
stages {
|
|
|
|
|
|
|
|
stage('ROS Tests') {
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
def missions = [
|
2019-02-18 11:49:43 -04:00
|
|
|
[
|
|
|
|
name: "FW",
|
|
|
|
test: "mavros_posix_test_mission.test",
|
|
|
|
mission: "FW_mission_1",
|
|
|
|
vehicle: "plane"
|
|
|
|
],
|
2019-02-05 16:42:34 -04:00
|
|
|
|
|
|
|
[
|
|
|
|
name: "MC_box",
|
|
|
|
test: "mavros_posix_test_mission.test",
|
|
|
|
mission: "MC_mission_box",
|
|
|
|
vehicle: "iris"
|
|
|
|
],
|
|
|
|
[
|
|
|
|
name: "MC_offboard_att",
|
|
|
|
test: "mavros_posix_tests_offboard_attctl.test",
|
|
|
|
mission: "",
|
|
|
|
vehicle: "iris"
|
|
|
|
],
|
|
|
|
[
|
|
|
|
name: "MC_offboard_pos",
|
|
|
|
test: "mavros_posix_tests_offboard_posctl.test",
|
|
|
|
mission: "",
|
|
|
|
vehicle: "iris"
|
|
|
|
],
|
|
|
|
|
|
|
|
[
|
|
|
|
name: "VTOL_standard",
|
|
|
|
test: "mavros_posix_test_mission.test",
|
|
|
|
mission: "VTOL_mission_1",
|
|
|
|
vehicle: "standard_vtol"
|
|
|
|
],
|
|
|
|
[
|
|
|
|
name: "VTOL_tailsitter",
|
|
|
|
test: "mavros_posix_test_mission.test",
|
|
|
|
mission: "VTOL_mission_1",
|
|
|
|
vehicle: "tailsitter"
|
|
|
|
],
|
|
|
|
[
|
|
|
|
name: "VTOL_tiltrotor",
|
|
|
|
test: "mavros_posix_test_mission.test",
|
|
|
|
mission: "VTOL_mission_1",
|
|
|
|
vehicle: "tiltrotor"
|
|
|
|
],
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
def test_nodes = [:]
|
|
|
|
for (def i = 0; i < missions.size(); i++) {
|
|
|
|
test_nodes.put(missions[i].name, createTestNode(missions[i]))
|
|
|
|
}
|
|
|
|
|
|
|
|
parallel test_nodes
|
|
|
|
} // script
|
|
|
|
} // steps
|
|
|
|
} // stage ROS Tests
|
|
|
|
|
|
|
|
stage('Coverage') {
|
|
|
|
parallel {
|
|
|
|
|
|
|
|
stage('code coverage (python)') {
|
|
|
|
agent {
|
|
|
|
docker {
|
2019-03-09 13:41:31 -04:00
|
|
|
image 'px4io/px4-dev-base-bionic:2019-03-08'
|
2019-02-07 17:11:25 -04:00
|
|
|
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
|
2019-02-05 16:42:34 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh 'export'
|
|
|
|
sh 'make distclean'
|
|
|
|
sh 'make python_coverage'
|
|
|
|
withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) {
|
|
|
|
sh 'curl -s https://codecov.io/bash | bash -s - -F python'
|
|
|
|
}
|
|
|
|
|
|
|
|
sh 'make distclean'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('unit tests') {
|
|
|
|
agent {
|
|
|
|
docker {
|
2019-03-09 13:41:31 -04:00
|
|
|
image 'px4io/px4-dev-base-bionic:2019-03-08'
|
2019-02-07 17:11:25 -04:00
|
|
|
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
|
2019-02-05 16:42:34 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh 'export'
|
|
|
|
sh 'make distclean'
|
|
|
|
sh 'make px4_sitl_test test_results_junit'
|
|
|
|
withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) {
|
|
|
|
sh 'curl -s https://codecov.io/bash | bash -s - -F unittest'
|
|
|
|
}
|
|
|
|
sh 'make distclean'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // parallel
|
|
|
|
} // stage Coverage
|
|
|
|
|
|
|
|
} //stages
|
|
|
|
|
|
|
|
environment {
|
|
|
|
CCACHE_DIR = '/tmp/ccache'
|
|
|
|
CI = true
|
|
|
|
CTEST_OUTPUT_ON_FAILURE = 1
|
|
|
|
PX4_CMAKE_BUILD_TYPE = 'Coverage'
|
|
|
|
}
|
|
|
|
|
|
|
|
options {
|
2019-02-24 13:13:15 -04:00
|
|
|
buildDiscarder(logRotator(numToKeepStr: '10', artifactDaysToKeepStr: '30'))
|
2019-02-05 16:42:34 -04:00
|
|
|
timeout(time: 60, unit: 'MINUTES')
|
|
|
|
}
|
|
|
|
} // pipeline
|
|
|
|
|
|
|
|
def createTestNode(Map test_def) {
|
|
|
|
return {
|
|
|
|
node {
|
|
|
|
cleanWs()
|
2019-03-09 00:17:06 -04:00
|
|
|
docker.image("px4io/px4-dev-ros-kinetic:2019-03-08").inside('-e HOME=${WORKSPACE}') {
|
2019-02-05 16:42:34 -04:00
|
|
|
stage(test_def.name) {
|
|
|
|
def test_ok = true
|
|
|
|
sh('export')
|
|
|
|
|
|
|
|
checkout(scm)
|
|
|
|
|
|
|
|
// run test
|
|
|
|
try {
|
2019-02-07 17:11:25 -04:00
|
|
|
sh('make distclean')
|
|
|
|
sh('ccache -z')
|
|
|
|
sh('make px4_sitl_default')
|
|
|
|
sh('make px4_sitl_default sitl_gazebo')
|
|
|
|
sh('ccache -s')
|
|
|
|
sh('make rostest_run TEST_FILE=' + test_def.test + ' TEST_MISSION=' + test_def.mission + ' TEST_VEHICLE=' + test_def.vehicle)
|
2019-02-05 16:42:34 -04:00
|
|
|
} catch (exc) {
|
|
|
|
// save all test artifacts for debugging
|
|
|
|
archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.ulg, .ros/**/rosunit-*.xml, .ros/**/rostest-*.log')
|
|
|
|
test_ok = false
|
|
|
|
}
|
|
|
|
|
|
|
|
// log analysis
|
|
|
|
withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) {
|
|
|
|
sh 'curl -s https://codecov.io/bash | bash -s - -F sitl_mission_${STAGE_NAME}'
|
|
|
|
|
|
|
|
// process log data (with python code coverage)
|
|
|
|
try {
|
2019-02-18 12:40:29 -04:00
|
|
|
//sh('coverage run -p Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg')
|
|
|
|
sh('Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg')
|
2019-02-05 16:42:34 -04:00
|
|
|
} catch (exc) {
|
|
|
|
// save log analysis artifacts for debugging
|
|
|
|
archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.pdf, .ros/**/*.csv')
|
|
|
|
// FIXME: don't let the script to fail the build
|
|
|
|
// test_ok = false
|
|
|
|
}
|
|
|
|
|
|
|
|
// upload log to flight review (https://logs.px4.io/) with python code coverage
|
2019-02-07 17:11:25 -04:00
|
|
|
sh('coverage run -p Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/log/*/*.ulg')
|
2019-02-05 16:42:34 -04:00
|
|
|
|
|
|
|
// upload python code coverage to codecov.io
|
|
|
|
sh 'curl -s https://codecov.io/bash | bash -s - -X gcov -F sitl_python_${STAGE_NAME}'
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!test_ok) {
|
|
|
|
error('ROS Test failed')
|
|
|
|
}
|
|
|
|
} // stage
|
|
|
|
cleanWs()
|
|
|
|
} // docker.image
|
|
|
|
} // node
|
|
|
|
} // return
|
|
|
|
} // createTestNode
|