Adjust demo-dataset for CI (#12500) (#12502)

This commit is contained in:
Oliver
2026-07-29 20:44:39 +10:00
committed by GitHub
parent 0169e94007
commit 6b237de54e
3 changed files with 29 additions and 4 deletions
+6 -2
View File
@@ -32,6 +32,10 @@ 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
@@ -135,7 +139,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 invoke dev.setup-test -iv --branch "$DEMO_DATASET_BRANCH"
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
@@ -217,7 +221,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 invoke dev.setup-test -iv --branch "$DEMO_DATASET_BRANCH"
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
+5 -1
View File
@@ -40,6 +40,10 @@ 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:
@@ -90,7 +94,7 @@ jobs:
- name: Setup Postgres Database - name: Setup Postgres Database
run: | run: |
invoke migrate invoke migrate
invoke dev.setup-test -i invoke dev.setup-test -i --branch "$DEMO_DATASET_BRANCH"
- 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
+18 -1
View File
@@ -1876,8 +1876,25 @@ 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'
# 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.
if not branch or branch == 'master':
branch = 'main'
if branch != 'main':
# Stable release branches (e.g. "1.4.x") may not yet exist in the
# demo-dataset repository (e.g. it has not been backported yet).
# Fall back to "main" in that case, rather than failing the clone.
result = c.run(f'git ls-remote --heads {URL} {branch}', hide=True, warn=True)
if not result.ok or not result.stdout.strip():
warning(
f"Demo dataset has no branch named '{branch}' - falling back to 'main'"
)
branch = 'main'
# Get test data # Get test data
info('Cloning demo dataset ...') info(f"Cloning demo dataset (branch '{branch}') ...")
run(c, f'git clone {URL} {template_dir} -b {branch} -v --depth=1') run(c, f'git clone {URL} {template_dir} -b {branch} -v --depth=1')
# Make sure migrations are done - might have just deleted sqlite database # Make sure migrations are done - might have just deleted sqlite database