Merge branch 'main' of https://github.com/Cellular-Semantics/langpa #46
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: 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: Sync dependencies | |
| run: uv sync --dev | |
| - 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 |