mirror of
https://github.com/inventree/InvenTree.git
synced 2026-08-10 23:46:21 +00:00
Demo ci check (#12530)
* Remove branch checking in workflow files * Detect demo branch based on software version * Fix typo
This commit is contained in:
@@ -1846,7 +1846,7 @@ def test(
|
||||
'keep': 'Keep existing demo dataset (do not re-clone)',
|
||||
'validate_files': 'Validate media files are correctly copied',
|
||||
'use_ssh': 'Use SSH protocol for cloning the demo dataset (requires SSH key)',
|
||||
'branch': 'Specify branch of demo-dataset to clone (default = main)',
|
||||
'branch': 'Specify branch of demo-dataset to clone',
|
||||
'verbose': 'Print verbose output from management commands',
|
||||
}
|
||||
)
|
||||
@@ -1859,7 +1859,7 @@ def setup_test(
|
||||
use_ssh: bool = False,
|
||||
verbose: bool = False,
|
||||
path: str = 'inventree-demo-dataset',
|
||||
branch='main',
|
||||
branch: Optional[str] = None,
|
||||
):
|
||||
"""Setup a testing environment."""
|
||||
from src.backend.InvenTree.InvenTree.config import ( # type: ignore[import]
|
||||
@@ -1882,6 +1882,16 @@ def setup_test(
|
||||
# Use SSH protocol for cloning the demo dataset
|
||||
URL = 'git@github.com:inventree/demo-dataset.git'
|
||||
|
||||
if not branch:
|
||||
# No branch specified - determine the InvenTree version
|
||||
version = get_inventree_version()
|
||||
|
||||
# If the version is a stable release (e.g. "1.4.3")
|
||||
# then we can try to use the corresponding branch in the demo-dataset repository
|
||||
# (e.g. "1.4.x")
|
||||
if re.match(r'^\d+\.\d+\.\d+$', version):
|
||||
branch = f'{version.rsplit(".", 1)[0]}.x'
|
||||
|
||||
# InvenTree's trunk branch is named "master", but the demo-dataset
|
||||
# repository uses "main" as its trunk branch - map this automatically
|
||||
# so CI can pass through the detected target branch unmodified.
|
||||
|
||||
Reference in New Issue
Block a user