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 semver checks to CI #974

Closed
Fi3 opened this issue Jun 18, 2024 · 3 comments · Fixed by #985
Closed

Add semver checks to CI #974

Fi3 opened this issue Jun 18, 2024 · 3 comments · Fixed by #985
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed important Needs to be done

Comments

@Fi3
Copy link
Collaborator

Fi3 commented Jun 18, 2024

Given that the number of PR and contributor seems to growth having something like https://crates.io/crates/cargo-semver-checks could be very handy

@Fi3 Fi3 added good first issue Good for newcomers help wanted Extra attention is needed important Needs to be done labels Jun 18, 2024
@Shourya742
Copy link
Contributor

Can I take this up?

@Fi3
Copy link
Collaborator Author

Fi3 commented Jun 18, 2024

Can I take this up?

yep

@Shourya742
Copy link
Contributor

Initial findings ,

I tried running semver for each of our modules, and I encountered some errors.

For roles:

Errors
$ cd roles
$ cargo semver-checks
error: jd_server 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

For Protocol:

Errors
$ cd protocol
$ cargo semver-checks

error[E0463]: can't find crate for `serde`
  --> /home/admin123/stratum/protocols/v2/framing-sv2/src/header.rs:11:17
   |
11 | #[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`
  --> /home/admin123/stratum/protocols/v2/framing-sv2/src/header.rs:11:28
   |
11 | #[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)

For more information about this error, try `rustc --explain E0463`.
error: could not compile `framing_sv2` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error[E0433]: failed to resolve: use of undeclared type `Vec`
   --> /home/admin123/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`
   --> /home/admin123/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
   --> /home/admin123/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>`
    |
   ::: /home/admin123/.rustup/toolchains/1.75.0-x86_64-unknown-linux-gnu/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

-----

error: failed to build rustdoc for crate roles_logic_sv2 v1.1.0
note: this is usually due to a compilation error in the crate,
      and is unlikely to be a bug in cargo-semver-checks
note: the following command can be used to reproduce the compilation error:
      cargo new --lib example &&
          cd example &&
          echo '[workspace]' >> Cargo.toml &&
          cargo add --path /home/admin123/stratum/protocols/v2/roles-logic-sv2 --no-default-features --features disable_nopanic,prop_test,serde,with_serde &&
          cargo check

     Parsing serde_sv2 v1.0.0 (current)
      Parsed [   0.903s] (current)
     Parsing serde_sv2 v1.0.0 (baseline, cached)
      Parsed [   0.058s] (baseline)
    Checking serde_sv2 v1.0.0 -> v1.0.0 (no change)
     Checked [   0.016s] 75 checks; 75 passed, 0 unnecessary
    Finished [   1.002s] serde_sv2
     Parsing sv1_api v1.0.1 (current)
      Parsed [   0.776s] (current)
     Parsing sv1_api v1.0.1 (baseline, cached)
      Parsed [   0.024s] (baseline)
    Checking sv1_api v1.0.1 -> v1.0.1 (no change)
     Checked [   0.023s] 75 checks; 75 passed, 0 unnecessary
    Finished [   0.841s] sv1_api
     Parsing sv2_ffi v1.0.0 (current)
      Parsed [   0.594s] (current)
     Parsing sv2_ffi v1.0.0 (baseline, cached)
      Parsed [   0.983s] (baseline)
    Checking sv2_ffi v1.0.0 -> v1.0.0 (no change)
     Checked [   0.006s] 75 checks; 75 passed, 0 unnecessary
    Finished [   1.611s] sv2_ffi
     Parsing template_distribution_sv2 v1.0.0 (current)
      Parsed [   0.859s] (current)
     Parsing template_distribution_sv2 v1.0.0 (baseline, cached)
      Parsed [   0.022s] (baseline)
    Checking template_distribution_sv2 v1.0.0 -> v1.0.0 (no change)
     Checked [   0.007s] 75 checks; 75 passed, 0 unnecessary
    Finished [   0.900s] template_distribution_sv2
error: aborting due to failure to build rustdoc for crate roles_logic_sv2 v1.1.0

For the rest of the modules, semver is working fine. I'll try to fix these issues and submit a PR as soon as possible.

@pavlenex pavlenex linked a pull request Jun 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed important Needs to be done
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants