From 0a7f2842e24d8bbeea397225b195d27745e9f244 Mon Sep 17 00:00:00 2001 From: tienshaoku Date: Sat, 2 Nov 2024 01:33:42 +0800 Subject: [PATCH] chore: pre-push hook replacing cargo check workflow --- .github/workflows/rust-lint.yml | 8 +------- .hooks/pre-push | 18 ++++++++++++++++++ README.md | 4 ++++ 3 files changed, 23 insertions(+), 7 deletions(-) create mode 100755 .hooks/pre-push diff --git a/.github/workflows/rust-lint.yml b/.github/workflows/rust-lint.yml index 48abc0a..8513744 100644 --- a/.github/workflows/rust-lint.yml +++ b/.github/workflows/rust-lint.yml @@ -11,14 +11,8 @@ jobs: - uses: actions-rs/toolchain@v1 with: # input params for this action toolchain: stable - components: rustfmt, clippy + components: rustfmt override: true - - name: Check compilation - run: cargo check # Run this first - fails fast if code won't compile - - name: Check formatting run: cargo fmt -- --check - - - name: Check clippy - run: cargo clippy # Run this after - catches deeper issues diff --git a/.hooks/pre-push b/.hooks/pre-push new file mode 100755 index 0000000..a72ae56 --- /dev/null +++ b/.hooks/pre-push @@ -0,0 +1,18 @@ +#!/bin/bash + +echo "Running pre-push checks..." + +echo "Running cargo check..." +if ! cargo check; then + echo "❌ cargo check failed" + exit 1 +fi + +echo "Running cargo check..." +if ! cargo clippy; then + echo "❌ cargo clippy failed" + exit 1 +fi + +echo "✅ All checks passed!" +exit 0 diff --git a/README.md b/README.md index 38e4537..d5b0b91 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,10 @@ This simple CLI tool lets you monitor your portfolio locally 👌 3. `cargo run` 🥳 +### Development Setup + +- Configure git hooks by `git config core.hooksPath .hooks` + ## Feature - Total # of tokens owned by all addresses