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
13 changes: 13 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
# devbase pre-commit hook
# Usage: git config core.hooksPath .githooks

set -e

echo "[pre-commit] cargo fmt --check"
cargo fmt --check

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

echo "[pre-commit] checks passed"
33 changes: 33 additions & 0 deletions scripts/ci-local.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env pwsh
# devbase 本地 CI 预检脚本(Windows PowerShell)
# 功能对等 GitHub Actions 的 Required Checks

$ErrorActionPreference = "Stop"

Write-Host "=== devbase Local CI ===" -ForegroundColor Cyan

Write-Host "`n[1/6] cargo fmt --check" -ForegroundColor Yellow
& cargo fmt --check
if ($LASTEXITCODE -ne 0) { throw "fmt failed" }

Write-Host "`n[2/6] cargo clippy --all-targets -- -D warnings" -ForegroundColor Yellow
& cargo clippy --all-targets -- -D warnings
if ($LASTEXITCODE -ne 0) { throw "clippy failed" }

Write-Host "`n[3/6] cargo check" -ForegroundColor Yellow
& cargo check
if ($LASTEXITCODE -ne 0) { throw "check failed" }

Write-Host "`n[4/6] cargo test --workspace -- --test-threads=4" -ForegroundColor Yellow
& cargo test --workspace -- --test-threads=4
if ($LASTEXITCODE -ne 0) { throw "test failed" }

Write-Host "`n[5/6] cargo check --features greptimedb" -ForegroundColor Yellow
& cargo check --features greptimedb
if ($LASTEXITCODE -ne 0) { throw "greptimedb feature check failed" }

Write-Host "`n[6/6] cargo audit" -ForegroundColor Yellow
& cargo audit
if ($LASTEXITCODE -ne 0) { Write-Warning "audit found issues (non-blocking)" }

Write-Host "`n=== All local checks passed ===" -ForegroundColor Green
34 changes: 34 additions & 0 deletions scripts/ci-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# devbase 本地 CI 预检脚本(WSL / Git Bash / Linux)
# 功能对等 GitHub Actions 的 Required Checks

set -euo pipefail

echo "=== devbase Local CI ==="

echo ""
echo "[1/6] cargo fmt --check"
cargo fmt --check

echo ""
echo "[2/6] cargo clippy --all-targets -- -D warnings"
cargo clippy --all-targets -- -D warnings

echo ""
echo "[3/6] cargo check"
cargo check

echo ""
echo "[4/6] cargo test --workspace -- --test-threads=4"
cargo test --workspace -- --test-threads=4

echo ""
echo "[5/6] cargo check --features greptimedb"
cargo check --features greptimedb

echo ""
echo "[6/6] cargo audit"
cargo audit || echo "warning: audit found issues (non-blocking)"

echo ""
echo "=== All local checks passed ==="
65 changes: 65 additions & 0 deletions scripts/update_readme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env python3
"""Update README.md release asset metadata.

Usage:
python scripts/update_readme.py --version v0.21.0 \
--windows-size 8.9 --linux-size 8.8
"""
import argparse
import re
import sys


def main():
parser = argparse.ArgumentParser(description="Update README release metadata")
parser.add_argument("--version", required=True, help="New version tag (e.g. v0.21.0)")
parser.add_argument("--windows-size", type=float, required=True, help="Windows asset size in MB")
parser.add_argument("--linux-size", type=float, required=True, help="Linux asset size in MB")
parser.add_argument("--readme", default="README.md", help="Path to README.md")
args = parser.parse_args()

with open(args.readme, "r", encoding="utf-8") as f:
content = f.read()

old_version_pattern = r"devbase-v[\d.]+"
new_version_str = f"devbase-{args.version}"

# Replace version references in filenames and URLs
content = re.sub(old_version_pattern, new_version_str, content)

# Replace version in directory names (e.g. devbase-v0.20.0-linux-x64)
def repl_dir(m):
return f"devbase-{args.version}-{m.group(1)}-x64"
content = re.sub(
r"devbase-v[\d.]+-(linux|windows)-x64",
repl_dir,
content,
)

# Replace version in release download URLs (/download/v0.20.0/)
content = re.sub(
r"/download/v[\d.]+/",
f"/download/{args.version}/",
content,
)

# Replace size in table
content = re.sub(
r"(\| Windows x86_64 \| .*? \| )~[\d.]+ MB( \|)",
f"\1~{args.windows_size:.1f} MB\2",
content,
)
content = re.sub(
r"(\| Linux x86_64 \| .*? \| )~[\d.]+ MB( \|)",
f"\1~{args.linux_size:.1f} MB\2",
content,
)

with open(args.readme, "w", encoding="utf-8") as f:
f.write(content)

print(f"Updated {args.readme} for version {args.version}")


if __name__ == "__main__":
main()
Loading