You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

185 lines
5.6 KiB

#!/usr/bin/env groovy
pipeline {
agent none
parameters {
choice(
name: 'PX4_CMAKE_BUILD_TYPE',
choices: ['RelWithDebInfo', 'Coverage', 'AddressSanitizer'],
description: "CMake build type"
)
}
stages {
stage('Build') {
parallel {
stage('sitl package') {
agent {
docker {
image 'px4io/px4-dev-ros:2018-07-19'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw -e HOME=$WORKSPACE'
}
}
steps {
sh('export')
sh('make distclean')
sh "ccache -z"
sh('make posix_sitl_default')
sh "ccache -s"
sh('make posix_sitl_default sitl_gazebo')
sh "ccache -s"
sh('make posix_sitl_default package')
stash(name: "px4_sitl_package", includes: "build/posix_sitl_default/*.bz2")
sh 'make distclean'
}
}
stage('unit tests') {
agent {
docker {
image 'px4io/px4-dev-base:2018-07-19'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
steps {
sh 'export'
sh 'make distclean'
sh 'ccache -z'
sh 'make posix_sitl_default test_results_junit'
sh 'ccache -s'
junit 'build/posix_sitl_default/JUnitTestResults.xml'
withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) {
sh 'curl -s https://codecov.io/bash | bash -s - -F unittest'
}
sh 'make distclean'
}
}
stage('code coverage (python)') {
agent {
docker {
image 'px4io/px4-dev-base:2018-08-04'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
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'
}
when {
environment name: 'PX4_CMAKE_BUILD_TYPE', value: 'Coverage'
}
}
} // parallel
} // stage Build
stage('ROS Tests') {
steps {
script {
def missions = [
[
name: "FW",
test: "mavros_posix_test_mission.test",
mission: "FW_mission_1",
vehicle: "plane"
],
[
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
} // ROS Tests
} //stages
environment {
CCACHE_DIR = '/tmp/ccache'
CI = true
}
options {
buildDiscarder(logRotator(numToKeepStr: '10', artifactDaysToKeepStr: '30'))
timeout(time: 60, unit: 'MINUTES')
}
} // pipeline
def createTestNode(Map test_def) {
return {
node {
cleanWs()
docker.image("px4io/px4-dev-ros:2018-03-30").inside('-e HOME=${WORKSPACE}') {
stage(test_def.name) {
try {
sh('export')
unstash('px4_sitl_package')
sh('tar -xjpvf build/posix_sitl_default/px4-posix_sitl_default*.bz2')
sh('px4-posix_sitl_default*/px4/test/rostest_px4_run.sh ' + test_def.test + ' mission:=' + test_def.mission + ' vehicle:=' + test_def.vehicle)
sh('px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py .ros/log/*/*.ulg')
}
catch (exc) {
archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.ulg, .ros/**/rosunit-*.xml, .ros/**/rostest-*.log')
throw (exc)
}
finally {
sh('px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/log/*/*.ulg')
archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.pdf, .ros/**/*.csv')
withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) {
sh 'curl -s https://codecov.io/bash | bash -s - -F mission'
}
}
}
}
cleanWs()
}
}
}