Skip to content

Merge pull request #9 from Cellular-Semantics/Project_management_batc… #38

Merge pull request #9 from Cellular-Semantics/Project_management_batc…

Merge pull request #9 from Cellular-Semantics/Project_management_batc… #38

Workflow file for this run

name: Tests
on:
push:
branches:
- main
pull_request:
permissions:
contents: write
env:
UV_SYSTEM_PYTHON: "1"
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Install ruff
run: uv tool install ruff
- name: Sync dependencies
run: uv sync --dev
- name: Ruff lint
run: uv tool run ruff check src/ tests/ || echo "⚠️ Ruff linting found issues (not blocking CI)"
- name: Ruff format (check only)
run: uv tool run ruff format --check src/ tests/
- name: Install missing type stubs
run: uv run mypy --install-types --non-interactive || echo "Type stubs installation attempted"
- name: Type check
run: uv run mypy src/ || echo "⚠️ MyPy found type issues (not blocking CI)"
- name: Unit tests
run: |
PYTHONPATH=src uv run pytest tests/unit/ -v --tb=short
- name: Integration tests (skipped in CI)
run: |
echo "Integration tests require real API keys; run locally before pushing."
echo "Use: PYTHONPATH=src uv run pytest tests/integration/ -m integration"
- name: Coverage report (Python 3.11 only)
if: matrix.python-version == '3.11'
run: |
PYTHONPATH=src uv run pytest tests/unit/ --cov=langpa --cov-report=xml --cov-report=term
- name: Generate Coverage Badge
if: matrix.python-version == '3.11' && github.ref == 'refs/heads/main'
uses: tj-actions/coverage-badge-py@v2
with:
coverage-path: coverage.xml
output: .github/badges/coverage.svg
- name: Commit Coverage Badge
if: matrix.python-version == '3.11' && github.ref == 'refs/heads/main'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
mkdir -p .github/badges
git add .github/badges/coverage.svg
git diff --staged --quiet || git commit -m "Update coverage badge [skip ci]"
git push
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Sync dependencies
run: uv sync --dev
- name: Check documentation build
run: |
if [ -d "docs" ]; then
# Check if sphinx is available
if uv run python -c "import sphinx" 2>/dev/null; then
cd docs && uv run sphinx-build . _build/html -W
echo "✅ Documentation built successfully"
else
echo "⚠️ Sphinx not available, checking basic Python imports instead"
uv run python -c "import sys; sys.path.insert(0, 'src'); import langpa"
echo "✅ Package imports successfully"
fi
else
echo "No docs directory found, skipping documentation build"
fi