Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ jobs:

- name: Run Gradio app tests
run: |
echo "Installing ollama..."
curl -fsSL https://ollama.com/install.sh | sh

# Give ollama systemd unit time to start
sleep 5

MODEL=smollm2:135m
echo "Pulling model $MODEL..."
ollama pull $MODEL

echo "Running Gradio test script"
./test-images.sh $(git rev-parse --short ${{ github.sha }})
working-directory: web-apps

Expand Down
2 changes: 2 additions & 0 deletions charts/azimuth-llm/ci/default-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ api:
enabled: false
# No GPUs in CI runners
gpus: 0
# Limit context length for efficiency
modelMaxContextLength: 100
ui:
service:
zenith:
Expand Down
5 changes: 3 additions & 2 deletions web-apps/chat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM python:3.11-slim
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim

ARG DIR=chat

COPY $DIR/requirements.txt requirements.txt
RUN sed -i s$../utils$./utils$ requirements.txt
COPY utils utils
RUN pip install --no-cache-dir -r requirements.txt
RUN uv pip install --system --no-cache-dir -r requirements.txt

COPY purge-google-fonts.sh purge-google-fonts.sh
RUN bash purge-google-fonts.sh
Expand Down
3 changes: 1 addition & 2 deletions web-apps/chat/defaults.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

# Default target is a local ollama instance
# running inside the same docker network
model_name: smollm2:135m
backend_url: http://ollama:11434
backend_url: http://localhost:11434

host_address: 0.0.0.0

Expand Down
2 changes: 1 addition & 1 deletion web-apps/chat/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
gradio<6
gradio_client
openai
langchain
langchain<1.0
langchain_openai
pydantic
structlog
Expand Down
4 changes: 2 additions & 2 deletions web-apps/flux-image-gen/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11
FROM ghcr.io/astral-sh/uv:python3.11-bookworm

# https://stackoverflow.com/questions/55313610/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directo
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
Expand All @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
ARG DIR=flux-image-gen

COPY $DIR/requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
RUN uv pip install --system --no-cache-dir -r requirements.txt

COPY purge-google-fonts.sh .
RUN bash purge-google-fonts.sh
Expand Down
5 changes: 3 additions & 2 deletions web-apps/image-analysis/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM python:3.11-slim
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim

ARG DIR=image-analysis

COPY $DIR/requirements.txt requirements.txt
RUN sed -i s$../utils$./utils$ requirements.txt
COPY utils utils
RUN pip install --no-cache-dir -r requirements.txt
RUN uv pip install --system --no-cache-dir -r requirements.txt

COPY purge-google-fonts.sh purge-google-fonts.sh
RUN bash purge-google-fonts.sh
Expand Down
48 changes: 32 additions & 16 deletions web-apps/test-images.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/bash
set -e

# NOTE(sd109): This script relies on docker host networking in order
# to communicate from Gradio to ollama running on localhost. This means
# it does not work on MacOS since docker host networking does not work.
# It is intended to be run on a Linux machine and is primarily used in
# GitHub runners as part of CI testing.

IMAGE_TAG="${1:-latest}"
echo Testing image tag $IMAGE_TAG

Expand Down Expand Up @@ -41,10 +47,12 @@ test() {

if [[ -f $1/test.py ]]; then

DOCKER_NET_NAME=azimuth-llm-shared
if [[ ! $(docker network ls | grep $DOCKER_NET_NAME) ]]; then
docker network create $DOCKER_NET_NAME
fi
DOCKER_NET_NAME=host

# DOCKER_NET_NAME=azimuth-llm-shared
# if [[ ! $(docker network ls | grep $DOCKER_NET_NAME) ]]; then
# docker network create $DOCKER_NET_NAME
# fi

# Ensure app image is available
IMAGE=$(image_name $1):$IMAGE_TAG
Expand All @@ -56,33 +64,41 @@ test() {
fi

# Ensure Ollama instance is available
if [[ $(curl -s localhost:11434) == "Ollama is running" ]]; then
log "Using existing ollama process running on localhost:11434"
else
log "Ollama process not running - starting containerised server"
docker run --rm --network $DOCKER_NET_NAME -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
sleep 3
docker exec ollama ollama pull smollm2:135m
if [[ $(curl -s localhost:11434) != "Ollama is running" ]]; then
log "Ollama not running on localhost:11434 - aborting test"
exit 1
# log "Using existing ollama process running on localhost:11434"
# else
# log "Ollama process not running - starting containerised server"
# docker run --rm --network $DOCKER_NET_NAME -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
# sleep 3
# docker exec ollama ollama pull smollm2:135m
fi

log "Starting Gradio app container"
docker run --network $DOCKER_NET_NAME -d --name $1-app $IMAGE

# Give the app time to start
sleep 3
sleep 10

log "Running tests"
# docker run --network $DOCKER_NET_NAME --rm \
# --name $1-test-suite \
# -e GRADIO_URL=http://$1-app:7860 --entrypoint python \
# $IMAGE \
# test.py
docker run --network $DOCKER_NET_NAME --rm \
--name $1-test-suite \
-e GRADIO_URL=http://$1-app:7860 --entrypoint python \
--entrypoint python \
$IMAGE \
test.py

log "Removing containers:"
docker rm -f ollama $1-app
# docker rm -f ollama $1-app
docker rm -f $1-app

log "Removing docker network:"
docker network rm $DOCKER_NET_NAME
# log "Removing docker network:"
# docker network rm $DOCKER_NET_NAME

echo
echo "----- Tests succeed -----"
Expand Down
Loading