Skip to content

Commit

Permalink
Abhahn/sql server private preview (#874)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhahn authored May 23, 2024
1 parent 1342652 commit 5c01f9c
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 12 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/docker-image-build.yml
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker Image CI
name: Docker Image Publish

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
28 changes: 22 additions & 6 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
2 changes: 1 addition & 1 deletion WebApp.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
9 changes: 8 additions & 1 deletion backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions start.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@echo off

set NODE_OPTIONS=--max_old_space_size=8192

echo.
echo Restoring backend python packages
echo.
Expand Down
2 changes: 2 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

export NODE_OPTIONS=--max_old_space_size=8192

echo ""
echo "Restoring frontend npm packages"
echo ""
Expand Down
40 changes: 40 additions & 0 deletions tests/integration_tests/test_startup_scripts.py
Original file line number Diff line number Diff line change
@@ -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()





0 comments on commit 5c01f9c

Please sign in to comment.