obi1kenobi / cargo-semver-checks

Scan your Rust crate for semver violations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom registry does not seem supported

nbigaouette opened this issue · comments

Describe your use case

I'd like to integrate cargo-semver-check workflow into CI at work where we use a custom crate registry to (internally) publish our crates.

Unfortunately, cargo-semver-check fails to run on a crate that is published on the custom registry:

❯ cargo semver-checks check-release --verbose
    Updating index
     Parsing mycrate v0.1.0 (current)
 Documenting mycrate v0.1.0 (~/mycrate.git)
    Finished dev [unoptimized + debuginfo] target(s) in 0.96s
Error: mycrate not found in registry

I suspect this is because it is not aware of the crate registry when trying to download the crate.

Describe the solution you'd like

cargo-semver-check should fetch the published package from the crate registry it has been published previously.

In my case, this information is located in the repo's .cargo/config, but I think that info can also be located elsewhere.

Alternatives, if applicable

No response

Additional Context

No response

Thanks for the detailed report!

I think we both want to add custom registry support, and in the meantime also provide a better, more actionable error message than the current one.

While the registry-based previous version lookup won't work with a custom registry, you should be able to use one of the other ways to tell cargo-semver-checks about the previous version to compare against. Excerpt from cargo semver-checks check-release --help:

      --baseline-rev <REV>
          Git revision to lookup for a baseline

      --baseline-root <MANIFEST_ROOT>
          Directory containing baseline crate source

      --baseline-rustdoc <JSON_PATH>
          The rustdoc json file to use as a semver baseline

I think all of those should be unaffected by the custom registry setup, and should able to unblock your current use case today. Please let us know if that works!

I'm adding an entry to the FAQ about using the other baseline generation options for custom registries until this issue is resolved: #165

Thanks for the explanation! I've followed the FAQ which was straight to the point, used --baseline-rev to make the check and everything works as expected.

Thanks again!