From ff65bef323f8dfb4160f0077c4ed2ff8067ca7b9 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Wed, 5 Aug 2020 20:21:04 -0700 Subject: [PATCH] Setup PC testing in Jenkins (#1984) * build openpilot docker container in jenkins * use cache * run all stages in parallel * move device tests * wrap in stages * it's docker * doesn't work, but jenkins should cache the image * steps * disable phone tests for now * we're root * enable everything * clean up our mess * skip checkout * need a plugin for that * remove that * parallel * Revert "parallel" This reverts commit e3e5af9dc9db692d1b5552012d62393a5b8520dd. * this is ugly * Revert "this is ugly" This reverts commit e83995935294584e264a8fcb3d08bcf7d9305434. old-commit-hash: 90d5383354365f58415cc5e99e92c4010394832c --- Jenkinsfile | 117 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 72 insertions(+), 45 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b77891bb75..0fd2b00a4d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,75 +29,102 @@ def phone_steps(String device_type, steps) { } pipeline { - agent { - docker { - image 'python:3.7.3' - args '--user=root' - } - } + agent none environment { COMMA_JWT = credentials('athena-test-jwt') TEST_DIR = "/data/openpilot" } stages { - - stage('Release Build') { - when { - branch 'devel-staging' - } - steps { - phone_steps("eon-build", [ - ["build release2-staging and dashcam-staging", "cd release && PUSH=1 ./build_release2.sh"], - ]) - } - } - - stage('On-device Tests') { + stage('openpilot tests') { when { not { anyOf { - branch 'master-ci'; branch 'devel'; branch 'devel-staging'; branch 'release2'; branch 'release2-staging'; branch 'dashcam'; branch 'dashcam-staging' + branch 'master-ci'; branch 'devel'; branch 'release2'; branch 'release2-staging'; branch 'dashcam'; branch 'dashcam-staging' } } } - parallel { - stage('Build') { - environment { - CI_PUSH = "${env.BRANCH_NAME == 'master' ? 'master-ci' : ' '}" + stage('PC tests') { + agent { + dockerfile { + filename 'Dockerfile.openpilot' + args '--privileged --shm-size=1G --user=root' + } } - steps { - phone_steps("eon", [ - ["build devel", "cd release && CI_PUSH=${env.CI_PUSH} ./build_devel.sh"], - ["test openpilot", "nosetests -s selfdrive/test/test_openpilot.py"], - //["test cpu usage", "cd selfdrive/test/ && ./test_cpu_usage.py"], - ["test car interfaces", "cd selfdrive/car/tests/ && ./test_car_interfaces.py"], - ]) + stages { + stage('Build') { + steps { + sh 'scons -j$(nproc)' + } + } + } + post { + always { + // fix permissions since docker runs as another user + sh "chmod -R 777 ." + } } } - stage('Replay Tests') { - steps { - phone_steps("eon2", [ - ["camerad/modeld replay", "cd selfdrive/test/process_replay && ./camera_replay.py"], - ]) + stage('On-device Tests') { + agent { + docker { + image 'python:3.7.3' + args '--user=root' + } } - } + stages { + + stage('Release Build') { + when { + branch 'devel-staging' + } + steps { + phone_steps("eon-build", [ + ["build release2-staging and dashcam-staging", "cd release && PUSH=1 ./build_release2.sh"], + ]) + } + } + + stage('Devel Build') { + environment { + CI_PUSH = "${env.BRANCH_NAME == 'master' ? 'master-ci' : ' '}" + } + steps { + phone_steps("eon", [ + ["build devel", "cd release && CI_PUSH=${env.CI_PUSH} ./build_devel.sh"], + ["test openpilot", "nosetests -s selfdrive/test/test_openpilot.py"], + //["test cpu usage", "cd selfdrive/test/ && ./test_cpu_usage.py"], + ["test car interfaces", "cd selfdrive/car/tests/ && ./test_car_interfaces.py"], + ]) + } + } + + stage('Replay Tests') { + steps { + phone_steps("eon2", [ + ["camerad/modeld replay", "cd selfdrive/test/process_replay && ./camera_replay.py"], + ]) + } + } + + stage('HW Tests') { + steps { + phone_steps("eon", [ + ["build cereal", "SCONS_CACHE=1 scons -j4 cereal/"], + ["test sounds", "nosetests -s selfdrive/test/test_sounds.py"], + ["test boardd loopback", "nosetests -s selfdrive/boardd/tests/test_boardd_loopback.py"], + ]) + } + } - stage('HW Tests') { - steps { - phone_steps("eon", [ - ["build cereal", "SCONS_CACHE=1 scons -j4 cereal/"], - ["test sounds", "nosetests -s selfdrive/test/test_sounds.py"], - ["test boardd loopback", "nosetests -s selfdrive/boardd/tests/test_boardd_loopback.py"], - ]) } + } } } - } }