Skip to content

Commit

Permalink
Merge pull request #455 from stacklok/sqlite-vec-ci
Browse files Browse the repository at this point in the history
Automate sqlite-vec vector DB generation for images
  • Loading branch information
lukehinds authored Dec 28, 2024
2 parents 0c30fb5 + f72beb8 commit b45f8d5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/image-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,14 @@ jobs:
github_token: ${{ github.token }}
workflow: ".github/workflows/import_packages.yml"
workflow_conclusion: success
name: backup_weaviate
name: sqlite_vectordb_file
name_is_regexp: true
skip_unpack: false
if_no_artifact_found: ignore
- name: Fetch latest FE commit SHA
id: fetch_commit_fe_sha
run: |
echo "LATEST_RELEASE=$(curl -s "https://api.github.com/repos/stacklok/codegate-ui/releases/latest" -H "Authorization: Bearer ${{ secrets.GH_CI_TOKEN }}" | grep '"zipball_url":' | cut -d '"' -f 4)" >> $GITHUB_ENV
- name: Rename to accommodate to image
run: mv ./backup_weaviate ./weaviate_backup
- name: Download git lfs dependencies
run: |
git lfs install
Expand Down
36 changes: 17 additions & 19 deletions .github/workflows/import_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,33 +51,31 @@ jobs:
github_token: ${{ github.token }}
workflow: ".github/workflows/import_packages.yml"
workflow_conclusion: success
name: backup_weaviate
name: sqlite_vectordb_file
path: /tmp/
name_is_regexp: true
skip_unpack: false
if_no_artifact_found: ignore
if_no_artifact_found: ignore

- name: Create folder if artifact download is not enabled
if: ${{ github.event.inputs.enable_artifact_download == 'false' }}
- name: Install Poetry
run: |
mkdir -p /tmp/backup_weaviate
echo "Folder ./backup_weaviate created because artifact download is disabled."
curl -sSL https://install.python-poetry.org | python3 -
- name: Run sync
- name: Add Poetry to PATH
run: |
export PYTHONPATH=$PYTHONPATH:./
export BACKUP_FILESYSTEM_PATH=/tmp/backup_weaviate/
export BACKUP_FOLDER=backup
# Conditionally export the variables only if artifact download is enabled
if [ "${{ github.event.inputs.enable_artifact_download }}" == "true" ]; then
python scripts/import_packages.py --jsonl-dir /tmp/jsonl-files/
else
python scripts/import_packages.py --restore-backup False --jsonl-dir /tmp/jsonl-files/
fi
echo "source $HOME/.poetry/env" >> $GITHUB_ENV
- name: 'Upload Backup Files'
- name: Install dependencies with Poetry
run: |
poetry install
- name: 'Run import_packages.py with poetry'
run: |
poetry run python scripts/import_packages.py --jsonl-dir /tmp --vec-db-path /tmp/sqlite_data/vectordb.db
- name: 'Upload SQLite Vector DB File'
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4
with:
name: backup_weaviate
path: /tmp/backup_weaviate/backup*
name: sqlite_vectordb_file
path: /tmp/sqlite_data/vectordb.db
retention-days: 90

0 comments on commit b45f8d5

Please sign in to comment.