Skip to content

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

ci: build rust extension via maturin before pytest

chopratejas7c3516aad5a6
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ce8294c04..40ed3fe3b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -36,6 +36,29 @@ jobs:
python -m pip install --upgrade pip
pip install -e ".[dev]"
+ # `headroom.transforms.diff_compressor` is now a thin pyo3 shim that
+ # delegates to `headroom._core` (built from `crates/headroom-py`). Without
+ # the wheel installed, every `DiffCompressor()` call raises
+ # `ModuleNotFoundError: No module named 'headroom._core'` and ~25 tests
+ # in `tests/test_transforms/test_diff_compressor.py` fail. The script
+ # below runs `maturin develop` and symlinks the built `.so` into the
+ # in-tree `headroom/` package so the editable install resolves it.
+ - name: Install Rust toolchain
+ uses: dtolnay/rust-toolchain@stable
+
+ - name: Cache cargo registry + build
+ uses: Swatinem/rust-cache@v2
+ with:
+ workspaces: ". -> target"
+
+ - name: Install maturin
+ run: |
+ pip install 'maturin>=1.5,<2.0'
+
+ - name: Build Rust extension (headroom._core)
+ run: |
+ bash scripts/build_rust_extension.sh
+
- name: Run linting
if: matrix.python-version == '3.12'
run: |
@@ -180,11 +203,11 @@ jobs:
with:
python-version: "3.11"
- - name: Install bash and test dependencies
- run: |
- brew install bash
- python -m pip install --upgrade pip
- python -m pip install --retries 10 --timeout 60 pytest
+ - name: Install bash and test dependencies
+ run: |
+ brew install bash
+ python -m pip install --upgrade pip
+ python -m pip install --retries 10 --timeout 60 pytest
- name: Run native installer wrapper tests
run: |