From 55c17ed06b129474db64ad8272f8a6a999ea84b0 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 20 Jun 2021 10:19:46 +1000 Subject: [PATCH 1/7] Github action for importing data --- .github/workflows/import_data.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/import_data.yaml diff --git a/.github/workflows/import_data.yaml b/.github/workflows/import_data.yaml new file mode 100644 index 0000000..f620880 --- /dev/null +++ b/.github/workflows/import_data.yaml @@ -0,0 +1,27 @@ +name: Import Dataset + +on: ["push", "pull_request"] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + max-parallel: 4 + matrix: + python-version: [3.7] + + steps: + - name: Checkout Code + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install InvenTree + run: | + sudo apt-get install python3-dev python3-pip python3-venv python3-wheel g++ + pip3 install invoke + git clone --depth 1 https://github.com/inventree/inventree inventree + cd inventree + invoke install From 2aa6062e0df94d8e6d9a63bdf0103449e3d23c2c Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 20 Jun 2021 10:25:40 +1000 Subject: [PATCH 2/7] Set environment variables --- .github/workflows/import_data.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/import_data.yaml b/.github/workflows/import_data.yaml index f620880..02c76cf 100644 --- a/.github/workflows/import_data.yaml +++ b/.github/workflows/import_data.yaml @@ -10,6 +10,11 @@ jobs: max-parallel: 4 matrix: python-version: [3.7] + + env: + INVENTREE_DB_ENGINE: sqlite3 + INVENTREE_DB_NAME: inventree_db.sqlite3 + INVENTREE_MEDIA_ROOT: /path/to/media steps: - name: Checkout Code @@ -20,8 +25,10 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install InvenTree run: | + pwd sudo apt-get install python3-dev python3-pip python3-venv python3-wheel g++ pip3 install invoke git clone --depth 1 https://github.com/inventree/inventree inventree cd inventree invoke install + From 9f2eba261193c4f247b1e8d044c4b95a9a97b45b Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 20 Jun 2021 10:28:58 +1000 Subject: [PATCH 3/7] Import data --- .github/workflows/import_data.yaml | 3 ++- inventree_data.json | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 inventree_data.json diff --git a/.github/workflows/import_data.yaml b/.github/workflows/import_data.yaml index 02c76cf..a72c08f 100644 --- a/.github/workflows/import_data.yaml +++ b/.github/workflows/import_data.yaml @@ -14,7 +14,7 @@ jobs: env: INVENTREE_DB_ENGINE: sqlite3 INVENTREE_DB_NAME: inventree_db.sqlite3 - INVENTREE_MEDIA_ROOT: /path/to/media + INVENTREE_MEDIA_ROOT: ${{ GITHUB_WORKSPACE }}/path/to/media steps: - name: Checkout Code @@ -31,4 +31,5 @@ jobs: git clone --depth 1 https://github.com/inventree/inventree inventree cd inventree invoke install + invoke import-records ${{ GITHUB_WORKSPACE }}/inventree_data.json diff --git a/inventree_data.json b/inventree_data.json new file mode 100644 index 0000000..544b7b4 --- /dev/null +++ b/inventree_data.json @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file From 51154c67f3c530f254027b10b5f423135f6447b4 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 20 Jun 2021 10:30:06 +1000 Subject: [PATCH 4/7] env var fix --- .github/workflows/import_data.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/import_data.yaml b/.github/workflows/import_data.yaml index a72c08f..03201bf 100644 --- a/.github/workflows/import_data.yaml +++ b/.github/workflows/import_data.yaml @@ -14,7 +14,7 @@ jobs: env: INVENTREE_DB_ENGINE: sqlite3 INVENTREE_DB_NAME: inventree_db.sqlite3 - INVENTREE_MEDIA_ROOT: ${{ GITHUB_WORKSPACE }}/path/to/media + INVENTREE_MEDIA_ROOT: $GITHUB_WORKSPACE/path/to/media steps: - name: Checkout Code @@ -31,5 +31,5 @@ jobs: git clone --depth 1 https://github.com/inventree/inventree inventree cd inventree invoke install - invoke import-records ${{ GITHUB_WORKSPACE }}/inventree_data.json + invoke import-records $GITHUB_WORKSPACE/inventree_data.json From c33548053c75b9bc8bbc062ca7bed38dcd827b92 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 20 Jun 2021 10:33:57 +1000 Subject: [PATCH 5/7] Correct flag --- .github/workflows/import_data.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/import_data.yaml b/.github/workflows/import_data.yaml index 03201bf..be1c79c 100644 --- a/.github/workflows/import_data.yaml +++ b/.github/workflows/import_data.yaml @@ -31,5 +31,5 @@ jobs: git clone --depth 1 https://github.com/inventree/inventree inventree cd inventree invoke install - invoke import-records $GITHUB_WORKSPACE/inventree_data.json + invoke import-records -f $GITHUB_WORKSPACE/inventree_data.json From 480862600bb837eb137a8a675d9cbbb9d6d47468 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 20 Jun 2021 10:49:03 +1000 Subject: [PATCH 6/7] Cleanup --- .github/workflows/import_data.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/import_data.yaml b/.github/workflows/import_data.yaml index be1c79c..6f96752 100644 --- a/.github/workflows/import_data.yaml +++ b/.github/workflows/import_data.yaml @@ -25,11 +25,11 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install InvenTree run: | - pwd sudo apt-get install python3-dev python3-pip python3-venv python3-wheel g++ pip3 install invoke git clone --depth 1 https://github.com/inventree/inventree inventree cd inventree invoke install + - name: Import Database Records + cd inventree invoke import-records -f $GITHUB_WORKSPACE/inventree_data.json - From 940e535dd17d4d764ed1c3f5bd86aa8267f1684b Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 20 Jun 2021 11:01:00 +1000 Subject: [PATCH 7/7] Update README.md --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6e4f769..87b28d6 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ -# demo-dataset -Dataset for the InvenTree demo website +# InvenTree Demo Dataset + +This repository contains demo data for the [InvenTree project](https://inventree.readthedocs.io). + +The demo dataset can be used to populate an InvenTree database for demonstration purposes. It may also be useful if you are developing and/or testing new features for InvenTree. + +To setup InvenTree with this dataset, refer to the [InvenTree Instructions](https://inventree.readthedocs.io/en/latest/start/demo/). \ No newline at end of file