Skip to content

refactor: extract partial eval dead code #524

refactor: extract partial eval dead code

refactor: extract partial eval dead code #524

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# Run weekly tests every Sunday at 2 AM UTC
- cron: '0 2 * * 0'
workflow_dispatch:
permissions:
contents: read
pull-requests: write
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Fast check: unit tests for quick PR feedback
test:
name: Pytest + Coverage
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.14t"]
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
- name: Cache uv dependencies
uses: actions/cache@v6
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-
- name: Install dependencies
run: uv sync --group dev
- name: Run tests (parallel)
env:
CI: true
PYTHON_GIL: "0"
run: |
uv run pytest -n auto -q --tb=short --dist worksteal
- name: Run tests with reports
if: matrix.python-version == '3.14t'
env:
CI: true
PYTHON_GIL: "0"
run: |
mkdir -p reports
uv run pytest -n 0 -q --tb=short --cov=kida \
--cov-report=xml \
--cov-report=json:reports/coverage.json \
--junitxml=reports/pytest.xml
continue-on-error: true
- name: Get changed files
if: always() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
id: changed
run: |
FILES=$(gh pr diff ${{ github.event.pull_request.number }} --name-only 2>/dev/null | grep '\.py$' || true)
# Build JSON array
JSON=$(echo "$FILES" | python3 -c "import sys,json; print(json.dumps([l.strip() for l in sys.stdin if l.strip()]))")
echo "files=$JSON" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
- name: Render test report
if: always()
uses: ./
with:
template: pytest
data: reports/pytest.xml
data-format: junit-xml
post-to: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && 'step-summary,pr-comment' || 'step-summary' }}
comment-header: CI Report
app-id: ${{ secrets.KIDA_APP_ID }}
app-private-key: ${{ secrets.KIDA_APP_PRIVATE_KEY }}
python-version: skip
install: 'false'
kida-command: uv run kida
continue-on-error: true
- name: Render coverage report
if: always()
uses: ./
with:
template: coverage
data: reports/coverage.json
post-to: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && 'step-summary,pr-comment' || 'step-summary' }}
comment-header: CI Report
comment-mode: append
context: "${{ steps.changed.outputs.files && format('{0}{1}{2}', '{\"changed_files\": ', steps.changed.outputs.files, '}') || '' }}"
app-id: ${{ secrets.KIDA_APP_ID }}
app-private-key: ${{ secrets.KIDA_APP_PRIVATE_KEY }}
python-version: skip
install: 'false'
kida-command: uv run kida
continue-on-error: true
- name: Upload coverage to Codecov
if: matrix.python-version == '3.14t'
uses: codecov/codecov-action@v7
with:
files: coverage.xml
fail_ci_if_error: false
# Type checking
typecheck:
name: Type Check (ty)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.14t"
- name: Cache uv dependencies
uses: actions/cache@v6
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-
- name: Install dependencies
run: uv sync --group dev
- name: Run ty
run: |
uv run ty check src/kida
- name: Run ty (report)
if: always()
run: |
mkdir -p reports
uv run ty check src/kida --output-format junit > reports/ty.xml || true
- name: Render ty report
if: always()
uses: ./
with:
template: ty
data: reports/ty.xml
data-format: junit-xml
post-to: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && 'step-summary,pr-comment' || 'step-summary' }}
comment-header: CI Report
comment-mode: append
app-id: ${{ secrets.KIDA_APP_ID }}
app-private-key: ${{ secrets.KIDA_APP_PRIVATE_KEY }}
python-version: skip
install: 'false'
kida-command: uv run kida
continue-on-error: true
# Linting
lint:
name: Lint (ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.14t"
- name: Cache uv dependencies
uses: actions/cache@v6
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-
- name: Install dependencies
run: uv sync --group dev
- name: Run ruff check
run: |
uv run ruff check .
- name: Run ruff (report)
if: always()
run: |
mkdir -p reports
uv run ruff check . \
--output-format json > reports/ruff.json || true
- name: Render ruff report
if: always()
uses: ./
with:
template: ruff
data: reports/ruff.json
post-to: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && 'step-summary,pr-comment' || 'step-summary' }}
comment-header: CI Report
comment-mode: append
app-id: ${{ secrets.KIDA_APP_ID }}
app-private-key: ${{ secrets.KIDA_APP_PRIVATE_KEY }}
python-version: skip
install: 'false'
kida-command: uv run kida
continue-on-error: true
- name: Run ruff format check
run: |
uv run ruff format --check .
# Thread safety tests
thread-safety:
name: Thread Safety
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.14t"
- name: Cache uv dependencies
uses: actions/cache@v6
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-
- name: Install dependencies
run: uv sync --group dev
- name: Run thread safety tests
env:
CI: true
PYTHON_GIL: "0"
run: |
uv run pytest tests/test_kida_stress_test.py tests/test_lru_cache_concurrency.py tests/test_bytecode_cache_concurrency.py -v --tb=short --timeout=120
# Async tests
async-tests:
name: Async Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.14t"
- name: Cache uv dependencies
uses: actions/cache@v6
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-
- name: Install dependencies
run: uv sync --group dev
- name: Run async tests
env:
CI: true
PYTHON_GIL: "0"
run: |
uv run pytest tests/test_kida_async_features.py -v --tb=short --timeout=120
# Slow/comprehensive tests (weekly/manual only)
slow-tests:
name: Full Test Suite
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.14t"
- name: Cache uv dependencies
uses: actions/cache@v6
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-
- name: Install dependencies
run: uv sync --group dev
- name: Run all tests with full coverage
env:
CI: true
PYTHON_GIL: "0"
run: |
uv run pytest -v --tb=short --cov=kida --cov-report=term-missing --timeout=300
# Benchmark regression check (runs on PR and main; fails if >threshold slower than baseline)
benchmark-regression:
name: Benchmark Regression
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.14t"
- name: Cache uv dependencies
uses: actions/cache@v6
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-
- name: Install dependencies
run: uv sync --group dev
- name: Run benchmark regression check
env:
CI: true
BENCHMARK_SUITE: core
PYTHON_GIL: "0"
run: |
export PATH="$PWD/.venv/bin:$PATH"
./scripts/benchmark_compare.sh
# Full benchmark suite (weekly/manual only; uploads results)
benchmarks:
name: Full Benchmarks
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.14t"
- name: Cache uv dependencies
uses: actions/cache@v6
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-
- name: Install dependencies
run: uv sync --group dev
- name: Run benchmarks
run: |
uv run pytest benchmarks/ --benchmark-only --benchmark-json=benchmark-results.json -q
- name: Upload benchmark results
uses: actions/upload-artifact@v7
with:
name: benchmark-results-${{ github.sha }}
path: benchmark-results.json