Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cargo semver-checks to CI #781

Open
plebhash opened this issue Mar 4, 2024 · 3 comments
Open

add cargo semver-checks to CI #781

plebhash opened this issue Mar 4, 2024 · 3 comments
Labels
test Test related

Comments

@plebhash
Copy link
Collaborator

plebhash commented Mar 4, 2024

As suggested by @Fi3 here: #766 (comment)

I would add something to automatically check the we do not mess with semver (it is very easy to think that something do not change the API but it change it). I found this linter https://crates.io/crates/cargo-semver-checks that we could add to our actions. That ofc do not remove the needs for human reviews is just an helper.

@plebhash
Copy link
Collaborator Author

plebhash commented Mar 4, 2024

I'm trying to run it manually before I automate it into a Github Action. There are some issues, however:

$ cd protocols
$ cargo semver-checks
 ...
   Completed [   0.027s] 55 checks; 55 passed, 0 unnecessary
Error: running cargo-doc failed on /Users/plebhash/develop/stratum/protocols/target/semver-checks/local-roles_logic_sv2-0_1_1/Cargo.toml:
   ...
error[E0463]: can't find crate for `serde`
  --> /Users/plebhash/develop/stratum/protocols/v2/framing-sv2/src/header.rs:10:17
   |
10 | #[derive(Debug, Serialize, Deserialize, Copy, Clone)]
   |                 ^^^^^^^^^ can't find crate
   |
   = note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0463]: can't find crate for `serde`
  --> /Users/plebhash/develop/stratum/protocols/v2/framing-sv2/src/header.rs:10:28
   |
10 | #[derive(Debug, Serialize, Deserialize, Copy, Clone)]
   |                            ^^^^^^^^^^^ can't find crate
   |
   = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: unused import: `alloc::vec::Vec`
 --> /Users/plebhash/develop/stratum/protocols/v2/framing-sv2/src/header.rs:3:5
  |
3 | use alloc::vec::Vec;
  |     ^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `binary_sv2::binary_codec_sv2`
 --> /Users/plebhash/develop/stratum/protocols/v2/framing-sv2/src/header.rs:5:5
  |
5 | use binary_sv2::binary_codec_sv2;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0463`.
warning: `framing_sv2` (lib) generated 2 warnings
error: could not compile `framing_sv2` (lib) due to 2 previous errors; 2 warnings emitted
warning: build failed, waiting for other jobs to finish...
error[E0433]: failed to resolve: use of undeclared type `Vec`
   --> /Users/plebhash/develop/stratum/protocols/v2/subprotocols/template-distribution/src/new_template.rs:199:28
    |
199 |             let mut path = Vec::new();
    |                            ^^^ use of undeclared type `Vec`
    |
help: consider importing one of these items
    |
7   + use alloc::vec::Vec;
    |
7   + use crate::vec::Vec;
    |
7   + use serde::__private::Vec;
    |

error[E0433]: failed to resolve: use of undeclared type `Vec`
   --> /Users/plebhash/develop/stratum/protocols/v2/subprotocols/template-distribution/src/new_template.rs:220:34
    |
220 |             coinbase_tx_outputs: Vec::new().try_into().unwrap(),
    |                                  ^^^ use of undeclared type `Vec`
    |
help: consider importing one of these items
    |
7   + use alloc::vec::Vec;
    |
7   + use crate::vec::Vec;
    |
7   + use serde::__private::Vec;
    |

error[E0599]: no method named `try_into` found for struct `Vec<u8>` in the current scope
   --> /Users/plebhash/develop/stratum/protocols/v2/subprotocols/template-distribution/src/new_template.rs:185:66
    |
185 |         let coinbase_prefix: binary_sv2::B0255 = coinbase_prefix.try_into().unwrap();
    |                                                                  ^^^^^^^^ method not found in `Vec<u8>`
    |
   ::: /Users/plebhash/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/convert/mod.rs:610:8
    |
610 |     fn try_into(self) -> Result<T, Self::Error>;
    |        -------- the method is available for `Vec<u8>` here
    |
    = help: items from traits can only be used if the trait is in scope
    = note: 'core::convert::TryInto' is included in the prelude starting in Edition 2021
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
1   + use core::convert::TryInto;
    |

Some errors have detailed explanations: E0433, E0599.
For more information about an error, try `rustc --explain E0433`.
error: could not compile `template_distribution_sv2` (lib) due to 3 previous errors

@plebhash
Copy link
Collaborator Author

plebhash commented Mar 4, 2024

$ cd roles
$ cargo semver-checks
     Parsing jd_client v0.1.0 (current)
     Parsing jd_server v0.1.0 (current)
     Parsing jsonrpc v0.16.0 (current)
     Parsing jsonrpc v0.16.0 (baseline)
    Checking jsonrpc v0.16.0 -> v0.16.0 (no change)
   Completed [   0.023s] 55 checks; 50 passed, 5 failed, 0 unnecessary

--- failure enum_missing: pub enum removed or renamed ---

Description:
A publicly-visible enum cannot be imported by its prior path. A `pub use` may have been removed, or the enum itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.26.0/src/lints/enum_missing.ron

Failed in:
  enum jsonrpc::simple_tcp::Error, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/simple_tcp.rs:64
  enum jsonrpc::minreq_http::Error, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/minreq_http.rs:195
  enum jsonrpc::http::minreq_http::Error, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/minreq_http.rs:195
  enum jsonrpc::simple_uds::Error, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/simple_uds.rs:64

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.26.0/src/lints/inherent_method_missing.ron

Failed in:
  Client::http_proxy, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/simple_http.rs:436
  Client::http_proxy, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/simple_http.rs:436
  Builder::proxy_addr, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/simple_http.rs:394
  Builder::proxy_auth, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/simple_http.rs:402
  Builder::proxy_addr, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/simple_http.rs:394
  Builder::proxy_auth, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/simple_http.rs:402

--- failure module_missing: pub module removed or renamed ---

Description:
A publicly-visible module cannot be imported by its prior path. A `pub use` may have been removed, or the module may have been renamed, removed, or made non-public.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.26.0/src/lints/module_missing.ron

Failed in:
  mod jsonrpc::simple_tcp, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/simple_tcp.rs:3
  mod jsonrpc::simple_uds, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/simple_uds.rs:3
  mod jsonrpc::minreq_http, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/minreq_http.rs:1
  mod jsonrpc::http::minreq_http, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/minreq_http.rs:1

--- failure pub_module_level_const_missing: pub module-level const is missing ---

Description:
A public const is missing, renamed, or changed from const to static.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.26.0/src/lints/pub_module_level_const_missing.ron

Failed in:
  DEFAULT_PROXY_PORT in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/mod.rs:17

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.26.0/src/lints/struct_missing.ron

Failed in:
  struct jsonrpc::simple_tcp::TcpTransport, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/simple_tcp.rs:13
  struct jsonrpc::minreq_http::MinreqHttpTransport, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/minreq_http.rs:25
  struct jsonrpc::http::minreq_http::MinreqHttpTransport, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/minreq_http.rs:25
  struct jsonrpc::simple_uds::UdsTransport, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/simple_uds.rs:13
  struct jsonrpc::minreq_http::HttpError, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/minreq_http.rs:175
  struct jsonrpc::http::minreq_http::HttpError, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/minreq_http.rs:175
  struct jsonrpc::minreq_http::Builder, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/minreq_http.rs:105
  struct jsonrpc::http::minreq_http::Builder, previously in file /Users/plebhash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpc-0.16.0/src/http/minreq_http.rs:105
       Final [   0.024s] semver requires new major version: 5 major and 0 minor checks failed
     Parsing mining_proxy_sv2 v0.1.0 (current)
     Parsing pool_sv2 v0.1.0 (current)
     Parsing translator_sv2 v0.1.0 (current)
Error: jd_client not found in registry (crates.io). For workarounds check https://github.com/obi1kenobi/cargo-semver-checks#does-the-crate-im-checking-have-to-be-published-on-cratesio

@plebhash
Copy link
Collaborator Author

plebhash commented Mar 4, 2024

$ cd utils
$ cargo semver-checks
...
   Completed [   0.012s] 55 checks; 55 passed, 0 unnecessary
Error: bip32_derivation not found in registry (crates.io). For workarounds check https://github.com/obi1kenobi/cargo-semver-checks#does-the-crate-im-checking-have-to-be-published-on-cratesio

@pavlenex pavlenex added the test Test related label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Test related
Projects
None yet
Development

No branches or pull requests

2 participants