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

fix: build workflow #2434

Open
wants to merge 16 commits into
base: fix/xcode16-build
Choose a base branch
from
Open

fix: build workflow #2434

wants to merge 16 commits into from

Conversation

stepanLav
Copy link
Member

@stepanLav stepanLav commented Feb 11, 2025

Changes in this PR

Dependencies Updates

  • Fixed Parity libraries version to tag "monthly-2023-05" due to repository archival
  • Updated OpenCV to version 0.93 (tried on older version up to 0.83, but can't be built)
  • Updated deny crate version as the older version couldn't be configured correctly

Code Quality Improvements

  • Fixed Rust Clippy warnings across the codebase
  • Fixed code formatting issues

CI/CD

  • Made some improvements to GitHub Actions workflow files

Technical Details

  • Implemented different interfaces for cvt_color on Linux/macOS platforms due to errors, described it in the code comment
  • All Clippy warnings have been addressed with corresponding fixes

Semantic fix moved to separate PR:

@stepanLav stepanLav force-pushed the fix/ci_build branch 2 times, most recently from 575484f to 030f2f1 Compare February 12, 2025 09:02
fix token usage

fix: return events back

fix: dependencies

update list of deny

rollback rust

fix: try to use particullar version

return stable back

fix: add test default

fix tiny

disable cache

disable cache

fix: qr reader phone

fix: qr_reader

use target_os

fix: cargo clippy

fix: fmt

fix: remove semantic changes

fix: remove semantic changes
fix: clippy

fix: clippy

fix: clippy

fix: clippy
fix: ations
@@ -173,7 +173,7 @@ pub fn convert_wasm_into_metadata(filename: &str) -> Result<Vec<u8>> {
let runtime_blob = RuntimeBlob::uncompress_if_needed(&buffer).map_err(Wasm::WasmError)?;
let wasmi_runtime = create_runtime(
runtime_blob,
64,
sc_executor_common::wasm_runtime::HeapAllocStrategy::Static { extra_pages: 64 },
Copy link
Member Author

@stepanLav stepanLav Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mismatched types:

   Compiling definitions v0.1.0 (/workspaces/parity-signer/rust/definitions)
error[E0308]: mismatched types
   --> definitions/src/metadata.rs:176:9
    |
174 |     let wasmi_runtime = create_runtime(
    |                         -------------- arguments to this function are incorrect
175 |         runtime_blob,
176 |         64,
    |         ^^ expected `HeapAllocStrategy`, found integer
    |
note: function defined here
   --> /root/.cargo/git/checkouts/substrate-7e08433d4c370a21/bc8f2db/client/executor/wasmi/src/lib.rs:468:8
    |
468 | pub fn create_runtime(
    |        ^^^^^^^^^^^^^^
help: try wrapping the expression in `sc_executor_common::wasm_runtime::HeapAllocStrategy::Static`
    |
176 |         sc_executor_common::wasm_runtime::HeapAllocStrategy::Static { extra_pages: 64 },
    |         ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++    +

For more information about this error, try `rustc --explain E0308`.
error: could not compile `definitions` (lib) due to 1 previous error

@@ -97,7 +97,7 @@ impl<'a> Warning<'a> {
}
}

impl<'a> Card<'a> {
impl Card<'_> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error: the following explicit lifetimes could be elided: 'a
   --> transaction_parsing/src/cards.rs:100:6
    |
100 | impl<'a> Card<'a> {
    |      ^^       ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
100 - impl<'a> Card<'a> {
100 + impl Card<'_> {
    |

@@ -77,7 +77,7 @@ pub(crate) enum Warning<'a> {
MetadataExtensionsIncomplete,
}

impl<'a> Warning<'a> {
impl Warning<'_> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error: the following explicit lifetimes could be elided: 'a
  --> transaction_parsing/src/cards.rs:80:6
   |
80 | impl<'a> Warning<'a> {
   |      ^^          ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `-D clippy::needless-lifetimes` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::needless_lifetimes)]`
help: elide the lifetimes
   |
80 - impl<'a> Warning<'a> {
80 + impl Warning<'_> {
   |

@@ -22,7 +22,7 @@ pub fn base_cmd() -> Command {

pub fn assert_cmd_stdout(command: &str, output: &'static str) {
base_cmd()
.args(&command.split(' ').collect::<Vec<&str>>())
.args(command.split(' ').collect::<Vec<&str>>())
Copy link
Member Author

@stepanLav stepanLav Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error: the borrowed expression implements the required traits
  --> generate_message/tests/common/mod.rs:25:15
   |
25 |         .args(&command.split(' ').collect::<Vec<&str>>())
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `command.split(' ').collect::<Vec<&str>>()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
   = note: `-D clippy::needless-borrows-for-generic-args` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::needless_borrows_for_generic_args)]`

@@ -6205,7 +6205,7 @@ fn test_sign_dd_transaction() {
"530102".to_string() + &alice_westend_public + tx + WESTEND_GENESIS;
assert!(signature_is_good(
&non_dynamic_transaction,
&String::from_utf8(transaction.signature.signatures[0].data().to_vec()).unwrap()
core::str::from_utf8(transaction.signature.signatures[0].data()).unwrap()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error: could not compile `qr_reader_pc` (lib test) due to 1 previous error
error: allocating a new `String` only to create a temporary `&str` from it
    --> navigator/src/tests.rs:6208:9
     |
6208 |         &String::from_utf8(transaction.signature.signatures[0].data().to_vec()).unwrap()
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned
     = note: `-D clippy::unnecessary-to-owned` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(clippy::unnecessary_to_owned)]`
help: convert from `&[u8]` to `&str` directly
     |
6208 -         &String::from_utf8(transaction.signature.signatures[0].data().to_vec()).unwrap()
6208 +         core::str::from_utf8(transaction.signature.signatures[0].data()).unwrap()
     |

error: could not compile `navigator` (lib test) due to 1 previous error

Some(x) => x,
None => String::from(""),
};
let par = args.next().unwrap_or_default();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error: match can be simplified with `.unwrap_or_default()`
   --> qr_reader_pc/src/lib.rs:204:19
    |
204 |           let par = match args.next() {
    |  ___________________^
205 | |             Some(x) => x,
206 | |             None => String::from(""),
207 | |         };
    | |_________^ help: replace it with: `args.next().unwrap_or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default
    = note: `-D clippy::manual-unwrap-or-default` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::manual_unwrap_or_default)]`

error: could not compile `qr_reader_pc` (lib) due to 1 previous error

Comment on lines +22 to +25
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(ocvrs_opencv_branch_32)',
] }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking qr_reader_pc v0.2.0 (/workspaces/parity-signer/rust/qr_reader_pc)
error: unexpected `cfg` condition name: `ocvrs_opencv_branch_32`
  --> qr_reader_pc/src/lib.rs:95:11
   |
95 |     #[cfg(ocvrs_opencv_branch_32)]
   |           ^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
   = help: consider using a Cargo feature instead
   = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
            [lints.rust]
            unexpected_cfgs = { level = "warn", check-cfg = ['cfg(ocvrs_opencv_branch_32)'] }
   = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(ocvrs_opencv_branch_32)");` to the top of the `build.rs`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
   = note: `-D unexpected-cfgs` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unexpected_cfgs)]`

error: unexpected `cfg` condition name: `ocvrs_opencv_branch_32`
  --> qr_reader_pc/src/lib.rs:97:15
   |
97 |     #[cfg(not(ocvrs_opencv_branch_32))]
   |               ^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider using a Cargo feature instead
   = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
            [lints.rust]
            unexpected_cfgs = { level = "warn", check-cfg = ['cfg(ocvrs_opencv_branch_32)'] }
   = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(ocvrs_opencv_branch_32)");` to the top of the `build.rs`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

