From 5d3575e615d87f43fd23306d93625eb06fe26039 Mon Sep 17 00:00:00 2001 From: Rugved Somwanshi Date: Fri, 25 Jul 2025 17:08:48 -0400 Subject: [PATCH 01/11] Format changes first --- .github/workflows/test.yml | 110 ++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 56 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6e8ea34..d7550c7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ on: # Skip running the source code checks when only documentation has been updated - "!**.md" - "!**.rst" - - "!**.txt" # Any requirements file changes will also involve changing other files + - "!**.txt" # Any requirements file changes will also involve changing other files push: branches: - main @@ -37,7 +37,7 @@ jobs: tests: runs-on: ${{ matrix.os }} strategy: - fail-fast: false # Always report results for all targets + fail-fast: false # Always report results for all targets max-parallel: 8 matrix: python-version: ["3.10", "3.11", "3.12", "3.13"] @@ -51,61 +51,59 @@ jobs: # for latest versions if the standard actions start emitting warnings steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Get pip cache dir - id: pip-cache - run: | - echo "dir=$(python -m pip cache dir)" >> $GITHUB_OUTPUT - - - name: Cache bootstrapping dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.pip-cache.outputs.dir }} - key: - pip-${{ matrix.os }}-${{ matrix.python-version }}-v1-${{ hashFiles('pdm.lock') }} - restore-keys: | - pip-${{ matrix.os }}-${{ matrix.python-version }}-v1- - - - name: Install PDM - run: | - # Ensure `pdm` uses the same version as specified in `pdm.lock` - # while avoiding the error raised by https://github.com/pypa/pip/issues/12889 - python -m pip install --upgrade -r ci-bootstrap-requirements.txt - - - name: Create development virtual environment - run: | - python -m pdm sync --no-self --dev - # Handle Windows vs non-Windows differences in .venv layout - VIRTUAL_ENV_BIN_DIR="$PWD/.venv/bin" - test -e "$VIRTUAL_ENV_BIN_DIR" || VIRTUAL_ENV_BIN_DIR="$PWD/.venv/Scripts" - echo "VIRTUAL_ENV_BIN_DIR=$VIRTUAL_ENV_BIN_DIR" >> "$GITHUB_ENV" - - - name: Static checks - run: | - source "$VIRTUAL_ENV_BIN_DIR/activate" - python -m tox -v -m static - - - name: CI-compatible tests - run: | - source "$VIRTUAL_ENV_BIN_DIR/activate" - python -m tox -v -- -m 'not lmstudio' - - - name: Upload coverage data - uses: actions/upload-artifact@v4 - with: - name: coverage-data-${{ matrix.os }}-py${{ matrix.python-version }} - path: .coverage.* - include-hidden-files: true - if-no-files-found: ignore + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Get pip cache dir + id: pip-cache + run: | + echo "dir=$(python -m pip cache dir)" >> $GITHUB_OUTPUT + + - name: Cache bootstrapping dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: pip-${{ matrix.os }}-${{ matrix.python-version }}-v1-${{ hashFiles('pdm.lock') }} + restore-keys: | + pip-${{ matrix.os }}-${{ matrix.python-version }}-v1- + + - name: Install PDM + run: | + # Ensure `pdm` uses the same version as specified in `pdm.lock` + # while avoiding the error raised by https://github.com/pypa/pip/issues/12889 + python -m pip install --upgrade -r ci-bootstrap-requirements.txt + + - name: Create development virtual environment + run: | + python -m pdm sync --no-self --dev + # Handle Windows vs non-Windows differences in .venv layout + VIRTUAL_ENV_BIN_DIR="$PWD/.venv/bin" + test -e "$VIRTUAL_ENV_BIN_DIR" || VIRTUAL_ENV_BIN_DIR="$PWD/.venv/Scripts" + echo "VIRTUAL_ENV_BIN_DIR=$VIRTUAL_ENV_BIN_DIR" >> "$GITHUB_ENV" + + - name: Static checks + run: | + source "$VIRTUAL_ENV_BIN_DIR/activate" + python -m tox -v -m static + + - name: CI-compatible tests + run: | + source "$VIRTUAL_ENV_BIN_DIR/activate" + python -m tox -v -- -m 'not lmstudio' + + - name: Upload coverage data + uses: actions/upload-artifact@v4 + with: + name: coverage-data-${{ matrix.os }}-py${{ matrix.python-version }} + path: .coverage.* + include-hidden-files: true + if-no-files-found: ignore # Coverage check based on https://hynek.me/articles/ditch-codecov-python/ coverage: From 1be7bff06f034152cf96e4d96162e86c194221aa Mon Sep 17 00:00:00 2001 From: Rugved Somwanshi Date: Fri, 15 Aug 2025 11:35:37 -0400 Subject: [PATCH 02/11] Use docker image to run CI tests --- .github/actions/docker-daemon-run/action.yml | 85 ++++++++++++++++++++ .github/workflows/test.yml | 69 ++++++++++++++-- 2 files changed, 147 insertions(+), 7 deletions(-) create mode 100644 .github/actions/docker-daemon-run/action.yml diff --git a/.github/actions/docker-daemon-run/action.yml b/.github/actions/docker-daemon-run/action.yml new file mode 100644 index 0000000..ba01968 --- /dev/null +++ b/.github/actions/docker-daemon-run/action.yml @@ -0,0 +1,85 @@ +name: Run Daemon Docker Container +description: Pulls and runs LM Studio Daemon Docker image for testing + +inputs: + docker-image: + description: "Full Docker image name" + required: true + container-name: + description: "Name for the container" + required: false + default: "llmster-test" + port: + description: "Port to expose (host:container)" + required: false + default: "1234:1234" + +outputs: + container-id: + description: "The ID of the running container" + value: ${{ steps.run-container.outputs.container-id }} + container-name: + description: "The name of the running container" + value: ${{ inputs.container-name }} + +runs: + using: "composite" + steps: + - name: Pull Docker image + shell: bash + run: | + echo "Pulling image: ${{ inputs.docker-image }}" + docker pull ${{ inputs.docker-image }} + + - name: Run container + id: run-container + shell: bash + run: | + echo "Starting container: ${{ inputs.container-name }}" + if [ "${{ inputs.use-local-image }}" = "true" ]; then + echo "Using local image: ${{ inputs.docker-image }}" + else + echo "Using registry image: ${{ inputs.docker-image }}" + fi + CONTAINER_ID=$(docker run -d --name ${{ inputs.container-name }} -p ${{ inputs.port }} ${{ inputs.docker-image }}) + echo "Container ID: $CONTAINER_ID" + echo "container-id=$CONTAINER_ID" >> $GITHUB_OUTPUT + + # Wait for container to become healthy + TIMEOUT=120 # timeout in seconds (increased to account for start-period) + START_TIME=$(date +%s) + END_TIME=$((START_TIME + TIMEOUT)) + + # Start with 1 second delay, then exponentially increase + DELAY=1 + MAX_DELAY=16 # Cap maximum delay at 16 seconds + + while [ $(date +%s) -lt $END_TIME ]; do + HEALTH_STATUS=$(docker inspect --format='{{.State.Health.Status}}' ${{ inputs.container-name }} 2>/dev/null || echo "unknown") + + if [ "$HEALTH_STATUS" = "healthy" ]; then + echo "Container is running!" + break + elif [ "$HEALTH_STATUS" = "unhealthy" ]; then + echo "Container is unhealthy - exiting" + docker logs ${{ inputs.container-name }} + exit 1 + fi + + ELAPSED=$(($(date +%s) - START_TIME)) + + sleep $DELAY + DELAY=$((DELAY * 2)) + if [ $DELAY -gt $MAX_DELAY ]; then + DELAY=$MAX_DELAY + fi + done + + # Final check after waiting for the maximum timeout + # Print logs and the health status + if [ $(date +%s) -ge $END_TIME ]; then + echo "Container health check timed out after ${TIMEOUT} seconds" + echo "Final health status: $(docker inspect --format='{{.State.Health.Status}}' ${{ inputs.container-name }})" + docker logs ${{ inputs.container-name }} + exit 1 + fi diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d7550c7..d2d0b7f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,6 +73,50 @@ jobs: restore-keys: | pip-${{ matrix.os }}-${{ matrix.python-version }}-v1- + - name: Run the built image + id: run + uses: ./.github/actions/docker-daemon-run + with: + docker-image: lmstudio/llmster-preview:cpu + # Use the same port as the always on API server + port: "41343:1234" + + - name: Download models for tests (Ubuntu only) + if: matrix.os == 'ubuntu-22.04' + run: | + echo "Downloading required models..." + + # Download text LLMs + docker exec llmster lms get https://huggingface.co/hugging-quants/Llama-3.2-1B-Instruct-Q4_K_M-GGUF -y + docker exec llmster lms get https://huggingface.co/Qwen/Qwen2.5-7B-Instruct-GGUF -y + docker exec llmster lms get https://huggingface.co/ZiangWu/MobileVLM_V2-1.7B-GGUF -y + + # Download vision LLM + docker exec llmster lms get ZiangWu/MobileVLM_V2-1.7B-GGUF -y + + # Download additional model for speculative decoding examples + docker exec llmster lms get qwen2.5-0.5b-instruct -y + + echo "Model downloads complete" + + - name: Load models into LM Studio (Ubuntu only) + if: matrix.os == 'ubuntu-22.04' + run: | + echo "Loading models..." + + # Load embedding model + docker exec llmster lms load nomic-embed-text-v1.5 --identifier text-embedding-nomic-embed-text-v1.5 -y + + # Load text LLMs + docker exec llmster lms load llama-3.2-1b-instruct --identifier llama-3.2-1b-instruct -y + docker exec llmster lms load qwen2.5-7b-instruct --identifier qwen2.5-7b-instruct-1m -y + docker exec llmster lms load smollm2-135m-instruct --identifier smollm2-135m-instruct -y + + # Load vision LLM + docker exec llmster lms load ZiangWu/MobileVLM_V2-1.7B-GGUF --identifier mobilevlm_v2-1.7b + + echo "Model loading complete" + - name: Install PDM run: | # Ensure `pdm` uses the same version as specified in `pdm.lock` @@ -92,11 +136,18 @@ jobs: source "$VIRTUAL_ENV_BIN_DIR/activate" python -m tox -v -m static - - name: CI-compatible tests + - name: CI-compatible tests (Windows) + if: matrix.os == 'windows-2022' run: | source "$VIRTUAL_ENV_BIN_DIR/activate" python -m tox -v -- -m 'not lmstudio' + - name: All tests including LM Studio (Ubuntu) + if: matrix.os == 'ubuntu-22.04' + run: | + source "$VIRTUAL_ENV_BIN_DIR/activate" + python -m tox -v + - name: Upload coverage data uses: actions/upload-artifact@v4 with: @@ -105,6 +156,12 @@ jobs: include-hidden-files: true if-no-files-found: ignore + - name: Stop LM Studio Docker container (Ubuntu only) + if: matrix.os == 'ubuntu-22.04' && always() + run: | + docker stop llmster || true + docker rm llmster || true + # Coverage check based on https://hynek.me/articles/ditch-codecov-python/ coverage: name: Combine & check coverage @@ -143,12 +200,10 @@ jobs: # Report again and fail if under 50%. # Highest historical coverage: 65% # Last noted local test coverage level: 94% - # CI coverage percentage is low because many of the tests - # aren't CI compatible (they need a local LM Studio instance). - # It's only as high as it is because the generated data model - # classes make up such a large portion of the total SDK code. - # Accept anything over 50% until CI is set up to run LM Studio - # in headless mode, and hence is able to run end-to-end tests. + # Ubuntu runners now run LM Studio in Docker, so they achieve higher + # coverage than Windows runners (which skip LM Studio tests). + # The generated data model classes make up a large portion of the SDK code. + # Accept anything over 50% as Windows runners still skip LM Studio tests. coverage report --fail-under=50 - name: Upload HTML report if check failed From dc398156294be3bce44eab644aea50093a70fbc3 Mon Sep 17 00:00:00 2001 From: Rugved Somwanshi Date: Fri, 15 Aug 2025 11:38:12 -0400 Subject: [PATCH 03/11] Remove loading of non-required model --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d2d0b7f..e73e0e7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -110,7 +110,6 @@ jobs: # Load text LLMs docker exec llmster lms load llama-3.2-1b-instruct --identifier llama-3.2-1b-instruct -y docker exec llmster lms load qwen2.5-7b-instruct --identifier qwen2.5-7b-instruct-1m -y - docker exec llmster lms load smollm2-135m-instruct --identifier smollm2-135m-instruct -y # Load vision LLM docker exec llmster lms load ZiangWu/MobileVLM_V2-1.7B-GGUF --identifier mobilevlm_v2-1.7b From 286dff92d4cb07c940e803131e2401d382a6664b Mon Sep 17 00:00:00 2001 From: Rugved Somwanshi Date: Fri, 15 Aug 2025 12:08:50 -0400 Subject: [PATCH 04/11] Run docker only on ubuntu runners --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e73e0e7..ccb926c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -74,6 +74,7 @@ jobs: pip-${{ matrix.os }}-${{ matrix.python-version }}-v1- - name: Run the built image + if: matrix.os == 'ubuntu-22.04' id: run uses: ./.github/actions/docker-daemon-run with: From 86efcc5b643475fe7b06605d5a9ef8897d9df873 Mon Sep 17 00:00:00 2001 From: Rugved Somwanshi Date: Fri, 15 Aug 2025 12:10:59 -0400 Subject: [PATCH 05/11] Correct container name --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ccb926c..62acfc2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -81,6 +81,7 @@ jobs: docker-image: lmstudio/llmster-preview:cpu # Use the same port as the always on API server port: "41343:1234" + container-name: llmster - name: Download models for tests (Ubuntu only) if: matrix.os == 'ubuntu-22.04' From 3164f430ccd3882aae0e784c1a5e1f9aa25e7d8d Mon Sep 17 00:00:00 2001 From: Rugved Somwanshi Date: Fri, 15 Aug 2025 12:16:38 -0400 Subject: [PATCH 06/11] Fix the redundant lms get --- .github/workflows/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 62acfc2..8b34a50 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -93,9 +93,6 @@ jobs: docker exec llmster lms get https://huggingface.co/Qwen/Qwen2.5-7B-Instruct-GGUF -y docker exec llmster lms get https://huggingface.co/ZiangWu/MobileVLM_V2-1.7B-GGUF -y - # Download vision LLM - docker exec llmster lms get ZiangWu/MobileVLM_V2-1.7B-GGUF -y - # Download additional model for speculative decoding examples docker exec llmster lms get qwen2.5-0.5b-instruct -y From ef31ddae46585bf6fd818eb5c564cd8df32213e2 Mon Sep 17 00:00:00 2001 From: Rugved Somwanshi Date: Fri, 15 Aug 2025 12:19:02 -0400 Subject: [PATCH 07/11] Suppress download logs --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8b34a50..ce5cb41 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -89,12 +89,12 @@ jobs: echo "Downloading required models..." # Download text LLMs - docker exec llmster lms get https://huggingface.co/hugging-quants/Llama-3.2-1B-Instruct-Q4_K_M-GGUF -y - docker exec llmster lms get https://huggingface.co/Qwen/Qwen2.5-7B-Instruct-GGUF -y - docker exec llmster lms get https://huggingface.co/ZiangWu/MobileVLM_V2-1.7B-GGUF -y + docker exec llmster lms get https://huggingface.co/hugging-quants/Llama-3.2-1B-Instruct-Q4_K_M-GGUF -y --quite + docker exec llmster lms get https://huggingface.co/Qwen/Qwen2.5-7B-Instruct-GGUF -y --quite + docker exec llmster lms get https://huggingface.co/ZiangWu/MobileVLM_V2-1.7B-GGUF -y --quite # Download additional model for speculative decoding examples - docker exec llmster lms get qwen2.5-0.5b-instruct -y + docker exec llmster lms get https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct-GGUF -y --quite echo "Model downloads complete" From 081cdc3cb00cacad040f6b7aa725fb1d2735cc56 Mon Sep 17 00:00:00 2001 From: Rugved Somwanshi Date: Fri, 15 Aug 2025 12:20:15 -0400 Subject: [PATCH 08/11] Fix spelling error --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ce5cb41..6a9f07b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -89,12 +89,12 @@ jobs: echo "Downloading required models..." # Download text LLMs - docker exec llmster lms get https://huggingface.co/hugging-quants/Llama-3.2-1B-Instruct-Q4_K_M-GGUF -y --quite - docker exec llmster lms get https://huggingface.co/Qwen/Qwen2.5-7B-Instruct-GGUF -y --quite - docker exec llmster lms get https://huggingface.co/ZiangWu/MobileVLM_V2-1.7B-GGUF -y --quite + docker exec llmster lms get https://huggingface.co/hugging-quants/Llama-3.2-1B-Instruct-Q4_K_M-GGUF -y --quiet + docker exec llmster lms get https://huggingface.co/Qwen/Qwen2.5-7B-Instruct-GGUF -y --quiet + docker exec llmster lms get https://huggingface.co/ZiangWu/MobileVLM_V2-1.7B-GGUF -y --quiet # Download additional model for speculative decoding examples - docker exec llmster lms get https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct-GGUF -y --quite + docker exec llmster lms get https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct-GGUF -y --quiet echo "Model downloads complete" From 58f950a270e37a5362519ed980f050667fea0555 Mon Sep 17 00:00:00 2001 From: Rugved Somwanshi Date: Fri, 15 Aug 2025 13:09:19 -0400 Subject: [PATCH 09/11] Seperate jobs --- .github/workflows/test.yml | 166 +++++++++++++++++++++++++------------ 1 file changed, 113 insertions(+), 53 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6a9f07b..272fc76 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,21 +34,64 @@ defaults: shell: bash jobs: - tests: - runs-on: ${{ matrix.os }} + tests-windows: + runs-on: windows-2022 strategy: - fail-fast: false # Always report results for all targets - max-parallel: 8 + fail-fast: false matrix: python-version: ["3.10", "3.11", "3.12", "3.13"] - # While the main SDK is platform independent, the subprocess execution - # in the plugin runner and tests requires some Windows-specific code - # Note: a green tick in CI is currently misleading due to - # https://github.com/lmstudio-ai/lmstudio-python/issues/140 - os: [ubuntu-22.04, windows-2022] - # Check https://github.com/actions/action-versions/tree/main/config/actions - # for latest versions if the standard actions start emitting warnings + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Get pip cache dir + id: pip-cache + run: | + echo "dir=$(python -m pip cache dir)" >> $GITHUB_OUTPUT + + - name: Cache bootstrapping dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: pip-windows-2022-${{ matrix.python-version }}-v1-${{ hashFiles('pdm.lock') }} + restore-keys: | + pip-windows-2022-${{ matrix.python-version }}-v1- + + - name: Install PDM + run: | + python -m pip install --upgrade -r ci-bootstrap-requirements.txt + + - name: Create development virtual environment + run: | + python -m pdm sync --no-self --dev + echo "VIRTUAL_ENV_BIN_DIR=$PWD/.venv/Scripts" >> "$GITHUB_ENV" + + - name: CI-compatible tests (Windows) + run: | + source "$VIRTUAL_ENV_BIN_DIR/activate" + python -m tox -v -- -m 'not lmstudio' + + - name: Upload coverage data + uses: actions/upload-artifact@v4 + with: + name: coverage-data-windows-py${{ matrix.python-version }} + path: .coverage.* + include-hidden-files: true + if-no-files-found: ignore + + tests-docker: + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 @@ -69,22 +112,19 @@ jobs: uses: actions/cache@v4 with: path: ${{ steps.pip-cache.outputs.dir }} - key: pip-${{ matrix.os }}-${{ matrix.python-version }}-v1-${{ hashFiles('pdm.lock') }} + key: pip-ubuntu-22.04-${{ matrix.python-version }}-v1-${{ hashFiles('pdm.lock') }} restore-keys: | - pip-${{ matrix.os }}-${{ matrix.python-version }}-v1- + pip-ubuntu-22.04-${{ matrix.python-version }}-v1- - name: Run the built image - if: matrix.os == 'ubuntu-22.04' id: run uses: ./.github/actions/docker-daemon-run with: docker-image: lmstudio/llmster-preview:cpu - # Use the same port as the always on API server port: "41343:1234" container-name: llmster - - name: Download models for tests (Ubuntu only) - if: matrix.os == 'ubuntu-22.04' + - name: Download models for tests run: | echo "Downloading required models..." @@ -98,8 +138,7 @@ jobs: echo "Model downloads complete" - - name: Load models into LM Studio (Ubuntu only) - if: matrix.os == 'ubuntu-22.04' + - name: Load models into LM Studio run: | echo "Loading models..." @@ -117,31 +156,14 @@ jobs: - name: Install PDM run: | - # Ensure `pdm` uses the same version as specified in `pdm.lock` - # while avoiding the error raised by https://github.com/pypa/pip/issues/12889 python -m pip install --upgrade -r ci-bootstrap-requirements.txt - name: Create development virtual environment run: | python -m pdm sync --no-self --dev - # Handle Windows vs non-Windows differences in .venv layout - VIRTUAL_ENV_BIN_DIR="$PWD/.venv/bin" - test -e "$VIRTUAL_ENV_BIN_DIR" || VIRTUAL_ENV_BIN_DIR="$PWD/.venv/Scripts" - echo "VIRTUAL_ENV_BIN_DIR=$VIRTUAL_ENV_BIN_DIR" >> "$GITHUB_ENV" + echo "VIRTUAL_ENV_BIN_DIR=$PWD/.venv/bin" >> "$GITHUB_ENV" - - name: Static checks - run: | - source "$VIRTUAL_ENV_BIN_DIR/activate" - python -m tox -v -m static - - - name: CI-compatible tests (Windows) - if: matrix.os == 'windows-2022' - run: | - source "$VIRTUAL_ENV_BIN_DIR/activate" - python -m tox -v -- -m 'not lmstudio' - - - name: All tests including LM Studio (Ubuntu) - if: matrix.os == 'ubuntu-22.04' + - name: All tests including LM Studio run: | source "$VIRTUAL_ENV_BIN_DIR/activate" python -m tox -v @@ -149,22 +171,65 @@ jobs: - name: Upload coverage data uses: actions/upload-artifact@v4 with: - name: coverage-data-${{ matrix.os }}-py${{ matrix.python-version }} + name: coverage-data-docker-py${{ matrix.python-version }} path: .coverage.* include-hidden-files: true if-no-files-found: ignore - - name: Stop LM Studio Docker container (Ubuntu only) - if: matrix.os == 'ubuntu-22.04' && always() + - name: Stop LM Studio Docker container + if: always() run: | docker stop llmster || true docker rm llmster || true - # Coverage check based on https://hynek.me/articles/ditch-codecov-python/ - coverage: - name: Combine & check coverage + # Coverage check for Docker tests (higher target since they include LM Studio tests) + coverage-docker: + name: Docker test coverage + if: always() + needs: tests-docker + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 + + - uses: actions/download-artifact@v4 + with: + pattern: coverage-data-docker-* + merge-multiple: true + + - name: Combine coverage & fail if it goes down + run: | + uv tool install 'coverage[toml]' + + coverage combine + coverage html --skip-covered --skip-empty + + # Report and write to summary. + coverage report --format=markdown >> $GITHUB_STEP_SUMMARY + + # Higher target for Docker tests since they include LM Studio functionality + coverage report --fail-under=75 + + - name: Upload HTML report if check failed + uses: actions/upload-artifact@v4 + with: + name: html-report-docker + path: htmlcov + if: ${{ failure() }} + + # Coverage check for Windows tests (lower target since they skip LM Studio tests) + coverage-windows: + name: Windows test coverage if: always() - needs: tests + needs: tests-windows runs-on: ubuntu-latest steps: @@ -174,15 +239,13 @@ jobs: - uses: actions/setup-python@v5 with: - # Use latest Python, so it understands all syntax. python-version: "3.13" - # https://github.com/hynek/setup-cached-uv/releases/tag/v2.3.0 - uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 - uses: actions/download-artifact@v4 with: - pattern: coverage-data-* + pattern: coverage-data-windows-* merge-multiple: true - name: Combine coverage & fail if it goes down @@ -198,15 +261,12 @@ jobs: # Report again and fail if under 50%. # Highest historical coverage: 65% # Last noted local test coverage level: 94% - # Ubuntu runners now run LM Studio in Docker, so they achieve higher - # coverage than Windows runners (which skip LM Studio tests). - # The generated data model classes make up a large portion of the SDK code. - # Accept anything over 50% as Windows runners still skip LM Studio tests. + # Lower target for Windows tests since they skip LM Studio functionality coverage report --fail-under=50 - name: Upload HTML report if check failed uses: actions/upload-artifact@v4 with: - name: html-report + name: html-report-windows path: htmlcov if: ${{ failure() }} From 152aeb785ab1105b0001a80183c3c00fedd96e61 Mon Sep 17 00:00:00 2001 From: Rugved Somwanshi Date: Mon, 18 Aug 2025 14:34:28 -0400 Subject: [PATCH 10/11] Split the coverage into two and smaller quantization --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 272fc76..5e4d187 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -130,7 +130,7 @@ jobs: # Download text LLMs docker exec llmster lms get https://huggingface.co/hugging-quants/Llama-3.2-1B-Instruct-Q4_K_M-GGUF -y --quiet - docker exec llmster lms get https://huggingface.co/Qwen/Qwen2.5-7B-Instruct-GGUF -y --quiet + docker exec llmster lms get https://huggingface.co/Qwen/Qwen2.5-7B-Instruct-GGUF@q3_k_m -y --quiet docker exec llmster lms get https://huggingface.co/ZiangWu/MobileVLM_V2-1.7B-GGUF -y --quiet # Download additional model for speculative decoding examples From ec632c07767cd434f7ca462e66622640a162f7ec Mon Sep 17 00:00:00 2001 From: Rugved Somwanshi Date: Mon, 18 Aug 2025 14:45:02 -0400 Subject: [PATCH 11/11] Verbose loggin for debug --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5e4d187..03f6756 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -166,7 +166,7 @@ jobs: - name: All tests including LM Studio run: | source "$VIRTUAL_ENV_BIN_DIR/activate" - python -m tox -v + python -m tox -v -- -v --tb=short - name: Upload coverage data uses: actions/upload-artifact@v4