Skip to content

Commit

Permalink
updated tests and integration runners
Browse files Browse the repository at this point in the history
  • Loading branch information
eavanvalkenburg committed Nov 26, 2024
1 parent 8c481df commit daef713
Show file tree
Hide file tree
Showing 7 changed files with 493 additions and 87 deletions.
261 changes: 213 additions & 48 deletions .github/workflows/python-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ jobs:
if: steps.filter.outputs.python != 'true'
run: echo "NOT python file"

python-merge-gate:
name: Python Pre-Merge Integration Tests
python-merge-gate-completions:
name: Python Pre-Merge Integration Tests - Completions & Embeddings
needs: paths-filter
if: github.event_name != 'pull_request' && github.event_name != 'schedule' && needs.paths-filter.outputs.pythonChanges == 'true'
strategy:
Expand All @@ -107,21 +107,18 @@ jobs:
working-directory: python
runs-on: ${{ matrix.os }}
environment: "integration"
env:
UV_PYTHON: ${{ matrix.python-version }}
COMPLETIONS_CONCEPT_SAMPLE: "true"
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.30"
version: "0.5.2"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
- name: Install dependencies with hnswlib native disabled
if: matrix.os == 'macos-latest' && matrix.python-version == '3.11'
run: |
export HNSWLIB_NO_NATIVE=1
uv sync --all-extras --dev
- name: Install dependencies with hnswlib native enabled
if: matrix.os != 'macos-latest' || matrix.python-version != '3.11'
- name: Install dependencies
run: |
uv sync --all-extras --dev
- name: Install Ollama
Expand Down Expand Up @@ -152,18 +149,6 @@ jobs:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
- name: Setup Redis Stack Server
if: matrix.os == 'ubuntu-latest'
run: docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest
- name: Setup Weaviate docker deployment
if: matrix.os == 'ubuntu-latest'
run: docker run -d -p 8080:8080 -p 50051:50051 cr.weaviate.io/semitechnologies/weaviate:1.26.6
- name: Start Azure Cosmos DB emulator
if: matrix.os == 'windows-latest'
run: |
Write-Host "Launching Cosmos DB Emulator"
Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
Start-CosmosDbEmulator
- name: Azure CLI Login
if: github.event_name != 'pull_request'
uses: azure/login@v2
Expand All @@ -176,37 +161,80 @@ jobs:
timeout-minutes: 15
shell: bash
run: |
uv run pytest -n logical --dist loadfile --dist worksteal ./tests/integration/completions -v --junitxml=pytest-completions.xml
- name: Run Integration Tests - Embeddings
id: run_tests_embeddings
timeout-minutes: 5
shell: bash
uv run pytest -n logical --dist loadfile --dist worksteal ./tests/integration/completions .tests/integration/embeddings ./tests/samples ./tests/integration/cross_language -v --junitxml=pytest-completions.xml
- name: Surface failing tests
if: always()
uses: pmeier/pytest-results-action@main
with:
path: python/pytest-*.xml
summary: true
display-options: fEX
fail-on-empty: true
title: Test results
- name: Minimize uv cache
run: uv cache prune --ci

