Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ee730ef
fix: correct documentation output path and add Doxygen installation
peterlau123 Nov 13, 2025
d4e7cec
feat: add code coverage generation and Codecov integration
peterlau123 Nov 13, 2025
e484fb8
other(readme): add macos badge
peterlau123 Nov 13, 2025
6a12f51
feat(tools): add pre-commit hooks with conventional commit validation
peterlau123 Nov 13, 2025
2cba355
feat(tools): add branch name validation with post-checkout hook
peterlau123 Nov 13, 2025
20d7915
refactor(tools): simplify hook setup to single command for all platforms
peterlau123 Nov 13, 2025
dd7d864
docs(readme): add emoji to Developer-friendly feature
peterlau123 Nov 15, 2025
6399afe
fix(buffer_hub): fix refill logic
peterlau123 Nov 16, 2025
3cf44a9
chore: add file ignore
peterlau123 Nov 16, 2025
e80c2a2
fix: update README and fix script
peterlau123 Nov 16, 2025
9e84da0
chore(build.sh): automate build.sh
peterlau123 Nov 16, 2025
9b031a1
refactor(buffer_hub): refactor the refill logic
peterlau123 Nov 17, 2025
15539ad
feat: add buffer design doc
peterlau123 Nov 17, 2025
a87613a
style: format code
peterlau123 Nov 18, 2025
a57cb19
refactor: refactor the bufferhub class
peterlau123 Nov 18, 2025
016a5ee
refactor: refactor Size
peterlau123 Nov 18, 2025
819309a
Fix BufferHub pool memory management and update tests
peterlau123 Nov 19, 2025
93eb9f5
fix: fix free_map error
peterlau123 Nov 20, 2025
c8edc76
fix: forward declaration of BufferHUb
peterlau123 Nov 24, 2025
1b214e2
fix: add thread safty
peterlau123 Nov 24, 2025
564f8ae
refactor: add unit test for multi-thread and replace raw pointer by s…
peterlau123 Nov 24, 2025
9b4698a
refactor: only use uint64_t in Size
peterlau123 Nov 25, 2025
92447ac
refactor: encapsulate BufferHubLevel
peterlau123 Nov 25, 2025
73037ac
style: format buffer_hub_test
peterlau123 Nov 25, 2025
a5066b2
fix: fix buffer_manager_test
peterlau123 Nov 25, 2025
3471201
fix: fix buffer_manager_test.cpp
peterlau123 Nov 25, 2025
2783f61
fix: fix ubuntu and windows github ci issues
peterlau123 Nov 26, 2025
0c7de54
fix: fix C4251 as error in windows
peterlau123 Nov 26, 2025
53663fb
fix : fix capture error in windows
peterlau123 Nov 26, 2025
e9d71c6
fix: fix ubuntu code coverage error
peterlau123 Nov 26, 2025
2c6caaf
fix: fix lambda capture in windows
peterlau123 Nov 26, 2025
539723b
fix: fix the symbol export in windows
peterlau123 Nov 26, 2025
afd3b9b
fix: fix symbol export of API in windows
peterlau123 Nov 26, 2025
0c23533
feat: add API export in windows
peterlau123 Nov 26, 2025
53a8046
fix: fix deleted function error
peterlau123 Nov 26, 2025
d4bbf45
fix: fix error of compiling
peterlau123 Nov 26, 2025
a2a1e1f
fix: fix capture error on macos
peterlau123 Nov 26, 2025
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
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SeparateDefinitionBlocks: Always
# 基础缩进配置
IndentWidth: 2
ContinuationIndentWidth: 4
ColumnLimit: 100
ColumnLimit: 200

# 函数参数和初始化列表格式
BinPackArguments: false
Expand Down
129 changes: 129 additions & 0 deletions .githooks/check_branch_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#!/usr/bin/env python3
"""
Branch name validator for NovaLLM
Works on all platforms (Windows, macOS, Linux)
"""
import re
import subprocess
import sys


