Skip to content

Implement Output Size Limits for MCP Server Responses #126

Implement Output Size Limits for MCP Server Responses

Implement Output Size Limits for MCP Server Responses #126

Workflow file for this run

name: PR Checks
on:
pull_request:
branches: [ main ]
# Allow manual triggering for testing
workflow_dispatch:
jobs:
lint:
name: Lint and Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
allow-prereleases: true
- name: Install UV
run: |
pip install uv
uv --version
- name: Setup environment
run: |
# UV will automatically create and manage the virtual environment
# Just sync the project dependencies
uv sync --extra dev
- name: Run linting
run: uv run ruff check .
- name: Run formatting check
run: uv run ruff format --check .
- name: Run type checking
run: uv run mypy src
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
# Run in parallel with lint (both are fast)
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
allow-prereleases: true
- name: Install UV
run: |
pip install uv
uv --version
- name: Setup environment
run: |
# UV will automatically create and manage the virtual environment
# Just sync the project dependencies
uv sync --extra dev
- name: Run unit tests with coverage
run: uv run pytest tests/unit/ --cov=src --cov-report=xml:coverage-unit.xml --cov-report=term -v
- name: Upload unit test coverage to artifact
uses: actions/upload-artifact@v4
with:
name: coverage-unit
path: coverage-unit.xml
e2e-fast-tests:
name: E2E Tests (Direct Tool Integration)
runs-on: ubuntu-latest
# Run in parallel with lint and unit tests (fast feedback)
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
allow-prereleases: true
- name: Install UV
run: |
pip install uv
uv --version
- name: Setup environment
run: |
# UV will automatically create and manage the virtual environment
# Just sync the project dependencies
uv sync --extra dev
- name: Install sbctl
run: |
mkdir -p /tmp/sbctl && cd /tmp/sbctl
curl -L -o sbctl.tar.gz "https://github.com/replicatedhq/sbctl/releases/latest/download/sbctl_linux_amd64.tar.gz"
tar xzf sbctl.tar.gz
chmod +x sbctl
sudo mv sbctl /usr/local/bin/
cd / && rm -rf /tmp/sbctl
sbctl --help
- name: Run fast E2E tests (direct tool integration)
run: uv run pytest tests/e2e/test_direct_tool_integration.py -v
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
needs: [lint, unit-tests, e2e-fast-tests] # Run only after fast tests pass
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
allow-prereleases: true
- name: Install UV
run: |
pip install uv
uv --version
- name: Setup environment
run: |
# UV will automatically create and manage the virtual environment
# Just sync the project dependencies
uv sync --extra dev
- name: Install sbctl
run: |
# Install sbctl binary for integration tests
mkdir -p /tmp/sbctl && cd /tmp/sbctl
curl -L -o sbctl.tar.gz "https://github.com/replicatedhq/sbctl/releases/latest/download/sbctl_linux_amd64.tar.gz"
tar xzf sbctl.tar.gz
chmod +x sbctl
sudo mv sbctl /usr/local/bin/
cd / && rm -rf /tmp/sbctl
sbctl --help
- name: Run integration tests with coverage
run: uv run pytest tests/integration/ --cov=src --cov-report=xml:coverage-integration.xml --cov-report=term -v
- name: Upload integration test coverage to artifact
uses: actions/upload-artifact@v4
with:
name: coverage-integration
path: coverage-integration.xml
coverage-report:
name: Coverage Report
runs-on: ubuntu-latest
needs: [lint, unit-tests, integration-tests]
if: always() && needs.lint.result == 'success' && needs.unit-tests.result == 'success' && needs.integration-tests.result == 'success'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
allow-prereleases: true
- name: Install UV
run: |
pip install uv
uv --version
- name: Setup environment
run: |
# UV will automatically create and manage the virtual environment
# Just sync the project dependencies
uv sync --extra dev
- name: Download unit test coverage
uses: actions/download-artifact@v4
with:
name: coverage-unit
path: ./
continue-on-error: true
- name: Download integration test coverage
uses: actions/download-artifact@v4
with:
name: coverage-integration
path: ./
continue-on-error: true
- name: Combine coverage reports
run: |
# Install coverage for combining reports
uv pip install coverage
# Combine coverage data if both files exist
if [ -f coverage-unit.xml ] && [ -f coverage-integration.xml ]; then
echo "Combining coverage from unit and integration tests"
uv run coverage combine || true
uv run coverage xml -o coverage-combined.xml || true
# Use combined coverage if successful, otherwise use unit coverage
if [ -f coverage-combined.xml ]; then
cp coverage-combined.xml coverage.xml
else
cp coverage-unit.xml coverage.xml
fi
elif [ -f coverage-unit.xml ]; then
echo "Using unit test coverage only"
cp coverage-unit.xml coverage.xml
elif [ -f coverage-integration.xml ]; then
echo "Using integration test coverage only"
cp coverage-integration.xml coverage.xml
else
echo "No coverage files found"
exit 1
fi
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false
verbose: true
container-tests:
name: Container Tests (Slow)
runs-on: ubuntu-latest
needs: [lint, unit-tests, e2e-fast-tests] # Run only after fast tests pass
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
allow-prereleases: true
- name: Install UV
run: |
pip install uv
uv --version
- name: Setup environment
run: |
# UV will automatically create and manage the virtual environment
# Just sync the project dependencies
uv sync --extra dev
- name: Install sbctl
run: |
mkdir -p /tmp/sbctl && cd /tmp/sbctl
curl -L -o sbctl.tar.gz "https://github.com/replicatedhq/sbctl/releases/latest/download/sbctl_linux_amd64.tar.gz"
tar xzf sbctl.tar.gz
chmod +x sbctl
sudo mv sbctl /usr/local/bin/
cd / && rm -rf /tmp/sbctl
sbctl --help
- name: Check Podman version
run: podman --version
- name: Verify melange/apko availability via containers
run: |
# Test that melange and apko work via containers (as used in our build system)
# We run them in containers rather than installing binaries directly
podman run --rm cgr.dev/chainguard/melange:latest version
podman run --rm cgr.dev/chainguard/apko:latest version
- name: Set file permissions
run: |
chmod +x scripts/build.sh
chmod +x scripts/run.sh
chmod +x scripts/run_tests.sh
chmod +x scripts/setup_env.sh
chmod +x scripts/generate_test_keys.sh
- name: Verify melange and apko configs exist
run: |
if [ ! -f .melange.yaml ]; then
echo "ERROR: .melange.yaml not found"
exit 1
fi
if [ ! -f apko.yaml ]; then
echo "ERROR: apko.yaml not found"
exit 1
fi
echo "Configuration files found:"
ls -la .melange.yaml apko.yaml
- name: Run container tests (melange/apko)
env:
MELANGE_TEST_BUILD: "true"
run: uv run pytest tests/e2e/ -m container -v