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_BACKUP_DIR: /home/runner/work/InvenTree/test_inventree_backup
|
||||||
INVENTREE_SITE_URL: http://localhost:8000
|
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:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
@@ -140,7 +136,7 @@ jobs:
|
|||||||
pip-dependency: psycopg2
|
pip-dependency: psycopg2
|
||||||
- name: Set up test data
|
- name: Set up test data
|
||||||
run: |
|
run: |
|
||||||
invoke dev.setup-test -iv --branch "$DEMO_DATASET_BRANCH"
|
invoke dev.setup-test -iv
|
||||||
invoke int.rebuild-thumbnails
|
invoke int.rebuild-thumbnails
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: invoke int.frontend-compile --extract
|
run: invoke int.frontend-compile --extract
|
||||||
@@ -222,7 +218,7 @@ jobs:
|
|||||||
pip-dependency: psycopg2
|
pip-dependency: psycopg2
|
||||||
- name: Set up test data
|
- name: Set up test data
|
||||||
run: |
|
run: |
|
||||||
invoke dev.setup-test -iv --branch "$DEMO_DATASET_BRANCH"
|
invoke dev.setup-test -iv
|
||||||
invoke int.rebuild-thumbnails
|
invoke int.rebuild-thumbnails
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: invoke int.frontend-compile --extract
|
run: invoke int.frontend-compile --extract
|
||||||
|
|||||||
@@ -40,10 +40,6 @@ env:
|
|||||||
INVENTREE_DB_HOST: "127.0.0.1"
|
INVENTREE_DB_HOST: "127.0.0.1"
|
||||||
INVENTREE_DB_PORT: 5432
|
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:
|
jobs:
|
||||||
|
|
||||||
paths-filter:
|
paths-filter:
|
||||||
@@ -94,7 +90,7 @@ jobs:
|
|||||||
- name: Setup Postgres Database
|
- name: Setup Postgres Database
|
||||||
run: |
|
run: |
|
||||||
invoke migrate
|
invoke migrate
|
||||||
invoke dev.setup-test -i --branch "$DEMO_DATASET_BRANCH"
|
invoke dev.setup-test -i
|
||||||
- name: Create Plugin Data
|
- name: Create Plugin Data
|
||||||
run: |
|
run: |
|
||||||
pip install -U inventree-dummy-app-plugin==0.1.0
|
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)',
|
'keep': 'Keep existing demo dataset (do not re-clone)',
|
||||||
'validate_files': 'Validate media files are correctly copied',
|
'validate_files': 'Validate media files are correctly copied',
|
||||||
'use_ssh': 'Use SSH protocol for cloning the demo dataset (requires SSH key)',
|
'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',
|
'verbose': 'Print verbose output from management commands',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -1859,7 +1859,7 @@ def setup_test(
|
|||||||
use_ssh: bool = False,
|
use_ssh: bool = False,
|
||||||
verbose: bool = False,
|
verbose: bool = False,
|
||||||
path: str = 'inventree-demo-dataset',
|
path: str = 'inventree-demo-dataset',
|
||||||
branch='main',
|
branch: Optional[str] = None,
|
||||||
):
|
):
|
||||||
"""Setup a testing environment."""
|
"""Setup a testing environment."""
|
||||||
from src.backend.InvenTree.InvenTree.config import ( # type: ignore[import]
|
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
|
# Use SSH protocol for cloning the demo dataset
|
||||||
URL = 'git@github.com:inventree/demo-dataset.git'
|
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
|
# InvenTree's trunk branch is named "master", but the demo-dataset
|
||||||
# repository uses "main" as its trunk branch - map this automatically
|
# repository uses "main" as its trunk branch - map this automatically
|
||||||
# so CI can pass through the detected target branch unmodified.
|
# so CI can pass through the detected target branch unmodified.
|
||||||
|
|||||||
Reference in New Issue
Block a user