def get_current_branch():
"""Get the current git branch name."""
try:
result = subprocess.run(
["git", "rev-parse", "--abbrev-ref", "HEAD"],
capture_output=True,
text=True,
check=True,
)
return result.stdout.strip()
except subprocess.CalledProcessError:
return None


def is_protected_branch(branch_name):
"""Check if branch is protected (doesn't need validation)."""
protected_patterns = [
r"^main$",
r"^master$",
r"^develop$",
r"^release/.+",
r"^hotfix/.+",
r"^HEAD$", # Detached HEAD
]
return any(re.match(pattern, branch_name) for pattern in protected_patterns)


def validate_branch_name(branch_name):
"""
Validate branch name against the required format.
Format: <type>-<description> or <type>/<description>
"""
# Pattern: type followed by - or / followed by lowercase alphanumeric
valid_types = [
"feat",
"fix",
"docs",
"style",
"refactor",
"perf",
"test",
"build",
"ci",
"chore",
]
pattern = rf"^({'|'.join(valid_types)})([-/])[a-z0-9_-]+$"
return re.match(pattern, branch_name) is not None


def print_error_message(branch_name):
"""Print helpful error message for invalid branch names."""
error_msg = f"""
{'='*70}
❌ INVALID BRANCH NAME
{'='*70}

Branch: {branch_name}

Branch names must follow this format:
<type>-<description> or <type>/<description>

Valid types:
• feat - New feature
• fix - Bug fix
• docs - Documentation changes
• style - Code style changes
• refactor - Code refactoring
• perf - Performance improvements
• test - Test changes
• build - Build system changes
• ci - CI/CD changes
• chore - Other changes

✅ Valid examples:
feat-buffer-pooling
fix-windows-dll-exports
docs-update-readme
refactor/simplify-tensor-allocation
ci-add-coverage-reporting

❌ Current branch: {branch_name}

To fix this, rename your branch:
git branch -m {branch_name} <type>-<proper-description>

Or delete and recreate:
git checkout main
git branch -D {branch_name}
git checkout -b <type>-<proper-description>

{'='*70}
"""
print(error_msg, file=sys.stderr)


def main():
"""Main entry point for branch name validation."""
branch_name = get_current_branch()

if not branch_name:
# Can't determine branch, skip validation
sys.exit(0)

# Skip protected branches
if is_protected_branch(branch_name):
sys.exit(0)

# Validate branch name
if not validate_branch_name(branch_name):
print_error_message(branch_name)
sys.exit(1)

# Branch name is valid
print(f"✅ Branch name '{branch_name}' is valid")
sys.exit(0)


if __name__ == "__main__":
main()
71 changes: 71 additions & 0 deletions .githooks/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
# Install git hooks for NovaLLM
# This script sets up both pre-commit hooks and custom git hooks

set -euo pipefail

echo "🔧 Installing NovaLLM Git Hooks..."
echo ""

# Get the repository root
REPO_ROOT=$(git rev-parse --show-toplevel)
HOOKS_DIR="$REPO_ROOT/.githooks"

# 1. Configure git to use custom hooks directory
echo "📁 Configuring git to use custom hooks directory..."
git config core.hooksPath "$HOOKS_DIR"
echo " ✅ Git hooks path set to: $HOOKS_DIR"
echo ""

# 2. Install pre-commit hooks
if command -v pre-commit &> /dev/null; then
echo "📦 Installing pre-commit hooks..."
pre-commit install --hook-type commit-msg --hook-type pre-commit
echo " ✅ Pre-commit hooks installed"
else
echo "⚠️ pre-commit not found. Install it with:"
echo " pip install pre-commit"
echo " Then run: pre-commit install --hook-type commit-msg --hook-type pre-commit"
fi
echo ""

# 3. Make all hook scripts executable
echo "🔐 Making hook scripts executable..."
chmod +x "$HOOKS_DIR"/* 2>/dev/null || true
echo " ✅ Hook scripts are executable"
echo ""

# 4. Test branch name validation (if on a feature branch)
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "📋 Current branch: $CURRENT_BRANCH"

# Summary
cat <<EOF

╔════════════════════════════════════════════════════════════════╗
║ ✅ HOOKS INSTALLED SUCCESSFULLY ║
╚════════════════════════════════════════════════════════════════╝

Installed hooks:
✓ post-checkout - Validates branch names
✓ commit-msg - Validates commit messages
✓ pre-commit - Code quality checks

Branch name format:
<type>-<description> or <type>/<description>
Example: feat-buffer-pooling, fix-memory-leak

Commit message format:
<type>(<scope>): <subject>
Example: feat(memory): add buffer pooling

Valid types:
feat, fix, docs, style, refactor, perf, test, build, ci, chore

Try it out:
git checkout -b feat-test-branch
git commit -m "feat(test): try the hooks"

For more info, see: .pre-commit-setup.md

EOF
82 changes: 82 additions & 0 deletions .githooks/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/usr/bin/env bash
# Post-checkout hook to validate branch names
# This hook runs after 'git checkout' or 'git switch'

set -euo pipefail

# Get the previous HEAD, new HEAD, and checkout type
PREV_HEAD=$1
NEW_HEAD=$2
CHECKOUT_TYPE=$3 # 1 = branch checkout, 0 = file checkout

# Only validate on branch checkouts
if [ "$CHECKOUT_TYPE" != "1" ]; then
exit 0
fi

# Get the current branch name
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)

# Skip validation for special branches
if [[ "$BRANCH_NAME" =~ ^(main|master|develop|release/.+|hotfix/.+)$ ]]; then
exit 0
fi

# Skip validation if we're in detached HEAD state
if [ "$BRANCH_NAME" = "HEAD" ]; then
exit 0
fi

# Define the valid branch name pattern
# Format: <type>-<description> or <type>/<description>
# Where type is: feat, fix, docs, style, refactor, perf, test, build, ci, chore
VALID_PATTERN="^(feat|fix|docs|style|refactor|perf|test|build|ci|chore)([-/])[a-z0-9_-]+$"

# Check if branch name matches the pattern
if [[ ! "$BRANCH_NAME" =~ $VALID_PATTERN ]]; then
cat <<EOF
╔════════════════════════════════════════════════════════════════╗
║ ❌ INVALID BRANCH NAME ║
╚════════════════════════════════════════════════════════════════╝

Branch: $BRANCH_NAME

Branch names must follow this format:
<type>-<description> or <type>/<description>

Valid types:
• feat - New feature
• fix - Bug fix
• docs - Documentation changes
• style - Code style changes
• refactor - Code refactoring
• perf - Performance improvements
• test - Test changes
• build - Build system changes
• ci - CI/CD changes
• chore - Other changes

Examples:
✅ feat-buffer-pooling
✅ fix-windows-dll-exports
✅ docs-update-readme
✅ refactor/simplify-tensor-allocation
✅ ci-add-coverage-reporting

Current branch: ❌ $BRANCH_NAME

To fix this, rename your branch:
git branch -m $BRANCH_NAME <type>-<proper-description>

Or delete and recreate:
git checkout main
git branch -D $BRANCH_NAME
git checkout -b <type>-<proper-description>

EOF
exit 1
fi

# Branch name is valid
echo "✅ Branch name '$BRANCH_NAME' is valid"
exit 0
19 changes: 17 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,33 @@ jobs:
cmake -S .. -B . -DCMAKE_BUILD_TYPE=Release -DNOVA_LLM_BUILD_TESTS=OFF -DNOVA_LLM_ENABLE_LOGGING=OFF
fi

- name: Install Doxygen
run: |
sudo apt-get update
sudo apt-get install -y doxygen graphviz

- name: Build documentation
run: |
cd build
cmake --build . --target docs || true
cmake --build . --target docs

- name: Check documentation output
run: |
if [ ! -d "docs/html" ]; then
echo "Error: Documentation not generated at docs/html"
ls -la docs/ || echo "docs/ directory not found"
exit 1
fi
echo "Documentation generated successfully"
ls -la docs/html/

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: build/docs/html
path: docs/html

- name: Deploy to GitHub Pages
id: deployment
Expand Down
Loading