From 83f3a4853921675b16c88e3d7b263b087da0babc Mon Sep 17 00:00:00 2001 From: ChristianZaccaria Date: Wed, 9 Jul 2025 16:43:31 +0100 Subject: [PATCH] Omit ui from coverage tests --- .coveragerc | 1 + .github/workflows/coverage-badge.yaml | 11 ++++------- .github/workflows/unit-tests.yml | 13 ------------- docs/source/contributing/testing.md | 9 +-------- 4 files changed, 6 insertions(+), 28 deletions(-) diff --git a/.coveragerc b/.coveragerc index e9bb3b68b..d4925275f 100644 --- a/.coveragerc +++ b/.coveragerc @@ -6,6 +6,7 @@ omit = .venv/* */llama_stack/cli/scripts/* */llama_stack/ui/* + */llama_stack/distribution/ui/* */llama_stack/strong_typing/* */llama_stack/env.py */__init__.py diff --git a/.github/workflows/coverage-badge.yaml b/.github/workflows/coverage-badge.yaml index ce4c11bcc..1462da567 100644 --- a/.github/workflows/coverage-badge.yaml +++ b/.github/workflows/coverage-badge.yaml @@ -16,11 +16,8 @@ on: jobs: unit-tests: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python: - - "3.12" + env: + PYTHON_VERSION: "3.12" steps: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -30,11 +27,11 @@ jobs: - name: Run unit tests run: | - PYTHON_VERSION=${{ matrix.python }} ./scripts/unit-tests.sh + PYTHON_VERSION=${{ env.PYTHON_VERSION }} ./scripts/unit-tests.sh - name: Coverage Badge uses: tj-actions/coverage-badge-py@1788babcb24544eb5bbb6e0d374df5d1e54e670f # v2.0.4 - + - name: Verify Changed files uses: tj-actions/verify-changed-files@a1c6acee9df209257a246f2cc6ae8cb6581c1edf # v20.0.4 id: verify-changed-files diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 620d68b04..41034b45f 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -48,16 +48,3 @@ jobs: pytest-report-${{ matrix.python }}.xml htmlcov-${{ matrix.python }}/ retention-days: 7 - - - name: Check coverage - run: | - coverage=$(uv run --python ${{ matrix.python }} --group unit coverage report -m | tail -1 | tail -c 4 | head -c 2) - echo "Total coverage: ${coverage}%" - - # Check if coverage is below the threshold - if (( ${coverage} < 40 )); then - echo "Coverage failed at ${coverage}%, expected at least 40%" - exit 1 - else - echo "Coverage check passed with ${coverage}%" - fi diff --git a/docs/source/contributing/testing.md b/docs/source/contributing/testing.md index 4a1917365..237d4eaa6 100644 --- a/docs/source/contributing/testing.md +++ b/docs/source/contributing/testing.md @@ -19,16 +19,9 @@ Unit tests verify individual components and functions in isolation. They are fas #### Using the Unit Test Script (Recommended) -The easiest way to run unit tests is using the provided script: +The easiest way to run unit tests is by using the provided script: ```bash -# Activate virtual environment -uv venv .venv --python 3.12 -source .venv/bin/activate - -# Install dependencies -uv pip install -r requirements.txt - # Run all unit tests and generate coverage report PYTHON_VERSION=3.12 ./scripts/unit-tests.sh ```