From 4b9af5acfd2a4ecb00c9c61d507e547334237a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1?= <47506558+MegaRedHand@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:00:03 -0300 Subject: [PATCH 1/6] Run doctests in CI --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index cd1a82ed9..e549ec7a0 100644 --- a/Makefile +++ b/Makefile @@ -170,6 +170,8 @@ test: compile-cairo compile-starknet $(CAIRO_1_COMPILED_CASM_CONTRACTS) $(CAIRO_ cargo test --release --all --all-targets --features=cairo_1_tests echo "Cairo2 tests" cargo test --release --all --all-targets + echo "doctests" + cargo test --release --all --doc coverage: compile-cairo compile-starknet compile-abi $(CAIRO_1_COMPILED_CASM_CONTRACTS) $(CAIRO_2_COMPILED_CASM_CONTRACTS) cargo +nightly llvm-cov --ignore-filename-regex 'main.rs' --release From 5da8caaef58d2ce144b15d0b04d3ce3cf8fd3db9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1?= <47506558+MegaRedHand@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:04:20 -0300 Subject: [PATCH 2/6] Use `--workspace` instead of (deprecated) `--all` --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index e549ec7a0..81ba2de2a 100644 --- a/Makefile +++ b/Makefile @@ -129,10 +129,10 @@ $(cairo-repo-2-dir): # ================= build: compile-cairo compile-starknet - cargo build --release --all + cargo build --release --workspace check: compile-cairo compile-starknet - cargo check --all --all-targets + cargo check --workspace --all-targets deps: check-python-version build-cairo-2-compiler build-cairo-1-compiler cargo install flamegraph --version 0.6.2 @@ -163,15 +163,15 @@ clean: -rm -rf cairo-1.1.1.tar clippy: compile-cairo compile-starknet $(CAIRO_1_COMPILED_CASM_CONTRACTS) $(CAIRO_2_COMPILED_CASM_CONTRACTS) - cargo clippy --all --all-targets -- -D warnings + cargo clippy --workspace --all-targets -- -D warnings test: compile-cairo compile-starknet $(CAIRO_1_COMPILED_CASM_CONTRACTS) $(CAIRO_1_COMPILED_SIERRA_CONTRACTS) $(CAIRO_2_COMPILED_CASM_CONTRACTS) $(CAIRO_2_COMPILED_SIERRA_CONTRACTS) echo "Cairo1 tests" - cargo test --release --all --all-targets --features=cairo_1_tests + cargo test --release --workspace --all-targets --features=cairo_1_tests echo "Cairo2 tests" - cargo test --release --all --all-targets + cargo test --release --workspace --all-targets echo "doctests" - cargo test --release --all --doc + cargo test --release --workspace --doc coverage: compile-cairo compile-starknet compile-abi $(CAIRO_1_COMPILED_CASM_CONTRACTS) $(CAIRO_2_COMPILED_CASM_CONTRACTS) cargo +nightly llvm-cov --ignore-filename-regex 'main.rs' --release From f26c6e9a62cbc3ac47c936b8264b5a6e63f1433e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1?= <47506558+MegaRedHand@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:07:37 -0300 Subject: [PATCH 3/6] Fix existing doctests --- src/hash_utils.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hash_utils.rs b/src/hash_utils.rs index 034646546..70da1526c 100644 --- a/src/hash_utils.rs +++ b/src/hash_utils.rs @@ -34,7 +34,7 @@ use std::vec; /// # Examples /// /// ``` -/// use starknet_in_rust::{hash_utils::calculate_contract_address, utils::Address, Felt252}; +/// use starknet_in_rust::{hash_utils::calculate_contract_address, utils::Address, felt::Felt252}; /// /// let salt = Felt252::from(123_u16); /// let class_hash = Felt252::from(456_u16); @@ -92,7 +92,7 @@ pub fn calculate_contract_address( /// # Examples /// /// ``` -/// use starknet_in_rust::Felt252; +/// use starknet_in_rust::felt::Felt252; /// use starknet_in_rust::hash_utils::compute_hash_on_elements; /// /// let input_vec = vec![ From 34f39cdd11ffa42b91eb8eb0e103c65860aeafb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1?= <47506558+MegaRedHand@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:18:54 -0300 Subject: [PATCH 4/6] Run tests with debug profile --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 81ba2de2a..4101a0084 100644 --- a/Makefile +++ b/Makefile @@ -167,11 +167,11 @@ clippy: compile-cairo compile-starknet $(CAIRO_1_COMPILED_CASM_CONTRACTS) $(CAIR test: compile-cairo compile-starknet $(CAIRO_1_COMPILED_CASM_CONTRACTS) $(CAIRO_1_COMPILED_SIERRA_CONTRACTS) $(CAIRO_2_COMPILED_CASM_CONTRACTS) $(CAIRO_2_COMPILED_SIERRA_CONTRACTS) echo "Cairo1 tests" - cargo test --release --workspace --all-targets --features=cairo_1_tests + cargo test --workspace --all-targets --features=cairo_1_tests echo "Cairo2 tests" - cargo test --release --workspace --all-targets + cargo test --workspace --all-targets echo "doctests" - cargo test --release --workspace --doc + cargo test --workspace --doc coverage: compile-cairo compile-starknet compile-abi $(CAIRO_1_COMPILED_CASM_CONTRACTS) $(CAIRO_2_COMPILED_CASM_CONTRACTS) cargo +nightly llvm-cov --ignore-filename-regex 'main.rs' --release From f9ec4f47b2af2b491383a3f03ba6d407136ec298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1?= <47506558+MegaRedHand@users.noreply.github.com> Date: Tue, 18 Jul 2023 13:36:29 -0300 Subject: [PATCH 5/6] Extract doctest run to other step --- .github/workflows/rust-tests.yml | 2 ++ Makefile | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust-tests.yml b/.github/workflows/rust-tests.yml index 06d346647..e46e1c6cd 100644 --- a/.github/workflows/rust-tests.yml +++ b/.github/workflows/rust-tests.yml @@ -76,6 +76,8 @@ jobs: run: make deps - name: Run tests run: make test + - name: Run doctests + run: cargo test --workspace --doc # 28.06.2023: This job uses unmaintained actions-rs because dtolnay is giving linking errors with nightly coverage: diff --git a/Makefile b/Makefile index 4101a0084..996c89486 100644 --- a/Makefile +++ b/Makefile @@ -170,8 +170,6 @@ test: compile-cairo compile-starknet $(CAIRO_1_COMPILED_CASM_CONTRACTS) $(CAIRO_ cargo test --workspace --all-targets --features=cairo_1_tests echo "Cairo2 tests" cargo test --workspace --all-targets - echo "doctests" - cargo test --workspace --doc coverage: compile-cairo compile-starknet compile-abi $(CAIRO_1_COMPILED_CASM_CONTRACTS) $(CAIRO_2_COMPILED_CASM_CONTRACTS) cargo +nightly llvm-cov --ignore-filename-regex 'main.rs' --release From a7245795ac935aa984cbf649229f9079e536d11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1?= <47506558+MegaRedHand@users.noreply.github.com> Date: Tue, 18 Jul 2023 13:39:41 -0300 Subject: [PATCH 6/6] Bump ubuntu version --- .github/workflows/rust-tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust-tests.yml b/.github/workflows/rust-tests.yml index e46e1c6cd..453155307 100644 --- a/.github/workflows/rust-tests.yml +++ b/.github/workflows/rust-tests.yml @@ -13,7 +13,7 @@ env: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Install Rust uses: dtolnay/rust-toolchain@stable @@ -34,7 +34,7 @@ jobs: run: make build format: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Install Rust uses: dtolnay/rust-toolchain@stable @@ -57,7 +57,7 @@ jobs: run: make clippy test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Install Rust uses: dtolnay/rust-toolchain@stable @@ -81,7 +81,7 @@ jobs: # 28.06.2023: This job uses unmaintained actions-rs because dtolnay is giving linking errors with nightly coverage: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v3