forked from phoenix-oss/llama-stack-mirror
# What does this PR do? When multiple commits are pushed to a PR, multiple CI builds will be triggered. This PR ensures that we only run one concurrent build for each PR to reduce CI loads. Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
59 lines
1.5 KiB
YAML
59 lines
1.5 KiB
YAML
name: Unit Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
paths:
|
|
- 'distributions/**'
|
|
- 'llama_stack/**'
|
|
- 'tests/unit/**'
|
|
- 'uv.lock'
|
|
- 'pyproject.toml'
|
|
- 'requirements.txt'
|
|
- '.github/workflows/unit-tests.yml' # This workflow
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
unit-tests:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python:
|
|
- "3.10"
|
|
- "3.11"
|
|
- "3.12"
|
|
- "3.13"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python ${{ matrix.python }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python }}
|
|
|
|
- uses: astral-sh/setup-uv@v5
|
|
with:
|
|
python-version: ${{ matrix.python }}
|
|
enable-cache: false
|
|
|
|
- name: Run unit tests
|
|
run: |
|
|
PYTHON_VERSION=${{ matrix.python }} ./scripts/unit-tests.sh --cov=llama_stack --junitxml=pytest-report-${{ matrix.python }}.xml --cov-report=html:htmlcov-${{ matrix.python }}
|
|
|
|
- name: Upload test results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: test-results-${{ matrix.python }}
|
|
path: |
|
|
.pytest_cache/
|
|
pytest-report-${{ matrix.python }}.xml
|
|
htmlcov-${{ matrix.python }}/
|
|
retention-days: 7
|