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

ci: run doctests in CI #830

Merged
merged 8 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/rust-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -76,10 +76,12 @@ 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:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -163,13 +163,13 @@ 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 --workspace --all-targets --features=cairo_1_tests
echo "Cairo2 tests"
cargo test --release --all --all-targets
cargo test --workspace --all-targets

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
Expand Down
4 changes: 2 additions & 2 deletions src/hash_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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![
Expand Down