error: could not compile `qr_reader_pc` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `qr_reader_pc` (lib test) due to 2 previous errors

@@ -22,6 +21,9 @@ use opencv::{
Result,
};

#[cfg(target_os = "macos")]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error on linux machine:

error[E0432]: unresolved import `opencv::core::AlgorithmHint`
  --> qr_reader_pc/src/lib.rs:24:5
   |
24 | use opencv::core::AlgorithmHint;
   |     ^^^^^^^^^^^^^^-------------
   |     |             |
   |     |             help: a similar name exists in the module: `AlgorithmTrait`
   |     no `AlgorithmHint` in `opencv::hub::core`

error[E0061]: this function takes 4 arguments but 5 arguments were supplied
    --> qr_reader_pc/src/lib.rs:128:5
     |
128  |     cvt_color(
     |     ^^^^^^^^^
...
133  |         AlgorithmHint::ALGO_HINT_DEFAULT,
     |         -------------------------------- unexpected argument #5
     |
note: function defined here
    --> /workspaces/parity-signer/rust/target/debug/build/opencv-289221c7bfc2fec9/out/opencv/imgproc.rs:5707:9
     |
5707 |     pub fn cvt_color(src: &impl ToInputArray, dst: &mut impl ToOutputArray, code: i32, dst_cn: i32) -> Result<()> {
     |            ^^^^^^^^^
help: remove the extra argument
     |
132  -         0,
133  -         AlgorithmHint::ALGO_HINT_DEFAULT,
132  +         0,
     |

Some errors have detailed explanations: E0061, E0432.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `qr_reader_pc` (lib) due to 2 previous errors

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error on macOS:

error[E0061]: this function takes 5 arguments but 4 arguments were supplied
    --> qr_reader_pc/src/lib.rs:127:5
     |
127  |     cvt_color(&frame, &mut ocv_gray_image, COLOR_BGR2GRAY, 0)?;
     |     ^^^^^^^^^------------------------------------------------ argument #5 of type `AlgorithmHint` is missing
     |
note: function defined here
    --> /Users/stepanlavrentev/parity-signer/rust/target/debug/build/opencv-4f4dc0742f0bcf00/out/opencv/imgproc.rs:6212:9
     |
6212 |     pub fn cvt_color(src: &impl ToInputArray, dst: &mut impl ToOutputArray, code: i32, dst_cn: i32, hint: core::AlgorithmHint) -> Result<()> {
     |            ^^^^^^^^^
help: provide the argument
     |
127  |     cvt_color(&frame, &mut ocv_gray_image, COLOR_BGR2GRAY, 0, /* AlgorithmHint */)?;
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For more information about this error, try `rustc --explain E0061`.
error: could not compile `qr_reader_pc` (lib) due to 1 previous error

fix clippy

fix clippy
@stepanLav stepanLav changed the title Fix/ci_build Fix: build workflow Feb 14, 2025
@stepanLav stepanLav changed the title Fix: build workflow Fix: build workflow Feb 14, 2025
@stepanLav stepanLav changed the title Fix: build workflow Fix: build workflow Feb 14, 2025
@stepanLav stepanLav changed the title Fix: build workflow fix: build workflow Feb 14, 2025
@stepanLav stepanLav requested a review from ERussel February 14, 2025 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant