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
24 changes: 24 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail

MSG_FILE="${1:?commit message path is required}"
MSG="$(head -n 1 "$MSG_FILE" | tr -d '\r')"

if [[ "$MSG" =~ ^(Merge|Revert)\ ]]; then
exit 0
fi

PATTERN='^(feat|fix|docs|refactor|test|chore)(\([a-z0-9][a-z0-9._/-]*\))?!?: .+$'

if [[ ! "$MSG" =~ $PATTERN ]]; then
cat >&2 <<'EOF'
commit message must follow Conventional Commits:
<type>(<scope>): <description>

Examples:
feat(types): add AgentInterface serde model
fix(server): return proper JSON-RPC error code
docs(readme): update protocol version note
EOF
exit 1
fi
7 changes: 5 additions & 2 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ set -euo pipefail
echo "[pre-commit] cargo fmt --all -- --check"
cargo fmt --all -- --check

echo "[pre-commit] cargo clippy --all-targets --all-features -- -D warnings"
cargo clippy --all-targets --all-features -- -D warnings
echo "[pre-commit] cargo clippy --all-targets --no-default-features -- -D warnings"
cargo clippy --all-targets --no-default-features -- -D warnings

echo "[pre-commit] cargo check --all-features"
cargo check --all-features
3 changes: 3 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

echo "[pre-push] cargo test --no-default-features"
cargo test --no-default-features

echo "[pre-push] cargo test --all-features"
cargo test --all-features
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ on:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
Expand All @@ -29,6 +37,22 @@ jobs:
- uses: Swatinem/rust-cache@v2
- run: cargo test --all-features

minimal:
name: Minimal Feature Set
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo check --no-default-features
- run: cargo test --no-default-features
- run: cargo clippy --all-targets --no-default-features -- -D warnings
- run: cargo doc --no-deps --no-default-features
env:
RUSTDOCFLAGS: -Dwarnings

clippy:
name: Clippy
runs-on: ubuntu-latest
Expand Down
Loading
Loading