diff --git a/.github/workflows/docker-image-build.yml b/.github/workflows/docker-image-build.yml new file mode 100644 index 0000000000..0f54bdbc23 --- /dev/null +++ b/.github/workflows/docker-image-build.yml @@ -0,0 +1,29 @@ +name: Docker Image Build + +on: + pull_request: + branches: + - main + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - name: Azure Container Registry Login + uses: Azure/docker-login@v1 + with: + # Container registry username + username: ${{ secrets.SAMPLEAPP_ACR_USERNAME }} + # Container registry password + password: ${{ secrets.SAMPLEAPP_ACR_PASSWORD }} + # Container registry server url + login-server: sampleappaoaichatgpt.azurecr.io + + - uses: actions/checkout@v3 + - name: Build the Docker image + run: + docker build . --file WebApp.Dockerfile --tag sampleappaoaichatgpt.azurecr.io/sample-app-aoai-chatgpt:$(date +'%Y-%m-%d')_$GITHUB_RUN_NUMBER + diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image-publish.yml similarity index 97% rename from .github/workflows/docker-image.yml rename to .github/workflows/docker-image-publish.yml index a164f45e9a..4cfca2010b 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image-publish.yml @@ -1,4 +1,4 @@ -name: Docker Image CI +name: Docker Image Publish on: push: diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 12ebce7fa6..c261c90580 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -30,5 +30,5 @@ jobs: cache: 'npm' cache-dependency-path: '**/package-lock.json' - run: npm ci - - run: npm run build --if-present + - run: NODE_OPTIONS=--max_old_space_size=8192 npm run build --if-present - run: npm run test --if-present diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index b353de0709..cb387477d4 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -13,10 +13,9 @@ permissions: contents: read jobs: - build: - - runs-on: ubuntu-latest - + test_linux: + runs-on: + - ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up Python 3.11 @@ -26,9 +25,26 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest - if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi + pip install -r requirements-dev.txt - name: Test with pytest run: | export PYTHONPATH=$(pwd) + pytest -v --show-capture=stdout -k "not integration" + + test_windows: + runs-on: + - windows-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.11 + uses: actions/setup-python@v3 + with: + python-version: "3.11" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-dev.txt + - name: Test with pytest + run: | + $env:PYTHONPATH=$pwd pytest -v --show-capture=stdout -k "not integration" \ No newline at end of file diff --git a/WebApp.Dockerfile b/WebApp.Dockerfile index af27b28807..d902410534 100644 --- a/WebApp.Dockerfile +++ b/WebApp.Dockerfile @@ -8,7 +8,7 @@ RUN npm ci COPY --chown=node:node ./frontend/ ./frontend COPY --chown=node:node ./static/ ./static WORKDIR /home/node/app/frontend -RUN npm run build +RUN NODE_OPTIONS=--max_old_space_size=8192 npm run build FROM python:3.11-alpine RUN apk add --no-cache --virtual .build-deps \ diff --git a/backend/settings.py b/backend/settings.py index 4b02fef50f..0fe0ba59e9 100644 --- a/backend/settings.py +++ b/backend/settings.py @@ -14,6 +14,7 @@ ValidationError, ValidationInfo ) +from pydantic.alias_generators import to_snake from pydantic_settings import BaseSettings, SettingsConfigDict from typing import List, Literal, Optional from typing_extensions import Self @@ -254,7 +255,9 @@ class _AzureSearchSettings(BaseSettings, DatasourcePayloadConstructor): 'vector', 'semantic', 'vector_simple_hybrid', - 'vector_semantic_hybrid' + 'vectorSimpleHybrid', + 'vector_semantic_hybrid', + 'vectorSemanticHybrid' ] = "simple" permitted_groups_column: Optional[str] = Field(default=None, exclude=True) @@ -297,6 +300,10 @@ def set_fields_mapping(self) -> Self: "vector_fields": self.vector_columns } return self + + @model_validator(mode="after") + def set_query_type(self) -> Self: + self.query_type = to_snake(self.query_type) def _set_filter_string(self, request: Request) -> str: if self.permitted_groups_column: diff --git a/frontend/package.json b/frontend/package.json index 7931975c0e..f793005ffc 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -5,8 +5,8 @@ "type": "module", "scripts": { "dev": "vite", - "build": "tsc && node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build", - "watch": "tsc && node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js --watch", + "build": "tsc && vite build", + "watch": "tsc && vite build --watch", "test": "jest", "lint": "npx eslint src", "lint:fix": "npx eslint --fix", diff --git a/start.cmd b/start.cmd index 061131c028..5e19ecb145 100644 --- a/start.cmd +++ b/start.cmd @@ -1,5 +1,7 @@ @echo off +set NODE_OPTIONS=--max_old_space_size=8192 + echo. echo Restoring backend python packages echo. diff --git a/start.sh b/start.sh index 054da2aad6..9f59867d90 100755 --- a/start.sh +++ b/start.sh @@ -1,5 +1,7 @@ #!/bin/bash +export NODE_OPTIONS=--max_old_space_size=8192 + echo "" echo "Restoring frontend npm packages" echo "" diff --git a/tests/integration_tests/test_startup_scripts.py b/tests/integration_tests/test_startup_scripts.py new file mode 100644 index 0000000000..8aec4cdf51 --- /dev/null +++ b/tests/integration_tests/test_startup_scripts.py @@ -0,0 +1,40 @@ +import os +import pytest +import sys + +from subprocess import Popen, TimeoutExpired +from time import sleep + + +script_base_path = os.path.dirname( + os.path.dirname( + os.path.dirname(__file__) + ) +) + +script_timeout = 240 + +@pytest.fixture(scope="function") +def script_command(): + if sys.platform.startswith("linux"): + return "./start.sh" + + else: + return "./start.cmd" + + +def test_startup_script(script_command): + stdout = None + try: + p = Popen([script_command], cwd=script_base_path) + stdout, _ = p.communicate(timeout=script_timeout) + + except TimeoutExpired: + assert isinstance(stdout, str) + assert "127.0.0.1:50505" in stdout + p.terminate() + + + + + \ No newline at end of file