Separate scons cache by branch (#1836)

* separate scons cache by branch

* debug

* guess you can only call CacheDir once

* remove another call

* pass git branch and commit through

* copytree

* set CI
old-commit-hash: d8ff186545
commatwo_master
Adeeb Shihadeh 5 years ago committed by GitHub
parent 57093d9ef1
commit 86200a6d6e
  1. 18
      SConstruct
  2. 2
      selfdrive/test/phone_ci.py

@ -1,4 +1,5 @@
import os import os
import shutil
import subprocess import subprocess
import sys import sys
import platform import platform
@ -161,10 +162,19 @@ env = Environment(
) )
if os.environ.get('SCONS_CACHE'): if os.environ.get('SCONS_CACHE'):
if QCOM_REPLAY: cache_dir = '/tmp/scons_cache'
CacheDir('/tmp/scons_cache_qcom_replay')
else: if os.getenv('CI'):
CacheDir('/tmp/scons_cache') branch = os.getenv('GIT_BRANCH')
if QCOM_REPLAY:
cache_dir = '/tmp/scons_cache_qcom_replay'
elif branch is not None and branch != 'master':
cache_dir_branch = '/tmp/scons_cache_' + branch
if not os.path.isdir(cache_dir_branch) and os.path.isdir(cache_dir):
shutil.copytree(cache_dir, cache_dir_branch)
cache_dir = cache_dir_branch
CacheDir(cache_dir)
node_interval = 5 node_interval = 5
node_count = 0 node_count = 0

@ -44,7 +44,7 @@ def run_on_phone(test_cmd):
# pass in all environment variables prefixed with 'CI_' # pass in all environment variables prefixed with 'CI_'
for k, v in os.environ.items(): for k, v in os.environ.items():
if k.startswith("CI_"): if k.startswith("CI_") or k in ["GIT_BRANCH", "GIT_COMMIT"]:
conn.send(f"export {k}='{v}'\n") conn.send(f"export {k}='{v}'\n")
conn.send("export CI=1\n") conn.send("export CI=1\n")

Loading…
Cancel
Save