From 197b30a02bd0f64bd2ab86a1a192a0af997023bc Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 21 Apr 2021 04:06:17 +0200 Subject: [PATCH 1/5] Run documentation tests in CI --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6d3e99d7772..841ab0dc274 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -141,6 +141,7 @@ docs: -p ink_primitives -p ink_prelude -p ink_lang -p ink_lang_macro -p ink_lang_ir -p ink_lang_codegen - mv ${CARGO_TARGET_DIR}/doc ./crate-docs + - cargo test --doc --workspace spellcheck: stage: workspace From a241d1a8b0f2210dead599876544cb0f832de078 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 21 Apr 2021 04:06:35 +0200 Subject: [PATCH 2/5] Use `format` from `prelude` The contract build will fail otherwise due to the usage of `std::string::String` because of `std::format`. --- crates/lang/macro/Cargo.toml | 1 + crates/lang/macro/src/lib.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/crates/lang/macro/Cargo.toml b/crates/lang/macro/Cargo.toml index 5deffc91d9e..5451f841e02 100644 --- a/crates/lang/macro/Cargo.toml +++ b/crates/lang/macro/Cargo.toml @@ -28,6 +28,7 @@ ink_metadata = { version = "3.0.0-rc3", path = "../../metadata/" } ink_env = { version = "3.0.0-rc3", path = "../../env/" } ink_storage = { version = "3.0.0-rc3", path = "../../storage/" } ink_lang = { version = "3.0.0-rc3", path = ".." } +ink_prelude = { version = "3.0.0-rc3", path = "../../prelude/" } trybuild = "1.0.24" scale-info = { version = "0.6", default-features = false, features = ["derive"] } diff --git a/crates/lang/macro/src/lib.rs b/crates/lang/macro/src/lib.rs index b3844a6fb3b..6558f32fafb 100644 --- a/crates/lang/macro/src/lib.rs +++ b/crates/lang/macro/src/lib.rs @@ -397,6 +397,8 @@ use proc_macro::TokenStream; /// # /// #[ink::contract] /// mod greeter { +/// use ink_prelude::format; +/// /// #[ink(storage)] /// pub struct Greeter; /// From 5d2622b4abd4fd0b2972217c6fced8069a47c453 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 21 Apr 2021 04:07:05 +0200 Subject: [PATCH 3/5] Remove superfluous mutable --- crates/lang/macro/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/lang/macro/src/lib.rs b/crates/lang/macro/src/lib.rs index 6558f32fafb..65c41916a08 100644 --- a/crates/lang/macro/src/lib.rs +++ b/crates/lang/macro/src/lib.rs @@ -412,7 +412,7 @@ use proc_macro::TokenStream; /// } /// /// #[ink(message, payable)] -/// pub fn fund(&mut self) { +/// pub fn fund(&self) { /// let caller = self.env().caller(); /// let value = self.env().transferred_balance(); /// let message = format!("thanks for the funding of {:?} from {:?}", value, caller); From afa1b12c8934ab0dec5b14d8960a98365e845429 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 21 Apr 2021 09:13:32 +0200 Subject: [PATCH 4/5] Reduce amount of fuzz runs The CI run already takes quite long and I don't think it makes that much difference if we reduce the amount of runs. The bugs we catched so far were always catched with way less runs than even this new number. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 841ab0dc274..ed821d6628f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -376,7 +376,7 @@ fuzz-tests: <<: *docker-env variables: # The QUICKCHECK_TESTS default is 100 - QUICKCHECK_TESTS: 40000 + QUICKCHECK_TESTS: 20000 rules: - if: $CI_PIPELINE_SOURCE == "schedule" - if: $CI_COMMIT_REF_NAME == "master" From 1995960abe2d6ccf12819eb11c4124014559ca4d Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 21 Apr 2021 09:28:19 +0200 Subject: [PATCH 5/5] Run documentation tests as part of `test` stage --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ed821d6628f..2498b59d8a8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -122,6 +122,7 @@ test: QUICKCHECK_TESTS: 0 script: - cargo test --verbose --all-features --no-fail-fast --workspace + - cargo test --verbose --all-features --no-fail-fast --workspace --doc docs: stage: workspace @@ -141,7 +142,6 @@ docs: -p ink_primitives -p ink_prelude -p ink_lang -p ink_lang_macro -p ink_lang_ir -p ink_lang_codegen - mv ${CARGO_TARGET_DIR}/doc ./crate-docs - - cargo test --doc --workspace spellcheck: stage: workspace