Skip to content
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
41 changes: 41 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Pre-commit Checks

on:
push:
branches:
- master
- 'v**-dev'
pull_request:

jobs:
pre-commit:
name: Pre-commit (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# TODO: Windows excluded - rs-x11-hash requires POSIX headers (unistd.h)
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Cache cargo dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "rust-cache-${{ matrix.os }}"

- name: Run pre-commit
uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files --hook-stage push --verbose
148 changes: 1 addition & 147 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
# Run test in isolation, single-threaded to improve determinism
cargo test -p dash-spv --all-features -- --nocapture --test-threads=1 "$t" 2>&1 | tee -a segv_scan.log
rc=${PIPESTATUS[0]}
if [ $rc -ne 0 ]; then
if [ "$rc" -ne 0 ]; then
if tail -n 200 segv_scan.log | grep -qE 'SIGSEGV|signal: 11'; then
FOUND_THIS_ATTEMPT+=("$t")
SEGV_TESTS+=("$t")
Expand Down Expand Up @@ -176,139 +176,6 @@ jobs:
- name: Run script-based tests
run: ./contrib/test.sh

clippy:
name: Clippy (Non-strict)
runs-on: ubuntu-22.04-arm
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Run clippy (excluding strict-checked crates)
run: |
# Auto-discover all workspace crates and exclude strict-checked ones
STRICT_CRATES=("key-wallet" "key-wallet-manager" "key-wallet-ffi" "dashcore_hashes" "dashcore" "dash-spv" "dash-spv-ffi")
mapfile -t ALL_CRATES < <(cargo metadata --no-deps --format-version=1 | jq -r '.packages[].name' | sort -u)
for crate in "${ALL_CRATES[@]}"; do
if printf '%s\n' "${STRICT_CRATES[@]}" | grep -qx "$crate"; then
continue
fi
echo "Checking $crate (warnings allowed, errors will fail)..."
cargo clippy -p "$crate" --all-features --all-targets -- -W warnings
done

strict-checks:
name: Strict Warnings and Clippy Checks
runs-on: ubuntu-22.04-arm
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache cargo dependencies
uses: Swatinem/rust-cache@v2

# Check key-wallet with strict warnings
- name: Check key-wallet (deny warnings)
env:
RUSTFLAGS: "-D warnings"
run: |
cargo check -p key-wallet --all-features --lib --bins --tests
cargo build -p key-wallet --all-features --lib --bins
cargo test -p key-wallet --all-features --lib --bins

- name: Clippy key-wallet (deny all warnings)
run: cargo clippy -p key-wallet --all-features --lib --bins --tests -- -D warnings

# Check key-wallet-manager with strict warnings
- name: Check key-wallet-manager (deny warnings)
env:
RUSTFLAGS: "-D warnings"
run: |
cargo check -p key-wallet-manager --all-features --lib --bins --tests
cargo build -p key-wallet-manager --all-features --lib --bins
cargo test -p key-wallet-manager --all-features --lib --bins

- name: Clippy key-wallet-manager (deny all warnings)
run: cargo clippy -p key-wallet-manager --all-features --lib --bins --tests -- -D warnings

# Check key-wallet-ffi with strict warnings
- name: Check key-wallet-ffi (deny warnings)
env:
RUSTFLAGS: "-D warnings"
run: |
cargo check -p key-wallet-ffi --all-features --lib --bins --tests
cargo build -p key-wallet-ffi --all-features --lib --bins
cargo test -p key-wallet-ffi --all-features --lib --bins

- name: Clippy key-wallet-ffi (deny all warnings)
run: cargo clippy -p key-wallet-ffi --all-features --lib --bins --tests -- -D warnings

# Check dashcore with strict warnings
- name: Check dashcore (deny warnings)
env:
RUSTFLAGS: "-D warnings"
run: |
cargo check -p dashcore --all-features --lib --bins --tests
cargo build -p dashcore --all-features --lib --bins
cargo test -p dashcore --all-features --lib --bins

- name: Clippy dashcore (deny all warnings)
run: cargo clippy -p dashcore --all-features --lib --bins --tests -- -D warnings

# Check dashcore_hashes with strict warnings
- name: Check dashcore_hashes (deny warnings)
env:
RUSTFLAGS: "-D warnings"
run: |
cargo check -p dashcore_hashes --all-features --lib --bins --tests
cargo build -p dashcore_hashes --all-features --lib --bins
cargo test -p dashcore_hashes --all-features --lib --bins

- name: Clippy dashcore_hashes (deny all warnings)
run: cargo clippy -p dashcore_hashes --all-features --lib --bins --tests -- -D warnings

# Check dash-spv with strict warnings
- name: Check dash-spv (deny warnings)
env:
RUSTFLAGS: "-D warnings"
run: |
cargo check -p dash-spv --all-features --lib --bins --tests
cargo build -p dash-spv --all-features --lib --bins
cargo test -p dash-spv --all-features --lib --bins

- name: Clippy dash-spv (deny all warnings)
run: cargo clippy -p dash-spv --all-features --lib --bins --tests -- -D warnings

# Check dash-spv-ffi with strict warnings
- name: Check dash-spv-ffi (deny warnings)
env:
RUSTFLAGS: "-D warnings"
run: |
cargo check -p dash-spv-ffi --all-features --lib --bins --tests
cargo build -p dash-spv-ffi --all-features --lib --bins
cargo test -p dash-spv-ffi --all-features --lib --bins

- name: Clippy dash-spv-ffi (deny all warnings)
run: cargo clippy -p dash-spv-ffi --all-features --lib --bins --tests -- -D warnings

fmt:
name: Format
runs-on: ubuntu-22.04-arm
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check

rpc_tests:
name: RPC Tests
runs-on: ubuntu-22.04-arm
Expand Down Expand Up @@ -344,16 +211,3 @@ jobs:
env:
DASHVERSION: ${{ matrix.dashversion }}
run: ./contrib/test-rpc.sh

actionlint:
name: Lint GitHub Actions
runs-on: ubuntu-22.04-arm
permissions:
contents: read
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Run actionlint
uses: reviewdog/action-actionlint@v1
with:
fail_on_error: true
126 changes: 0 additions & 126 deletions .github/workflows/verify-ffi-docs.yml

This file was deleted.

Loading