feat: Add GitHub Actions caching optimizations #5
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lint-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: 'pip' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Cache virtual environment | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| venv-${{ runner.os }}- | |
| - name: Create virtual environment | |
| run: uv venv | |
| - name: Install dependencies | |
| run: uv pip install -e ".[dev]" | |
| - name: Prune uv cache for CI | |
| run: uv cache prune --ci | |
| - name: Run ruff (lint and format check) | |
| run: | | |
| uv run ruff check . | |
| uv run ruff format --check . | |
| # TODO: Enable mypy once type annotations are complete | |
| # - name: Run mypy (type checking) | |
| # run: uv run mypy src/mcp_acp | |
| - name: Run tests with coverage | |
| run: uv run pytest tests/ --cov=src/mcp_acp --cov-report=xml --cov-report=term | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.xml | |
| fail_ci_if_error: false |