Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit ce95a2b

Browse files
authored
ci: run doctests in CI (#830)
* Run doctests in CI * Use `--workspace` instead of (deprecated) `--all` * Fix existing doctests * Run tests with debug profile * Extract doctest run to other step * Bump ubuntu version
1 parent d6c3e9c commit ce95a2b

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

.github/workflows/rust-tests.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313

1414
jobs:
1515
build:
16-
runs-on: ubuntu-20.04
16+
runs-on: ubuntu-22.04
1717
steps:
1818
- name: Install Rust
1919
uses: dtolnay/rust-toolchain@stable
@@ -34,7 +34,7 @@ jobs:
3434
run: make build
3535

3636
format:
37-
runs-on: ubuntu-20.04
37+
runs-on: ubuntu-22.04
3838
steps:
3939
- name: Install Rust
4040
uses: dtolnay/rust-toolchain@stable
@@ -57,7 +57,7 @@ jobs:
5757
run: make clippy
5858

5959
test:
60-
runs-on: ubuntu-20.04
60+
runs-on: ubuntu-22.04
6161
steps:
6262
- name: Install Rust
6363
uses: dtolnay/rust-toolchain@stable
@@ -76,10 +76,12 @@ jobs:
7676
run: make deps
7777
- name: Run tests
7878
run: make test
79+
- name: Run doctests
80+
run: cargo test --workspace --doc
7981

8082
# 28.06.2023: This job uses unmaintained actions-rs because dtolnay is giving linking errors with nightly
8183
coverage:
82-
runs-on: ubuntu-20.04
84+
runs-on: ubuntu-22.04
8385
steps:
8486
- name: Checkout
8587
uses: actions/checkout@v3

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ $(cairo-repo-2-dir):
129129
# =================
130130

131131
build: compile-cairo compile-starknet
132-
cargo build --release --all
132+
cargo build --release --workspace
133133

134134
check: compile-cairo compile-starknet
135-
cargo check --all --all-targets
135+
cargo check --workspace --all-targets
136136

137137
deps: check-python-version build-cairo-2-compiler build-cairo-1-compiler
138138
cargo install flamegraph --version 0.6.2
@@ -163,13 +163,13 @@ clean:
163163
-rm -rf cairo-1.1.1.tar
164164

165165
clippy: compile-cairo compile-starknet $(CAIRO_1_COMPILED_CASM_CONTRACTS) $(CAIRO_2_COMPILED_CASM_CONTRACTS)
166-
cargo clippy --all --all-targets -- -D warnings
166+
cargo clippy --workspace --all-targets -- -D warnings
167167

168168
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)
169169
echo "Cairo1 tests"
170-
cargo test --release --all --all-targets --features=cairo_1_tests
170+
cargo test --workspace --all-targets --features=cairo_1_tests
171171
echo "Cairo2 tests"
172-
cargo test --release --all --all-targets
172+
cargo test --workspace --all-targets
173173

174174
coverage: compile-cairo compile-starknet compile-abi $(CAIRO_1_COMPILED_CASM_CONTRACTS) $(CAIRO_2_COMPILED_CASM_CONTRACTS)
175175
cargo +nightly llvm-cov --ignore-filename-regex 'main.rs' --release

src/hash_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use std::vec;
3434
/// # Examples
3535
///
3636
/// ```
37-
/// use starknet_in_rust::{hash_utils::calculate_contract_address, utils::Address, Felt252};
37+
/// use starknet_in_rust::{hash_utils::calculate_contract_address, utils::Address, felt::Felt252};
3838
///
3939
/// let salt = Felt252::from(123_u16);
4040
/// let class_hash = Felt252::from(456_u16);
@@ -92,7 +92,7 @@ pub fn calculate_contract_address(
9292
/// # Examples
9393
///
9494
/// ```
95-
/// use starknet_in_rust::Felt252;
95+
/// use starknet_in_rust::felt::Felt252;
9696
/// use starknet_in_rust::hash_utils::compute_hash_on_elements;
9797
///
9898
/// let input_vec = vec![

0 commit comments

Comments
 (0)