From d7bac60b43162fe86221f60cc842f7d8fbae9d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 4 Nov 2024 13:19:38 +0100 Subject: [PATCH] Fix CI (#1788) * Use `inspect_err` over `map_err` * Remove lifetimes that can be elided * Revert me: Account for false-positive in clippy * Apply `cargo fmt` * Use GitHub binaries of `substrate-contracts-node` over removed GitLab releases * Fix url * Use shell globbing --- .github/workflows/ci.yml | 12 ++++++------ crates/build/src/docker.rs | 3 +++ crates/build/src/lib.rs | 5 ++--- crates/metadata/src/byte_str.rs | 4 ++-- crates/transcode/src/scon/display.rs | 8 ++++---- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c2cc1b9b..62e7b326a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -240,20 +240,20 @@ jobs: - name: Install latest `substrate-contracts-node` binary env: - CONTRACTS_NODE_URL: https://gitlab.parity.io/parity/mirrors/substrate-contracts-node/-/jobs/artifacts/main/download + CONTRACTS_NODE_URL: https://github.com/paritytech/substrate-contracts-node/releases/latest/download/substrate-contracts-node- run: | if [ "$RUNNER_OS" == "Linux" ]; then CONTRACTS_NODE_OS=linux elif [ "$RUNNER_OS" == "macOS" ]; then - CONTRACTS_NODE_OS=mac + CONTRACTS_NODE_OS=mac-universal else echo "$RUNNER_OS not supported" exit 1 fi - curl -L -o substrate-contracts-node.zip "$CONTRACTS_NODE_URL?job=build-$CONTRACTS_NODE_OS" - unzip substrate-contracts-node.zip - chmod +x artifacts/substrate-contracts-node-$CONTRACTS_NODE_OS/substrate-contracts-node && - mv artifacts/substrate-contracts-node-$CONTRACTS_NODE_OS/substrate-contracts-node /usr/local/bin + curl -L -o substrate-contracts-node.tar.gz "$CONTRACTS_NODE_URL$CONTRACTS_NODE_OS.tar.gz" + tar xfzv substrate-contracts-node.tar.gz + chmod +x artifacts/substrate-contracts-node-*/substrate-contracts-node && + mv artifacts/substrate-contracts-node-*/substrate-contracts-node /usr/local/bin shell: bash - name: Run integration tests diff --git a/crates/build/src/docker.rs b/crates/build/src/docker.rs index 84bc9bf31..2eca345cb 100644 --- a/crates/build/src/docker.rs +++ b/crates/build/src/docker.rs @@ -218,6 +218,9 @@ fn update_build_result(host_folder: &Path, build_result: &mut BuildResult) -> Re }); build_result.dest_wasm = new_path; + // TODO: Clippy currently throws a false-positive here. The manual allow can be + // removed after https://github.com/rust-lang/rust-clippy/pull/13609 has been released. + #[allow(clippy::manual_inspect)] build_result.metadata_result.as_mut().map(|m| { m.dest_bundle = host_folder.join( m.dest_bundle diff --git a/crates/build/src/lib.rs b/crates/build/src/lib.rs index 24570ee19..2af889dcd 100644 --- a/crates/build/src/lib.rs +++ b/crates/build/src/lib.rs @@ -763,11 +763,10 @@ pub fn execute(args: ExecuteArgs) -> Result { } BuildArtifacts::All => { let (opt_result, build_info, dest_wasm) = - local_build(&crate_metadata, &optimization_passes, &args).map_err( - |e| { + local_build(&crate_metadata, &optimization_passes, &args).inspect_err( + |_| { // build error -> bundle is stale clean_metadata(); - e }, )?; diff --git a/crates/metadata/src/byte_str.rs b/crates/metadata/src/byte_str.rs index 8c5c92789..e3af03b2e 100644 --- a/crates/metadata/src/byte_str.rs +++ b/crates/metadata/src/byte_str.rs @@ -35,7 +35,7 @@ where { struct Visitor; - impl<'b> serde::de::Visitor<'b> for Visitor { + impl serde::de::Visitor<'_> for Visitor { type Value = Vec; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { @@ -64,7 +64,7 @@ where { struct Visitor; - impl<'b> serde::de::Visitor<'b> for Visitor { + impl serde::de::Visitor<'_> for Visitor { type Value = [u8; 32]; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/crates/transcode/src/scon/display.rs b/crates/transcode/src/scon/display.rs index b3557193f..92b2c9257 100644 --- a/crates/transcode/src/scon/display.rs +++ b/crates/transcode/src/scon/display.rs @@ -32,7 +32,7 @@ use std::fmt::{ /// Wraps Value for custom Debug impl to provide pretty-printed Display struct DisplayValue<'a>(&'a Value); -impl<'a> Debug for DisplayValue<'a> { +impl Debug for DisplayValue<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> Result { match &self.0 { Value::Bool(boolean) => ::fmt(boolean, f), @@ -61,7 +61,7 @@ impl Display for Value { struct DisplayMap<'a>(&'a Map); -impl<'a> Debug for DisplayMap<'a> { +impl Debug for DisplayMap<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> Result { match self.0.ident { Some(ref name) => { @@ -84,7 +84,7 @@ impl<'a> Debug for DisplayMap<'a> { struct DisplayTuple<'a>(&'a Tuple); -impl<'a> Debug for DisplayTuple<'a> { +impl Debug for DisplayTuple<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> Result { let name = self.0.ident.as_ref().map_or("", |s| s.as_str()); let mut builder = f.debug_tuple(name); @@ -97,7 +97,7 @@ impl<'a> Debug for DisplayTuple<'a> { struct DisplaySeq<'a>(&'a Seq); -impl<'a> Debug for DisplaySeq<'a> { +impl Debug for DisplaySeq<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> Result { let mut builder = f.debug_list(); for elem in &self.0.elems {