Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 141 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
env:
UV_INDEX: pytorch=https://download.pytorch.org/whl/cpu

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: package-lock.json

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Install Node dependencies
run: npm ci

- name: Install Python dependencies
run: |
cd hindsight-api && uv sync --frozen --index-strategy unsafe-best-match
cd ../hindsight-dev && uv sync --frozen --index-strategy unsafe-best-match
cd ../hindsight-embed && uv sync --frozen --index-strategy unsafe-best-match

- name: Run lint
run: ./scripts/hooks/lint.sh

unit-tests:
runs-on: ubuntu-latest
env:
UV_INDEX: pytorch=https://download.pytorch.org/whl/cpu

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Install dependencies
working-directory: ./hindsight-api
run: uv sync --frozen --no-install-project --index-strategy unsafe-best-match

- name: Run unit tests
working-directory: ./hindsight-api
run: |
uv run pytest \
tests/test_config_validation.py \
tests/test_chunking.py \
tests/test_query_analyzer.py \
tests/test_link_utils.py \
tests/test_sql_schema_safety.py \
tests/test_provider_default_models.py \
tests/test_main_module.py \
tests/test_server_module.py \
tests/test_litellm_sdk_embeddings.py \
tests/test_litellm_sdk_cross_encoder.py \
-v --timeout 120 -n auto --dist loadgroup

build-api:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Build hindsight-api
working-directory: ./hindsight-api
run: uv build
Comment on lines +89 to +107
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if hindsight-api has PyTorch-related dependency
echo "=== Checking hindsight-api/pyproject.toml for PyTorch dependencies ==="
if [ -f "hindsight-api/pyproject.toml" ]; then
  cat hindsight-api/pyproject.toml | grep -iE 'torch|pytorch'
else
  echo "hindsight-api/pyproject.toml not found"
fi

Repository: franchb/hindsight

Length of output: 266


🏁 Script executed:

#!/bin/bash
# Check the entire CI workflow to see UV_INDEX usage in all jobs
echo "=== Checking CI workflow for UV_INDEX environment variable ==="
cat .github/workflows/ci.yml | grep -A 5 -B 5 "UV_INDEX"

Repository: franchb/hindsight

Length of output: 527


🏁 Script executed:

#!/bin/bash
# Get the structure of the workflow file around build-api, lint, and unit-tests jobs
echo "=== Checking workflow structure ==="
cat .github/workflows/ci.yml

Repository: franchb/hindsight

Length of output: 3621


Add missing UV_INDEX env var to build-api job

The build-api job is missing the UV_INDEX: pytorch=https://download.pytorch.org/whl/cpu environment variable that both lint and unit-tests jobs define. Since hindsight-api has a torch dependency (torch>=2.6.0), the uv build command will fail to resolve it without the PyTorch index configured.

Proposed fix
   build-api:
     runs-on: ubuntu-latest
+    env:
+      UV_INDEX: pytorch=https://download.pytorch.org/whl/cpu
 
     steps:
     - uses: actions/checkout@v4
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
build-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Build hindsight-api
working-directory: ./hindsight-api
run: uv build
build-api:
runs-on: ubuntu-latest
env:
UV_INDEX: pytorch=https://download.pytorch.org/whl/cpu
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Build hindsight-api
working-directory: ./hindsight-api
run: uv build
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 89 - 107, The build-api job is missing
the UV_INDEX environment variable needed to resolve torch, so add UV_INDEX with
the value "pytorch=https://download.pytorch.org/whl/cpu" to the build-api job's
environment (apply it at the job level or to the steps that run uv, e.g., before
the "Install uv" or "Build hindsight-api" steps) so that the uv build command in
the Build hindsight-api step can fetch PyTorch; reference the build-api job name
and the UV_INDEX env var when making the change.


build-docker-slim:
name: Build Docker (${{ matrix.name }})
runs-on: ubuntu-latest
strategy:
matrix:
include:
- target: api-only
name: api-slim
build_args: |
INCLUDE_LOCAL_MODELS=false
PRELOAD_ML_MODELS=false
- target: standalone
name: standalone-slim
build_args: |
INCLUDE_LOCAL_MODELS=false
PRELOAD_ML_MODELS=false

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build ${{ matrix.name }} image
uses: docker/build-push-action@v6
with:
context: .
file: docker/standalone/Dockerfile
target: ${{ matrix.target }}
build-args: ${{ matrix.build_args }}
push: false
load: false
tags: hindsight-${{ matrix.name }}:test
45 changes: 0 additions & 45 deletions .github/workflows/deploy-docs.yml

This file was deleted.

Loading