Skip to content

Commit

Permalink
👩‍💻 Add CI check if code is formatted (#25)
Browse files Browse the repository at this point in the history
# 🔍 Objective

Currently, we don't check if the code in the repo is formatted.

## 🆕 Added

New CI job that does that.
  • Loading branch information
Velnbur authored Oct 28, 2024
1 parent f072f92 commit 042f601
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ jobs:
- name: Build
run: cargo build --verbose

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_min }}
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Format
run: cargo fmt --check

clippy:
name: clippy
runs-on: ubuntu-latest
Expand Down
9 changes: 7 additions & 2 deletions bitcoin-testscripts/src/u32mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ impl SplitableScript<{ INPUT_SIZE }, { OUTPUT_SIZE }> for U32MulScript {

impl U32MulScript {
/// Splits the script into shards with a given chunk size
pub fn split_with_chunk_size(input: Script, split_type: SplitType, chunk_size: usize) -> SplitResult {
pub fn split_with_chunk_size(
input: Script,
split_type: SplitType,
chunk_size: usize,
) -> SplitResult {
Self::split(input, split_type, chunk_size)
}
}
Expand Down Expand Up @@ -134,7 +138,8 @@ mod tests {
let IOPair { input, output } = U32MulScript::generate_valid_io_pair();

// Splitting the script into shards
let split_result = U32MulScript::split_with_chunk_size(input, SplitType::ByInstructions, SPLIT_SIZE);
let split_result =
U32MulScript::split_with_chunk_size(input, SplitType::ByInstructions, SPLIT_SIZE);

for shard in split_result.shards.iter() {
println!("Shard: {:?}", shard.len());
Expand Down

0 comments on commit 042f601

Please sign in to comment.