use scons cache by default (#21102)

* always use scons cache

* cleanup
pull/20320/head^2
Adeeb Shihadeh 2021-06-01 17:12:32 -07:00 committed by GitHub
parent 867f7d39fd
commit a0dabd94e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 13 deletions

View File

@ -15,7 +15,7 @@ env:
docker pull $DOCKER_REGISTRY/$BASE_IMAGE:latest || true
docker build --cache-from $DOCKER_REGISTRY/$BASE_IMAGE:latest -t $DOCKER_REGISTRY/$BASE_IMAGE:latest -t $BASE_IMAGE:latest -f Dockerfile.openpilot_base .
RUN: docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e PYTHONPATH=/tmp/openpilot -e SCONS_CACHE=1 -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v /tmp/scons_cache:/tmp/scons_cache -v /tmp/comma_download_cache:/tmp/comma_download_cache $BASE_IMAGE /bin/sh -c
RUN: docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e PYTHONPATH=/tmp/openpilot -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v /tmp/scons_cache:/tmp/scons_cache -v /tmp/comma_download_cache:/tmp/comma_download_cache $BASE_IMAGE /bin/sh -c
UNIT_TEST: coverage run --append -m unittest discover
jobs:

4
Jenkinsfile vendored
View File

@ -127,7 +127,7 @@ pipeline {
stage('Devel Tests') {
steps {
phone_steps("eon-build", [
["build devel", "cd release && SCONS_CACHE=1 DEVEL_TEST=1 ./build_devel.sh"],
["build devel", "cd release && DEVEL_TEST=1 ./build_devel.sh"],
["test manager", "python selfdrive/manager/test/test_manager.py"],
["onroad tests", "cd selfdrive/test/ && ./test_onroad.py"],
["test car interfaces", "cd selfdrive/car/tests/ && ./test_car_interfaces.py"],
@ -166,7 +166,7 @@ pipeline {
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"),)
phone(device_ip, "build", "SCONS_CACHE=1 scons -j4 && sync")
phone(device_ip, "build", "scons -j4 && sync")
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"

View File

@ -223,13 +223,10 @@ env = Environment(
if GetOption('compile_db'):
env.CompilationDatabase('compile_commands.json')
if os.environ.get('SCONS_CACHE'):
cache_dir = '/tmp/scons_cache'
if TICI:
cache_dir = '/data/scons_cache'
CacheDir(cache_dir)
Clean(["."], cache_dir)
# Setup cache dir
cache_dir = '/data/scons_cache' if TICI else '/tmp/scons_cache'
CacheDir(cache_dir)
Clean(["."], cache_dir)
node_interval = 5
node_count = 0

View File

@ -49,7 +49,7 @@ popd
# Build stuff
ln -sfn /data/openpilot /data/pythonpath
export PYTHONPATH="/data/openpilot:/data/openpilot/pyextra"
SCONS_CACHE=1 scons -j3
scons -j3
# Run tests
python selfdrive/manager/test/test_manager.py

View File

@ -65,7 +65,7 @@ popd
# Build
export PYTHONPATH="$BUILD_DIR"
SCONS_CACHE=1 scons -j$(nproc)
scons -j$(nproc)
# Run tests
#python selfdrive/manager/test/test_manager.py

View File

@ -25,7 +25,6 @@ PREBUILT = os.path.exists(os.path.join(BASEDIR, 'prebuilt'))
def build(spinner, dirty=False):
env = os.environ.copy()
env['SCONS_PROGRESS'] = "1"
env['SCONS_CACHE'] = "1"
nproc = os.cpu_count()
j_flag = "" if nproc is None else f"-j{nproc - 1}"