chore: bump version to 0.2.1 #55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- '*.py' | |
- 'pyproject.toml' | |
- 'uv.lock' | |
- '.github/workflows/test.yml' | |
pull_request: | |
workflow_dispatch: | |
env: | |
# enable colored output | |
PY_COLORS: 1 | |
permissions: | |
contents: read | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- name: Set up uv | |
uses: astral-sh/setup-uv@v6 | |
with: | |
version: "latest" | |
enable-cache: true | |
python-version: ${{ matrix.python-version }} | |
cache-dependency-glob: | | |
uv.lock | |
pyproject.toml | |
- name: Lock dependencies for current matrix | |
run: uv lock | |
- name: Install dependencies | |
run: uv sync --locked | |
- name: Run unit tests | |
run: uv run pytest -m "not integration" -v --cov=src --cov-append --cov-report=term-missing | |
env: | |
MODELSCOPE_API_TOKEN: ${{ secrets.MODELSCOPE_API_TOKEN }} | |
- name: Run integration tests (fast) | |
run: uv run pytest -m "integration and not slow" -v --cov=src --cov-append --cov-report=term-missing | |
env: | |
MODELSCOPE_API_TOKEN: ${{ secrets.MODELSCOPE_API_TOKEN }} | |
- name: Run integration tests (slow) | |
run: uv run pytest -m "integration and slow" -v -s --cov=src --cov-append --cov-report=term-missing | |
if: matrix.python-version == '3.12' # Only run once to reduce costs | |
env: | |
MODELSCOPE_API_TOKEN: ${{ secrets.MODELSCOPE_API_TOKEN }} | |
- name: Generate coverage report | |
run: | | |
echo "📊 Generating final coverage report..." | |
uv run coverage html | |
echo "📋 Coverage Summary:" | |
uv run coverage report | |
- name: Upload coverage reports | |
uses: actions/upload-artifact@v4 | |
if: matrix.python-version == '3.12' # Only upload once to avoid duplicates | |
with: | |
name: coverage-report-${{ matrix.python-version }} | |
path: htmlcov/ | |
retention-days: 30 | |
- name: Display coverage summary | |
if: matrix.python-version == '3.12' # Only show summary once | |
run: | | |
echo "## 📊 Coverage Report" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
uv run coverage report --format=markdown >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "📁 **Download detailed HTML report from Artifacts section below**" >> $GITHUB_STEP_SUMMARY | |
- name: Optimize uv cache for CI | |
run: uv cache prune --ci |