Fix breaking changes from databricks-ai-bridge 0.4.2 #483
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- ready_for_review | |
workflow_dispatch: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
pip install -r requirements/lint-requirements.txt | |
- name: Lint Python code with ruff | |
run: | | |
ruff check . | |
ruff format --check . | |
core_test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10"] | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install .[dev] | |
- name: Run tests | |
run: | | |
pytest tests/ | |
langchain_cross_version_test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
databricks-langchain-version: ["0.1.0", "0.2.0", "0.3.0", "0.4.0"] | |
fail-fast: false | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install core package | |
run: | | |
pip install .[dev] | |
- name: Cache langchain tests | |
id: cache-langchain | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/langchain-tests/version-${{ matrix.databricks-langchain-version }} | |
key: ${{ runner.os }}-langchain-tests-${{ matrix.databricks-langchain-version }} | |
- name: Setup langchain tests | |
if: steps.cache-langchain.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p /tmp/langchain-tests/version-${{ matrix.databricks-langchain-version }} | |
cd /tmp/langchain-tests/version-${{ matrix.databricks-langchain-version }} | |
pip install databricks-langchain==${{ matrix.databricks-langchain-version }} --no-deps --target=./package_files | |
# Copy tests directory and setup files | |
if [ -d "./package_files/databricks_langchain/tests" ]; then | |
cp -r ./package_files/databricks_langchain/tests ./tests | |
elif [ -d "./package_files/tests" ]; then | |
cp -r ./package_files/tests ./tests | |
else | |
echo "Error: Tests directory not found in the installed package" | |
find ./package_files -type d -name "test*" | grep -v "__pycache__" | |
# Try to find tests directory | |
TEST_DIR=$(find ./package_files -type d -name "test*" | grep -v "__pycache__" | head -1) | |
if [ -n "$TEST_DIR" ]; then | |
cp -r $TEST_DIR ./tests | |
fi | |
fi | |
# Copy requirements and setup files if they exist | |
find ./package_files -name "requirements*.txt" -exec cp {} . \; | |
find ./package_files -name "setup.py" -exec cp {} . \; | |
- name: Install test dependencies | |
run: | | |
cd /tmp/langchain-tests/version-${{ matrix.databricks-langchain-version }} | |
if [ -f requirements.txt ]; then | |
grep -v "databricks-ai-bridge" requirements.txt > filtered_requirements.txt || echo "No databricks-ai-bridge in requirements" | |
if [ -s filtered_requirements.txt ]; then | |
pip install -r filtered_requirements.txt | |
fi | |
fi | |
- name: Run tests | |
run: | | |
cd /tmp/langchain-tests/version-${{ matrix.databricks-langchain-version }} | |
pytest tests/unit_tests | |
openai_test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install . | |
pip install integrations/openai[dev] | |
- name: Run tests | |
run: | | |
pytest integrations/openai/tests/unit_tests | |
llamaindex_test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install . | |
pip install integrations/llamaindex[dev] | |
- name: Run tests | |
run: | | |
pytest integrations/llamaindex/tests/unit_tests |