diff --git a/.azure-pipelines/python-smoke-tests.yml b/.azure-pipelines/python-smoke-tests.yml new file mode 100644 index 0000000000..c58ccc9e8f --- /dev/null +++ b/.azure-pipelines/python-smoke-tests.yml @@ -0,0 +1,80 @@ +# Python Smoke Tests (Azure DevOps) +# +# Runs the smoke tests against Azure OpenAI with Entra ID auth (no API key). +# These run in Azure DevOps because GitHub-hosted Actions runners cannot obtain +# Entra ID tokens for the tenant that hosts the Azure OpenAI resource. +# +# Pipeline variables (set in Azure DevOps, not in this file): +# GRAPHRAG_API_BASE - Azure OpenAI endpoint +# AZURE_AI_SEARCH_URL_ENDPOINT - Azure AI Search endpoint (Entra ID auth, no key) + +trigger: + branches: + include: + - main + - "*/main" # match branches like feature/main + paths: + exclude: + - "**/*.md" + - .semversioner + +pr: + autoCancel: true # only run for the latest commit + drafts: false # skip draft PRs + branches: + include: + - main + - "*/main" + paths: + exclude: + - "**/*.md" + - .semversioner + +variables: + pythonVersion: "3.13" + +jobs: + - job: smoke_tests + displayName: Smoke tests + timeoutInMinutes: 90 + strategy: + matrix: + ubuntu: + vmImage: ubuntu-latest + windows: + vmImage: windows-latest + pool: + vmImage: $(vmImage) + steps: + - task: UsePythonVersion@0 + displayName: Set up Python $(pythonVersion) + inputs: + versionSpec: $(pythonVersion) + + - script: python -m pip install uv + displayName: Install uv + + - script: uv sync --all-packages + displayName: Install dependencies + + - script: uv build --all-packages + displayName: Build + + # The fixtures use Entra ID auth for Azure OpenAI and Azure AI Search; + # DefaultAzureCredential picks up the Azure CLI login made by this task. + - task: AzureCLI@2 + displayName: Smoke Test + inputs: + azureSubscription: graphrag-oss-ci + scriptType: pscore + scriptLocation: inlineScript + inlineScript: uv run poe test_smoke + env: + DEBUG: 1 + GRAPHRAG_API_BASE: $(GRAPHRAG_API_BASE) + AZURE_AI_SEARCH_URL_ENDPOINT: $(AZURE_AI_SEARCH_URL_ENDPOINT) + + - publish: tests/fixtures + artifact: smoke-test-artifacts-$(Agent.OS) + displayName: Upload smoke test artifacts + condition: always() diff --git a/.github/workflows/python-smoke-tests.yml b/.github/workflows/python-smoke-tests.yml deleted file mode 100644 index 2fa703b213..0000000000 --- a/.github/workflows/python-smoke-tests.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Python Smoke Tests -on: - push: - branches: - - "**/main" # match branches like feature/main - - "main" # match the main branch - pull_request: - types: - - opened - - reopened - - synchronize - - ready_for_review - branches: - - "**/main" - - "main" - paths-ignore: - - "**/*.md" - - ".semversioner/**" - -permissions: - contents: read - pull-requests: read - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - # Only run the for the latest commit - cancel-in-progress: true - -jobs: - python-ci: - # skip draft PRs - if: github.event.pull_request.draft == false - strategy: - matrix: - python-version: ["3.13"] - os: [ubuntu-latest, windows-latest] - fail-fast: false # Continue running all jobs even if one fails - env: - DEBUG: 1 - GRAPHRAG_API_KEY: ${{ secrets.GRAPHRAG_API_KEY }} - GRAPHRAG_API_BASE: ${{ secrets.GRAPHRAG_API_BASE }} - # Azure AI Search config - AZURE_AI_SEARCH_URL_ENDPOINT: ${{ secrets.AZURE_AI_SEARCH_URL_ENDPOINT }} - AZURE_AI_SEARCH_API_KEY: ${{ secrets.AZURE_AI_SEARCH_API_KEY }} - - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - - - uses: dorny/paths-filter@0e4a8c6effa4802afeda77dc8d303f8176d7dfad # v3.0.4 - id: changes - with: - filters: | - python: - - 'graphrag/**/*' - - 'uv.lock' - - 'pyproject.toml' - - '**/*.py' - - '**/*.toml' - - '**/*.ipynb' - - '.github/workflows/python*.yml' - - 'tests/smoke/**/*' - - 'tests/fixtures/**/*' - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version: ${{ matrix.python-version }} - - - name: Install uv - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0 - - - name: Install dependencies - shell: bash - run: | - uv sync --all-packages - - - name: Build - run: | - uv build --all-packages - - - name: Install and start Azurite - shell: bash - run: | - npm install -g azurite - azurite --silent --skipApiVersionCheck --location /tmp/azurite --debug /tmp/azurite-debug.log & - - - name: Smoke Test - if: steps.changes.outputs.python == 'true' - run: | - uv run poe test_smoke - - - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: always() - with: - name: smoke-test-artifacts-${{ matrix.python-version }}-${{ runner.os }} - path: tests/fixtures/* diff --git a/tests/fixtures/min-csv/settings.yml b/tests/fixtures/min-csv/settings.yml index 2920a9eeb6..df0d5ab9a7 100644 --- a/tests/fixtures/min-csv/settings.yml +++ b/tests/fixtures/min-csv/settings.yml @@ -1,7 +1,7 @@ completion_models: default_completion_model: model_provider: azure - api_key: ${GRAPHRAG_API_KEY} + auth_method: azure_managed_identity api_base: ${GRAPHRAG_API_BASE} api_version: "2025-04-01-preview" model: gpt-4.1 @@ -19,7 +19,7 @@ completion_models: embedding_models: default_embedding_model: model_provider: azure - api_key: ${GRAPHRAG_API_KEY} + auth_method: azure_managed_identity api_base: ${GRAPHRAG_API_BASE} api_version: "2025-04-01-preview" model: text-embedding-3-large diff --git a/tests/fixtures/text/settings.yml b/tests/fixtures/text/settings.yml index 9bae96322f..67a535cd79 100644 --- a/tests/fixtures/text/settings.yml +++ b/tests/fixtures/text/settings.yml @@ -1,7 +1,7 @@ completion_models: default_completion_model: model_provider: azure - api_key: ${GRAPHRAG_API_KEY} + auth_method: azure_managed_identity api_base: ${GRAPHRAG_API_BASE} api_version: "2025-04-01-preview" model: gpt-4.1 @@ -19,7 +19,7 @@ completion_models: embedding_models: default_embedding_model: model_provider: azure - api_key: ${GRAPHRAG_API_KEY} + auth_method: azure_managed_identity api_base: ${GRAPHRAG_API_BASE} api_version: "2025-04-01-preview" model: text-embedding-3-large @@ -38,7 +38,6 @@ embedding_models: vector_store: type: "azure_ai_search" url: ${AZURE_AI_SEARCH_URL_ENDPOINT} - api_key: ${AZURE_AI_SEARCH_API_KEY} container_name: "simple_text_ci" table_provider: diff --git a/tests/smoke/test_fixtures.py b/tests/smoke/test_fixtures.py index 8624930c14..07c9601687 100644 --- a/tests/smoke/test_fixtures.py +++ b/tests/smoke/test_fixtures.py @@ -227,8 +227,6 @@ def __run_query(self, root: Path, query_config: dict[str, str]): **os.environ, "BLOB_STORAGE_CONNECTION_STRING": WELL_KNOWN_AZURITE_CONNECTION_STRING, "LOCAL_BLOB_STORAGE_CONNECTION_STRING": WELL_KNOWN_AZURITE_CONNECTION_STRING, - "AZURE_AI_SEARCH_URL_ENDPOINT": os.getenv("AZURE_AI_SEARCH_URL_ENDPOINT"), - "AZURE_AI_SEARCH_API_KEY": os.getenv("AZURE_AI_SEARCH_API_KEY"), }, clear=True, )