mirror of
https://github.com/inventree/InvenTree.git
synced 2026-08-10 15:36:17 +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:
@@ -33,10 +33,6 @@ env:
|
||||
INVENTREE_BACKUP_DIR: /home/runner/work/InvenTree/test_inventree_backup
|
||||
INVENTREE_SITE_URL: http://localhost:8000
|
||||
|
||||
# Use the same-named branch of the demo dataset as the target branch of this build,
|
||||
# so that stable branches are not broken by changes to the demo dataset on main
|
||||
DEMO_DATASET_BRANCH: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -140,7 +136,7 @@ jobs:
|
||||
pip-dependency: psycopg2
|
||||
- name: Set up test data
|
||||
run: |
|
||||
invoke dev.setup-test -iv --branch "$DEMO_DATASET_BRANCH"
|
||||
invoke dev.setup-test -iv
|
||||
invoke int.rebuild-thumbnails
|
||||
- name: Install dependencies
|
||||
run: invoke int.frontend-compile --extract
|
||||
@@ -222,7 +218,7 @@ jobs:
|
||||
pip-dependency: psycopg2
|
||||
- name: Set up test data
|
||||
run: |
|
||||
invoke dev.setup-test -iv --branch "$DEMO_DATASET_BRANCH"
|
||||
invoke dev.setup-test -iv
|
||||
invoke int.rebuild-thumbnails
|
||||
- name: Install dependencies
|
||||
run: invoke int.frontend-compile --extract
|
||||
|
||||
@@ -40,10 +40,6 @@ env:
|
||||
INVENTREE_DB_HOST: "127.0.0.1"
|
||||
INVENTREE_DB_PORT: 5432
|
||||
|
||||
# Use the same-named branch of the demo dataset as the target branch of this build,
|
||||
# so that stable branches are not broken by changes to the demo dataset on main
|
||||
DEMO_DATASET_BRANCH: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}
|
||||
|
||||
jobs:
|
||||
|
||||
paths-filter:
|
||||
@@ -94,7 +90,7 @@ jobs:
|
||||
- name: Setup Postgres Database
|
||||
run: |
|
||||
invoke migrate
|
||||
invoke dev.setup-test -i --branch "$DEMO_DATASET_BRANCH"
|
||||
invoke dev.setup-test -i
|
||||
- name: Create Plugin Data
|
||||
run: |
|
||||
pip install -U inventree-dummy-app-plugin==0.1.0
|
||||
|
||||
@@ -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