|
| 1 | +name: Python CI |
| 2 | + |
| 3 | +concurrency: |
| 4 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 5 | + cancel-in-progress: true |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: [main] |
| 10 | + paths-ignore: |
| 11 | + - "docs/**" |
| 12 | + - "*.md" |
| 13 | + pull_request: |
| 14 | + branches: [main] |
| 15 | + paths-ignore: |
| 16 | + - "docs/**" |
| 17 | + - "*.md" |
| 18 | + workflow_dispatch: |
| 19 | + |
| 20 | +jobs: |
| 21 | + lint-and-type-check: |
| 22 | + name: Lint & Type Check |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + fetch-depth: 0 # Fetch all history for all tags and branches |
| 28 | + |
| 29 | + - name: Set up Python 3.12 |
| 30 | + uses: actions/setup-python@v5 |
| 31 | + with: |
| 32 | + python-version: "3.12" |
| 33 | + |
| 34 | + - name: Install uv |
| 35 | + uses: astral-sh/setup-uv@v6 |
| 36 | + with: |
| 37 | + enable-cache: true |
| 38 | + |
| 39 | + - name: Install the project |
| 40 | + run: uv sync --locked --all-extras --dev |
| 41 | + |
| 42 | + - name: Install tau2 for testing |
| 43 | + run: uv pip install git+https://github.com/sierra-research/tau2-bench.git@main |
| 44 | + |
| 45 | + - name: Lint with flake8 |
| 46 | + run: uv run flake8 eval_protocol tests examples scripts --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics |
| 47 | + |
| 48 | + - name: Type check with mypy |
| 49 | + run: uv run mypy eval_protocol |
| 50 | + |
| 51 | + test-core: |
| 52 | + name: Core Tests (Python ${{ matrix.python-version }}) |
| 53 | + runs-on: ubuntu-latest |
| 54 | + needs: lint-and-type-check |
| 55 | + strategy: |
| 56 | + fail-fast: false |
| 57 | + matrix: |
| 58 | + python-version: ["3.10", "3.11", "3.12"] |
| 59 | + |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + with: |
| 63 | + fetch-depth: 0 # Fetch all history for all tags and branches |
| 64 | + |
| 65 | + - name: Set up Python ${{ matrix.python-version }} |
| 66 | + uses: actions/setup-python@v5 |
| 67 | + with: |
| 68 | + python-version: ${{ matrix.python-version }} |
| 69 | + |
| 70 | + - name: Install uv |
| 71 | + uses: astral-sh/setup-uv@v6 |
| 72 | + with: |
| 73 | + enable-cache: true |
| 74 | + |
| 75 | + - name: Install the project |
| 76 | + run: uv sync --locked --all-extras --dev |
| 77 | + |
| 78 | + - name: Install tau2 for testing |
| 79 | + run: uv pip install git+https://github.com/sierra-research/tau2-bench.git@main |
| 80 | + |
| 81 | + - name: Run Core Tests with pytest-xdist |
| 82 | + env: |
| 83 | + E2B_API_KEY: ${{ secrets.E2B_API_KEY }} |
| 84 | + FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }} |
| 85 | + FIREWORKS_ACCOUNT_ID: ${{ secrets.FIREWORKS_ACCOUNT_ID }} |
| 86 | + PYTHONWARNINGS: "ignore::DeprecationWarning,ignore::RuntimeWarning" |
| 87 | + run: | |
| 88 | + # Run most tests in parallel, but explicitly ignore tests that manage their own servers or are slow |
| 89 | + uv run pytest \ |
| 90 | + -n auto \ |
| 91 | + --ignore=tests/test_batch_evaluation.py \ |
| 92 | + --ignore=tests/pytest/test_frozen_lake.py \ |
| 93 | + --ignore=tests/pytest/test_lunar_lander.py \ |
| 94 | + --ignore=tests/pytest/test_tau_bench_airline.py \ |
| 95 | + --cov=eval_protocol --cov-append --cov-report=xml --cov-report=term-missing -v --durations=10 |
| 96 | +
|
| 97 | + - name: Store coverage file |
| 98 | + uses: actions/upload-artifact@v4 |
| 99 | + with: |
| 100 | + name: coverage-core-${{ matrix.python-version }} |
| 101 | + path: coverage.xml |
| 102 | + retention-days: 1 |
| 103 | + |
| 104 | + test-batch-evaluation: |
| 105 | + name: Batch Evaluation Tests |
| 106 | + runs-on: ubuntu-latest |
| 107 | + needs: lint-and-type-check |
| 108 | + steps: |
| 109 | + - uses: actions/checkout@v4 |
| 110 | + with: |
| 111 | + fetch-depth: 0 # Fetch all history for all tags and branches |
| 112 | + |
| 113 | + - name: Set up Python 3.12 |
| 114 | + uses: actions/setup-python@v5 |
| 115 | + with: |
| 116 | + python-version: "3.12" |
| 117 | + |
| 118 | + - name: Install uv |
| 119 | + uses: astral-sh/setup-uv@v6 |
| 120 | + with: |
| 121 | + enable-cache: true |
| 122 | + |
| 123 | + - name: Install the project |
| 124 | + run: uv sync --locked --all-extras --dev |
| 125 | + |
| 126 | + - name: Install tau2 for testing |
| 127 | + run: uv pip install git+https://github.com/sierra-research/tau2-bench.git@main |
| 128 | + |
| 129 | + - name: Run Batch Evaluation Tests |
| 130 | + env: |
| 131 | + E2B_API_KEY: ${{ secrets.E2B_API_KEY }} |
| 132 | + FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }} |
| 133 | + FIREWORKS_ACCOUNT_ID: ${{ secrets.FIREWORKS_ACCOUNT_ID }} |
| 134 | + PYTHONWARNINGS: "ignore::DeprecationWarning,ignore::RuntimeWarning" |
| 135 | + run: | |
| 136 | + # Run only this specific test file, WITHOUT xdist |
| 137 | + uv run pytest tests/test_batch_evaluation.py --cov=eval_protocol --cov-append --cov-report=xml -v --durations=10 |
| 138 | + - name: Store coverage file |
| 139 | + uses: actions/upload-artifact@v4 |
| 140 | + with: |
| 141 | + name: coverage-batch-eval |
| 142 | + path: coverage.xml |
| 143 | + retention-days: 1 |
| 144 | + |
| 145 | + test-mcp-e2e: |
| 146 | + name: MCP End-to-End Tests |
| 147 | + runs-on: ubuntu-latest |
| 148 | + needs: lint-and-type-check |
| 149 | + steps: |
| 150 | + - uses: actions/checkout@v4 |
| 151 | + with: |
| 152 | + fetch-depth: 0 # Fetch all history for all tags and branches |
| 153 | + - name: Set up Python 3.12 |
| 154 | + uses: actions/setup-python@v5 |
| 155 | + with: |
| 156 | + python-version: "3.12" |
| 157 | + - name: Install uv |
| 158 | + uses: astral-sh/setup-uv@v6 |
| 159 | + with: |
| 160 | + enable-cache: true |
| 161 | + |
| 162 | + - name: Install the project |
| 163 | + run: uv sync --locked --all-extras --dev |
| 164 | + |
| 165 | + - name: Install tau2 for testing |
| 166 | + run: uv pip install git+https://github.com/sierra-research/tau2-bench.git@main |
| 167 | + |
| 168 | + - name: Store coverage file |
| 169 | + uses: actions/upload-artifact@v4 |
| 170 | + with: |
| 171 | + name: coverage-mcp-e2e |
| 172 | + path: coverage.xml |
| 173 | + retention-days: 1 |
| 174 | + |
| 175 | + upload-coverage: |
| 176 | + name: Upload Coverage |
| 177 | + runs-on: ubuntu-latest |
| 178 | + needs: [test-core, test-batch-evaluation, test-mcp-e2e] |
| 179 | + steps: |
| 180 | + - name: Download all coverage artifacts |
| 181 | + uses: actions/download-artifact@v4 |
| 182 | + with: |
| 183 | + path: coverage-artifacts |
| 184 | + - name: Upload coverage to Codecov |
| 185 | + uses: codecov/codecov-action@v3 |
| 186 | + with: |
| 187 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 188 | + directory: ./coverage-artifacts/ |
| 189 | + fail_ci_if_error: false |
| 190 | + verbose: true |
0 commit comments