kornia/kornia-rs

[CI]: Add feature matrix and --all-features test coverage

Aperta

#751 aperta il 24 feb 2026

 (5 commenti) (0 reazioni) (1 assegnatario)Rust (188 fork)auto 404
enhancementhelp wantedtriage

Metriche repository

Star
 (675 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

🚀 Feature Description

Motivation

While #736 ensures cargo check --workspace --all-targets --all-features runs in CI, test coverage across feature configurations is still limited.

Feature-gated code and optional dependencies can compile successfully but remain untested under certain configurations. Over time, this may lead to feature drift or regressions in non-default builds.

Proposal

Extend CI coverage to validate both compilation and test execution across feature combinations:

  1. Add: cargo test --workspace --all-features

  2. Introduce a feature matrix strategy covering:

    • Default features
    • All features
    • Minimal features (--no-default-features)

This ensures:

  • Feature-gated test paths are exercised
  • Optional dependencies remain validated
  • Both minimal and maximal configurations remain healthy

Happy to prepare a focused PR if this direction aligns with project goals.

📂 Feature Category

Rust Core Library

💡 Motivation

Currently, CI validates compilation across all features (via #736), but it does not execute tests across feature combinations.

This creates a potential blind spot where:

  • Feature-gated test code may silently break
  • Optional dependencies may compile but fail at runtime
  • Minimal builds (--no-default-features) may drift over time

Improving CI coverage across feature configurations strengthens reliability and long-term maintainability.

💭 Proposed Solution

Update the existing GitHub Actions workflow to:

  1. Add a dedicated step for: cargo test --workspace --all-features

  2. Introduce a job matrix similar to:

    • default
    • all-features
    • no-default-features

Each job would run: cargo check cargo test

Keeping them as separate CI steps makes failures easier to diagnose and avoids conflating feature-related issues.

📚 Library Reference

This approach follows common Rust CI best practices used in projects such as:

  • tokio
  • serde
  • clap

Many mature Rust crates validate default, minimal, and full feature sets to prevent feature drift and optional dependency breakage.

🔄 Alternatives Considered

An alternative would be to rely solely on cargo check --all-features, but this does not execute test code.

Another option is to selectively test only certain feature combinations; however, a small matrix approach provides stronger guarantees while keeping CI manageable.

🎯 Use Cases

  • Ensuring optional dependencies remain functional.
  • Preventing regressions in --no-default-features builds.
  • Validating feature-gated test modules.
  • Increasing confidence for downstream users integrating kornia-rs in custom configurations.

📝 Additional Context

No response

🤝 Contribution Intent

  • I plan to submit a PR to implement this feature
  • I'm requesting this feature but not planning to implement it

Guida contributor