Skip to main content

ci-test-gate

CI codecov

LLM-powered test selection for CI — run only the tests that matter.

Tired of waiting 30+ minutes for CI when your change touches one file? ci-test-gate analyzes your PR diff and recommends which tests to run, skip, or require.

pip install git+https://github.com/yunaremaia/ci-test-gate.git
ci-test-gate suggest --diff pr.diff --test-files tests.txt

How it works

┌──────────────────────────────────────────────────┐
│                    GitHub PR                      │
│                     │                             │
│         git diff main...HEAD                     │
│                     │                             │
│                     ▼                             │
│  ┌────────────────────────────────────────────┐  │
│  │           ci-test-gate engine              │  │
│  │                                            │  │
│  │  1. Parse diff into structured changes     │  │
│  │  2. Build context (imports, functions)     │  │
│  │  3. Classify tests (required/recommended/  │  │
│  │     optional)                              │  │
│  │  4. Output recommendation (JSON/Markdown) │  │
│  └────────────────────────────────────────────┘  │
└──────────────────────────────────────────────────┘

Why?

  • Save CI minutes — skip irrelevant tests
  • Faster feedback — required tests run first
  • Risk-aware — conservative by default
  • Multi-language — Python, JS/TS, Go, Rust

See docs/LANGUAGES.md for language-specific test pattern documentation.

Modes

  • suggest — Comment on PR with recommendations
  • gate — Block merge if required tests didn't run
  • local — Run before push to catch issues early

LLM Classification

ci-test-gate supports LLM-powered semantic classification in addition to the built-in heuristic engine. When enabled, it sends the diff context to an OpenAI-compatible API and lets the model reason about which tests are most likely affected.

Enabling LLM mode

Pass --llm to the suggest or local command:

ci-test-gate suggest --diff pr.diff --test-files tests.txt --llm

Configuration

CLI flag Environment variable Default Description
--llm — off Enable LLM classification
--llm-api-key OPENAI_API_KEY — API key for the OpenAI-compatible endpoint
--llm-model CI_TEST_GATE_MODEL gpt-4o-mini Model to use
— OPENAI_BASE_URL OpenAI production Base URL (for local/alternative endpoints)

CLI flags take precedence over environment variables.

Example — using a custom model

export OPENAI_API_KEY="sk-..."
ci-test-gate suggest \
  --diff pr.diff \
  --test-files tests.txt \
  --llm \
  --llm-model gpt-4o \
  --output json

Fallback behaviour

If no API key is configured, or if the LLM call fails for any reason (network error, rate limit, malformed response), ci-test-gate automatically falls back to the heuristic classifier so your CI pipeline is never blocked.


Roadmap

  • LLM semantic classification (v0.2.0)
  • Gate mode enforcement (v0.2.0)
  • Dashboard with savings metrics (v0.4.0)

License

MIT

Contributing

We welcome contributions! Please see CONTRIBUTING.md for development setup, testing guidelines, and how to add a new classifier.

Metadata

Release files for ci-test-gate 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ci-test-gate 0.1.0
File Size Uploaded
ci_test_gate-0.1.0.tar.gz 29.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ci-test-gate 0.1.0
File Interpreter ABI Platform
ci_test_gate-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.2 kB

Release files / ci_test_gate-0.1.0.tar.gz

Download URL ci_test_gate-0.1.0.tar.gz
Size 29.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b65b387fd9a6145acebf8eb644c3e08ae804adcbdf71794d9bd52d93a8870145
BLAKE2b-256 checksum
How to use checksums
e778d782c0eac063361602a281f19b13d7c8b9261cde9cbdb32b70b275a733c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / ci_test_gate-0.1.0-py3-none-any.whl

Download URL ci_test_gate-0.1.0-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1538f1158a1bf133058b2f3439d8a84543569d57f5eceb52121b0e4f45e1c81b
BLAKE2b-256 checksum
How to use checksums
e85b114a5b5300f76cfb0bdd85014c1f17ff2fdc5ca399c3b69f5cb0c5554c2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page