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 CIalbatross
parent
bb1e3fc13a
commit
d8ff186545
18
SConstruct
18
SConstruct
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import platform
|
||||
|
@ -161,10 +162,19 @@ env = Environment(
|
|||
)
|
||||
|
||||
if os.environ.get('SCONS_CACHE'):
|
||||
if QCOM_REPLAY:
|
||||
CacheDir('/tmp/scons_cache_qcom_replay')
|
||||
else:
|
||||
CacheDir('/tmp/scons_cache')
|
||||
cache_dir = '/tmp/scons_cache'
|
||||
|
||||
if os.getenv('CI'):
|
||||
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_count = 0
|
||||
|
|
|
@ -44,7 +44,7 @@ def run_on_phone(test_cmd):
|
|||
|
||||
# pass in all environment variables prefixed with 'CI_'
|
||||
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("export CI=1\n")
|
||||
|
||||
|
|
Loading…
Reference in New Issue