nopenpilot/Jenkinsfile

276 lines
8.9 KiB
Plaintext
Raw Normal View History

2020-08-12 18:37:05 -06:00
def phone(String ip, String step_label, String cmd) {
2021-03-29 17:54:22 -06:00
withCredentials([file(credentialsId: 'id_rsa', variable: 'key_file')]) {
2021-02-23 17:46:22 -07:00
def ssh_cmd = """
ssh -tt -o StrictHostKeyChecking=no -i ${key_file} -p 8022 'comma@${ip}' /usr/bin/bash <<'EOF'
set -e
export CI=1
export TEST_DIR=${env.TEST_DIR}
2021-07-14 18:34:36 -06:00
export SOURCE_DIR=${env.SOURCE_DIR}
2021-02-23 17:46:22 -07:00
export GIT_BRANCH=${env.GIT_BRANCH}
export GIT_COMMIT=${env.GIT_COMMIT}
source ~/.bash_profile
2021-03-29 17:54:22 -06:00
if [ -f /TICI ]; then
source /etc/profile
fi
2021-02-23 17:46:22 -07:00
ln -snf ${env.TEST_DIR} /data/pythonpath
if [ -f /EON ]; then
echo \$\$ > /dev/cpuset/app/tasks || true
echo \$PPID > /dev/cpuset/app/tasks || true
mkdir -p /dev/shm
chmod 777 /dev/shm
fi
2020-08-12 18:37:05 -06:00
cd ${env.TEST_DIR} || true
${cmd}
exit 0
2021-02-23 17:46:22 -07:00
2020-08-12 18:37:05 -06:00
EOF"""
2021-02-23 17:46:22 -07:00
sh script: ssh_cmd, label: step_label
2020-08-12 18:37:05 -06:00
}
}
def phone_steps(String device_type, steps) {
lock(resource: "", label: device_type, inversePrecedence: true, variable: 'device_ip', quantity: 1) {
2021-06-07 16:13:57 -06:00
timeout(time: 150, unit: 'MINUTES') {
2020-08-12 18:37:05 -06:00
phone(device_ip, "git checkout", readFile("selfdrive/test/setup_device_ci.sh"),)
steps.each { item ->
phone(device_ip, item[0], item[1])
}
2020-07-14 15:26:01 -06:00
}
}
2020-08-12 18:37:05 -06:00
}
pipeline {
agent none
2020-07-14 15:26:01 -06:00
environment {
2020-08-12 18:37:05 -06:00
TEST_DIR = "/data/openpilot"
2021-07-14 18:34:36 -06:00
SOURCE_DIR = "/data/openpilot_source/"
2020-07-14 15:26:01 -06:00
}
2020-10-21 07:33:00 -06:00
options {
2021-06-07 16:13:57 -06:00
timeout(time: 3, unit: 'HOURS')
2020-10-21 07:33:00 -06:00
}
2020-07-14 15:26:01 -06:00
stages {
2021-02-23 17:46:22 -07:00
stage('Build release2') {
2020-08-12 18:37:05 -06:00
agent {
docker {
image 'python:3.7.3'
args '--user=root'
}
}
2020-07-14 15:26:01 -06:00
when {
branch 'devel-staging'
}
steps {
2020-08-12 18:37:05 -06:00
phone_steps("eon-build", [
2021-07-28 23:47:43 -06:00
["build release2-staging & dashcam-staging", "cd release && PUSH=1 ./build_release2.sh"],
])
}
}
stage('Build release3') {
agent {
docker {
image 'python:3.7.3'
args '--user=root'
}
}
when {
branch 'devel-staging'
}
steps {
phone_steps("tici", [
["build release3-staging & dashcam3-staging", "PUSH=1 $SOURCE_DIR/release/build_release3.sh"],
2020-08-12 18:37:05 -06:00
])
2020-07-14 15:26:01 -06:00
}
}
2020-08-12 18:37:05 -06:00
stage('openpilot tests') {
2020-07-14 15:26:01 -06:00
when {
not {
anyOf {
2021-07-28 23:47:43 -06:00
branch 'master-ci'; branch 'devel'; branch 'devel-staging';
branch 'release2'; branch 'release2-staging'; branch 'dashcam'; branch 'dashcam-staging';
branch 'release3'; branch 'release3-staging'; branch 'dashcam3'; branch 'dashcam3-staging';
branch 'testing-closet*'; branch 'hotfix-*'
2020-07-14 15:26:01 -06:00
}
}
}
2020-08-12 18:37:05 -06:00
stages {
2020-07-14 15:26:01 -06:00
2020-08-12 18:37:05 -06:00
/*
stage('PC tests') {
agent {
dockerfile {
2020-10-01 19:45:44 -06:00
filename 'Dockerfile.openpilotci'
2020-08-12 18:37:05 -06:00
args '--privileged --shm-size=1G --user=root'
}
}
stages {
stage('Build') {
steps {
sh 'scons -j$(nproc)'
2020-07-14 15:26:01 -06:00
}
}
}
2020-08-12 18:37:05 -06:00
post {
always {
// fix permissions since docker runs as another user
sh "chmod -R 777 ."
}
}
2020-07-14 15:26:01 -06:00
}
2020-08-12 18:37:05 -06:00
*/
2020-07-14 15:26:01 -06:00
2020-08-12 18:37:05 -06:00
stage('On-device Tests') {
agent {
docker {
2021-05-14 19:20:48 -06:00
/*
filename 'Dockerfile.ondevice_ci'
args "--privileged -v /dev:/dev --shm-size=1G --user=root"
*/
2020-08-12 18:37:05 -06:00
image 'python:3.7.3'
args '--user=root'
2020-07-14 15:26:01 -06:00
}
}
2020-08-12 18:37:05 -06:00
stages {
stage('parallel tests') {
parallel {
2021-05-14 19:20:48 -06:00
stage('Devel Tests') {
2020-08-12 18:37:05 -06:00
steps {
2021-02-23 17:46:22 -07:00
phone_steps("eon-build", [
2021-07-14 18:34:36 -06:00
["build devel", "cd $SOURCE_DIR/release && EXTRA_FILES='tools/' ./build_devel.sh"],
["build openpilot", "cd selfdrive/manager && ./build.py"],
2021-03-29 17:54:22 -06:00
["test manager", "python selfdrive/manager/test/test_manager.py"],
2021-02-23 17:46:22 -07:00
["onroad tests", "cd selfdrive/test/ && ./test_onroad.py"],
2020-08-12 18:37:05 -06:00
["test car interfaces", "cd selfdrive/car/tests/ && ./test_car_interfaces.py"],
])
}
}
stage('Replay Tests') {
steps {
phone_steps("eon2", [
2021-06-07 16:13:57 -06:00
["build", "cd selfdrive/manager && ./build.py"],
["model replay", "cd selfdrive/test/process_replay && ./model_replay.py"],
2020-08-12 18:37:05 -06:00
])
}
2020-07-14 15:26:01 -06:00
}
2020-08-12 18:37:05 -06:00
stage('HW + Unit Tests') {
steps {
phone_steps("eon", [
2021-06-07 16:13:57 -06:00
["build", "cd selfdrive/manager && ./build.py"],
2021-05-14 19:20:48 -06:00
["test athena", "nosetests -s selfdrive/athena/tests/test_athenad_old.py"],
2021-07-28 23:47:43 -06:00
["test sounds", "nosetests -s selfdrive/ui/tests/test_sounds.py"],
2020-08-12 18:37:05 -06:00
["test boardd loopback", "nosetests -s selfdrive/boardd/tests/test_boardd_loopback.py"],
2021-02-23 17:46:22 -07:00
["test loggerd", "python selfdrive/loggerd/tests/test_loggerd.py"],
["test encoder", "python selfdrive/loggerd/tests/test_encoder.py"],
["test logcatd", "python selfdrive/logcatd/tests/test_logcatd_android.py"],
2020-08-12 18:37:05 -06:00
//["test updater", "python installer/updater/test_updater.py"],
])
}
}
2021-05-14 19:20:48 -06:00
/*
stage('Power Consumption Tests') {
steps {
lock(resource: "", label: "c2-zookeeper", inversePrecedence: true, variable: 'device_ip', quantity: 1) {
timeout(time: 90, unit: 'MINUTES') {
sh script: "/home/batman/tools/zookeeper/enable_and_wait.py $device_ip 120", label: "turn on device"
phone(device_ip, "git checkout", readFile("selfdrive/test/setup_device_ci.sh"),)
2021-06-07 16:13:57 -06:00
phone(device_ip, "build", "scons -j4 && sync")
2021-05-14 19:20:48 -06:00
sh script: "/home/batman/tools/zookeeper/disable.py $device_ip", label: "turn off device"
sh script: "/home/batman/tools/zookeeper/enable_and_wait.py $device_ip 120", label: "turn on device"
sh script: "/home/batman/tools/zookeeper/check_consumption.py 60 3", label: "idle power consumption after boot"
sh script: "/home/batman/tools/zookeeper/ignition.py 1", label: "go onroad"
sh script: "/home/batman/tools/zookeeper/check_consumption.py 60 10", label: "onroad power consumption"
sh script: "/home/batman/tools/zookeeper/ignition.py 0", label: "go offroad"
sh script: "/home/batman/tools/zookeeper/check_consumption.py 60 2", label: "idle power consumption offroad"
}
}
}
}
*/
2021-07-14 18:34:36 -06:00
stage('tici Build') {
2021-02-23 17:46:22 -07:00
environment {
R3_PUSH = "${env.BRANCH_NAME == 'master' ? '1' : ' '}"
}
steps {
phone_steps("tici", [
2021-06-07 16:13:57 -06:00
["build", "cd selfdrive/manager && ./build.py"],
2021-05-14 19:20:48 -06:00
["onroad tests", "cd selfdrive/test/ && ./test_onroad.py"],
2021-02-23 17:46:22 -07:00
])
}
}
2021-07-14 18:34:36 -06:00
stage('Unit Tests (tici)') {
steps {
phone_steps("tici2", [
["build", "cd selfdrive/manager && ./build.py"],
["test loggerd", "python selfdrive/loggerd/tests/test_loggerd.py"],
["test encoder", "LD_LIBRARY_PATH=/usr/local/lib python selfdrive/loggerd/tests/test_encoder.py"],
])
}
}
2021-03-29 17:54:22 -06:00
stage('camerad') {
steps {
phone_steps("eon-party", [
2021-06-07 16:13:57 -06:00
["build", "cd selfdrive/manager && ./build.py"],
2021-03-29 17:54:22 -06:00
["test camerad", "python selfdrive/camerad/test/test_camerad.py"],
["test exposure", "python selfdrive/camerad/test/test_exposure.py"],
])
}
}
stage('Tici camerad') {
steps {
phone_steps("tici-party", [
2021-06-07 16:13:57 -06:00
["build", "cd selfdrive/manager && ./build.py"],
2021-03-29 17:54:22 -06:00
["test camerad", "python selfdrive/camerad/test/test_camerad.py"],
["test exposure", "python selfdrive/camerad/test/test_exposure.py"],
])
}
}
2020-07-14 15:26:01 -06:00
}
}
2021-05-14 19:20:48 -06:00
stage('Push master-ci') {
when {
branch 'master'
}
steps {
phone_steps("eon-build", [
2021-07-14 18:34:36 -06:00
["push devel", "cd $SOURCE_DIR/release && PUSH='master-ci' ./build_devel.sh"],
2021-05-14 19:20:48 -06:00
])
}
}
2020-07-14 15:26:01 -06:00
}
2020-10-01 19:45:44 -06:00
post {
always {
cleanWs()
}
}
2020-07-14 15:26:01 -06:00
}
}
}
}
}
2021-02-23 17:46:22 -07:00