python-merge-gate-memory:
name: Python Pre-Merge Integration Tests - Memory
needs: paths-filter
if: github.event_name != 'pull_request' && github.event_name != 'schedule' && needs.paths-filter.outputs.pythonChanges == 'true'
strategy:
max-parallel: 1
fail-fast: false
matrix:
python-version: ["3.11"]
os: [ubuntu-latest]
defaults:
run:
working-directory: python
runs-on: ${{ matrix.os }}
environment: "integration"
env:
UV_PYTHON: ${{ matrix.python-version }}
MEMORY_CONCEPT_SAMPLE: "true"
# Service containers to run with for the memory connectors, this only works on Ubuntu
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis-stack-server:latest
ports:
# Opens tcp port 6379 on the host and service container
- 6379:6379
weaviate:
image: cr.weaviate.io/semitechnologies/weaviate:1.26.6
ports:
- 8080:8080
- 50051:50051
cosmosdb:
image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:vnext-preview
ports:
- 8081:8081
- 1234:1234
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: "0.5.2"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
- name: Install dependencies
run: |
uv run pytest -n logical --dist loadfile --dist worksteal ./tests/integration/embeddings -v --junitxml=pytest-embeddings.xml
uv sync --all-extras --dev
- name: Azure CLI Login
if: github.event_name != 'pull_request'
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Run Integration Tests - Memory
id: run_tests_memory
timeout-minutes: 10
shell: bash
run: |
uv run pytest -n logical --dist loadfile --dist worksteal ./tests/integration/memory -v --junitxml=pytest-memory.xml
- name: Run Integration Tests - Cross Language
id: run_tests_cross_language
timeout-minutes: 5
shell: bash
run: |
uv run pytest -n logical --dist loadfile --dist worksteal ./tests/integration/cross_language -v --junitxml=pytest-cross.xml
- name: Run Integration Tests - Planning
id: run_tests_planning
timeout-minutes: 5
shell: bash
run: |
uv run pytest -n logical --dist loadfile --dist worksteal ./tests/integration/planning -v --junitxml=pytest-planning.xml
- name: Run Integration Tests - Samples
id: run_tests_samples
timeout-minutes: 5
shell: bash
run: |
uv run pytest -n logical --dist loadfile --dist worksteal ./tests/samples -v --junitxml=pytest-samples.xml
uv run pytest -n logical --dist loadfile --dist worksteal ./tests/integration/memory ./tests/samples -v --junitxml=pytest-memory.xml
- name: Surface failing tests
if: always()
uses: pmeier/pytest-results-action@main
Expand All @@ -219,6 +247,137 @@ jobs:
- name: Minimize uv cache
run: uv cache prune --ci

# python-merge-gate:
# name: Python Pre-Merge Integration Tests
# needs: paths-filter
# if: github.event_name != 'pull_request' && github.event_name != 'schedule' && needs.paths-filter.outputs.pythonChanges == 'true'
# strategy:
# max-parallel: 1
# fail-fast: false
# matrix:
# python-version: ["3.11"]
# os: [ubuntu-latest]
# defaults:
# run:
# working-directory: python
# runs-on: ${{ matrix.os }}
# environment: "integration"
# env:
# UV_PYTHON: ${{ matrix.python-version }}
# MEMORY_CONCEPT_SAMPLE: "true"
# COMPLETIONS_CONCEPT_SAMPLE: "true"
# steps:
# - uses: actions/checkout@v4
# - name: Set up uv
# uses: astral-sh/setup-uv@v3
# with:
# version: "0.5.2"
# enable-cache: true
# cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
# - name: Install dependencies with hnswlib native disabled
# if: matrix.os == 'macos-latest' && matrix.python-version == '3.11'
# run: |
# export HNSWLIB_NO_NATIVE=1
# uv sync --all-extras --dev
# - name: Install dependencies with hnswlib native enabled
# if: matrix.os != 'macos-latest' || matrix.python-version != '3.11'
# run: |
# uv sync --all-extras --dev
# - name: Install Ollama
# if: matrix.os == 'ubuntu-latest'
# run: |
# curl -fsSL https://ollama.com/install.sh | sh
# ollama serve &
# sleep 5
# - name: Pull model in Ollama
# if: matrix.os == 'ubuntu-latest'
# run: |
# ollama pull ${{ vars.OLLAMA_CHAT_MODEL_ID }}
# ollama pull ${{ vars.OLLAMA_CHAT_MODEL_ID_IMAGE }}
# ollama pull ${{ vars.OLLAMA_CHAT_MODEL_ID_TOOL_CALL }}
# ollama pull ${{ vars.OLLAMA_TEXT_MODEL_ID }}
# ollama pull ${{ vars.OLLAMA_EMBEDDING_MODEL_ID }}
# ollama list
# - name: Google auth
# uses: google-github-actions/auth@v2
# with:
# project_id: ${{ vars.VERTEX_AI_PROJECT_ID }}
# credentials_json: ${{ secrets.VERTEX_AI_SERVICE_ACCOUNT_KEY }}
# - name: Set up gcloud
# uses: google-github-actions/setup-gcloud@v2
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws-region: ${{ vars.AWS_REGION }}
# - name: Setup Redis Stack Server
# if: matrix.os == 'ubuntu-latest'
# run: docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest
# - name: Setup Weaviate docker deployment
# if: matrix.os == 'ubuntu-latest'
# run: docker run -d -p 8080:8080 -p 50051:50051 cr.weaviate.io/semitechnologies/weaviate:1.26.6
# - name: Start Azure Cosmos DB emulator
# if: matrix.os == 'windows-latest'
# run: |
# Write-Host "Launching Cosmos DB Emulator"
# Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
# Start-CosmosDbEmulator
# - name: Azure CLI Login
# if: github.event_name != 'pull_request'
# uses: azure/login@v2
# with:
# client-id: ${{ secrets.AZURE_CLIENT_ID }}
# tenant-id: ${{ secrets.AZURE_TENANT_ID }}
# subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# - name: Run Integration Tests - Completions
# id: run_tests_completions
# timeout-minutes: 15
# shell: bash
# run: |
# uv run pytest -n logical --dist loadfile --dist worksteal ./tests/integration/completions -v --junitxml=pytest-completions.xml
# - name: Run Integration Tests - Embeddings
# id: run_tests_embeddings
# timeout-minutes: 5
# shell: bash
# run: |
# uv run pytest -n logical --dist loadfile --dist worksteal ./tests/integration/embeddings -v --junitxml=pytest-embeddings.xml
# - name: Run Integration Tests - Memory
# id: run_tests_memory
# timeout-minutes: 10
# shell: bash
# run: |
# uv run pytest -n logical --dist loadfile --dist worksteal ./tests/integration/memory -v --junitxml=pytest-memory.xml
# - name: Run Integration Tests - Cross Language
# id: run_tests_cross_language
# timeout-minutes: 5
# shell: bash
# run: |
# uv run pytest -n logical --dist loadfile --dist worksteal ./tests/integration/cross_language -v --junitxml=pytest-cross.xml
# - name: Run Integration Tests - Planning
# id: run_tests_planning
# timeout-minutes: 5
# shell: bash
# run: |
# uv run pytest -n logical --dist loadfile --dist worksteal ./tests/integration/planning -v --junitxml=pytest-planning.xml
# - name: Run Integration Tests - Samples
# id: run_tests_samples
# timeout-minutes: 5
# shell: bash
# run: |
# uv run pytest -n logical --dist loadfile --dist worksteal ./tests/samples -v --junitxml=pytest-samples.xml
# - name: Surface failing tests
# if: always()
# uses: pmeier/pytest-results-action@main
# with:
# path: python/pytest-*.xml
# summary: true
# display-options: fEX
# fail-on-empty: true
# title: Test results
# - name: Minimize uv cache
# run: uv cache prune --ci

