mirror of
https://github.com/frappe/bench.git
synced 2025-01-06 23:44:03 +00:00
Merge pull request #1347 from gavindsouza/ci-reduce-time
ci: Reduce test builds' runtimes
This commit is contained in:
commit
ec9d8588ca
@ -71,7 +71,7 @@ class Bench(Base, Validator):
|
||||
|
||||
@property
|
||||
def python(self) -> str:
|
||||
return get_env_cmd("python3", bench_path=self.name)
|
||||
return get_env_cmd("python", bench_path=self.name)
|
||||
|
||||
@property
|
||||
def shallow_clone(self) -> bool:
|
||||
@ -352,15 +352,18 @@ class BenchSetup(Base):
|
||||
|
||||
if not os.path.exists(self.bench.python):
|
||||
if virtualenv:
|
||||
self.run(f"{virtualenv} {quiet_flag} env -p {python}")
|
||||
self.run(f"{virtualenv} {quiet_flag} env -p {python}", cwd=self.bench.name)
|
||||
else:
|
||||
venv = get_venv_path(verbose=verbose, python=python)
|
||||
self.run(f"{venv} env")
|
||||
self.run(f"{venv} env", cwd=self.bench.name)
|
||||
|
||||
self.pip()
|
||||
|
||||
if os.path.exists(frappe):
|
||||
self.run(f"{self.bench.python} -m pip install {quiet_flag} --upgrade -e {frappe}")
|
||||
self.run(
|
||||
f"{self.bench.python} -m pip install {quiet_flag} --upgrade -e {frappe}",
|
||||
cwd=self.bench.name,
|
||||
)
|
||||
|
||||
@step(title="Setting Up Bench Config", success="Bench Config Set Up")
|
||||
def config(self, redis=True, procfile=True):
|
||||
@ -388,7 +391,9 @@ class BenchSetup(Base):
|
||||
verbose = bench.cli.verbose or verbose
|
||||
quiet_flag = "" if verbose else "--quiet"
|
||||
|
||||
return self.run(f"{self.bench.python} -m pip install {quiet_flag} --upgrade pip")
|
||||
return self.run(
|
||||
f"{self.bench.python} -m pip install {quiet_flag} --upgrade pip", cwd=self.bench.name
|
||||
)
|
||||
|
||||
def logging(self):
|
||||
from bench.utils import setup_logging
|
||||
|
@ -80,7 +80,6 @@ class TestBenchInit(TestBenchBase):
|
||||
site_config_path = os.path.join(site_path, "site_config.json")
|
||||
|
||||
self.init_bench(bench_name)
|
||||
exec_cmd("bench setup requirements --node", cwd=bench_path)
|
||||
self.new_site(site_name, bench_name)
|
||||
|
||||
self.assertTrue(os.path.exists(site_path))
|
||||
@ -99,7 +98,7 @@ class TestBenchInit(TestBenchBase):
|
||||
def test_get_app(self):
|
||||
self.init_bench("test-bench")
|
||||
bench_path = os.path.join(self.benches_path, "test-bench")
|
||||
exec_cmd(f"bench get-app {TEST_FRAPPE_APP}", cwd=bench_path)
|
||||
exec_cmd(f"bench get-app {TEST_FRAPPE_APP} --skip-assets", cwd=bench_path)
|
||||
self.assertTrue(os.path.exists(os.path.join(bench_path, "apps", TEST_FRAPPE_APP)))
|
||||
app_installed_in_env = TEST_FRAPPE_APP in subprocess.check_output(
|
||||
["bench", "pip", "freeze"], cwd=bench_path
|
||||
@ -111,7 +110,7 @@ class TestBenchInit(TestBenchBase):
|
||||
FRAPPE_APP = "healthcare"
|
||||
self.init_bench("test-bench")
|
||||
bench_path = os.path.join(self.benches_path, "test-bench")
|
||||
exec_cmd(f"bench get-app {FRAPPE_APP} --resolve-deps", cwd=bench_path)
|
||||
exec_cmd(f"bench get-app {FRAPPE_APP} --resolve-deps --skip-assets", cwd=bench_path)
|
||||
self.assertTrue(os.path.exists(os.path.join(bench_path, "apps", FRAPPE_APP)))
|
||||
|
||||
states_path = os.path.join(bench_path, "sites", "apps.json")
|
||||
@ -128,9 +127,9 @@ class TestBenchInit(TestBenchBase):
|
||||
bench_path = os.path.join(self.benches_path, "test-bench")
|
||||
|
||||
self.init_bench(bench_name)
|
||||
exec_cmd("bench setup requirements --node", cwd=bench_path)
|
||||
exec_cmd("bench build", cwd=bench_path)
|
||||
exec_cmd(f"bench get-app {TEST_FRAPPE_APP} --branch master", cwd=bench_path)
|
||||
exec_cmd(
|
||||
f"bench get-app {TEST_FRAPPE_APP} --branch master --skip-assets", cwd=bench_path
|
||||
)
|
||||
|
||||
self.assertTrue(os.path.exists(os.path.join(bench_path, "apps", TEST_FRAPPE_APP)))
|
||||
|
||||
@ -158,9 +157,9 @@ class TestBenchInit(TestBenchBase):
|
||||
self.init_bench("test-bench")
|
||||
bench_path = os.path.join(self.benches_path, "test-bench")
|
||||
|
||||
exec_cmd("bench setup requirements --node", cwd=bench_path)
|
||||
exec_cmd(
|
||||
f"bench get-app {TEST_FRAPPE_APP} --branch master --overwrite", cwd=bench_path
|
||||
f"bench get-app {TEST_FRAPPE_APP} --branch master --overwrite --skip-assets",
|
||||
cwd=bench_path,
|
||||
)
|
||||
exec_cmd(f"bench remove-app {TEST_FRAPPE_APP}", cwd=bench_path)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user