python-integration-tests:
needs: paths-filter
if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && needs.paths-filter.outputs.pythonChanges == 'true'
Expand All @@ -233,12 +392,18 @@ jobs:
working-directory: python
runs-on: ${{ matrix.os }}
environment: "integration"
env:
HNSWLIB_NO_NATIVE: 1
Python_Integration_Tests: Python_Integration_Tests
UV_PYTHON: ${{ matrix.python-version }}
MEMORY_CONCEPT_SAMPLE: "true"
COMPLETIONS_CONCEPT_SAMPLE: "true"
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.30"
version: "0.5.2"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
- name: Install dependencies with hnswlib native disabled
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.30"
version: "0.5.2"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
- name: Install the project
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.30"
version: "0.5.2"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
- name: Install the project
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.30"
version: "0.5.2"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ env.UV_PYTHON }}
- name: Install the project
Expand Down
6 changes: 6 additions & 0 deletions python/tests/integration/completions/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# Copyright (c) Microsoft. All rights reserved.

import logging

import pytest

from semantic_kernel.kernel import Kernel
from semantic_kernel.utils.logging import setup_logging

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
setup_logging()


@pytest.fixture(scope="function")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@


@pytest.mark.skipif(
platform.system() != "Windows",
reason="The Azure Cosmos DB Emulator is only available on Windows.",
platform.system() == "Darwin",
reason="The Azure Cosmos DB Emulator is only available on Windows and Linux.",
)
class TestCosmosDBNoSQL(VectorStoreTestBase):
"""Test Cosmos DB NoSQL store functionality."""
Expand Down
Loading

0 comments on commit daef713

Please sign in to comment.