feat: implement blog project with CI pipeline

This commit is contained in:
2026-04-25 19:19:33 +03:00
parent bd0c21840b
commit 1a5f552b38
42 changed files with 1395 additions and 0 deletions

18
.woodpecker/deploy.yaml Normal file
View File

@@ -0,0 +1,18 @@
when:
event: [push]
branch: main
steps:
deploy:
image: python:3.13
commands:
- echo "🚀 Deploying to production..."
- echo "Branch: main"
- echo "Commit: $(git rev-parse --short HEAD)"
# Add your deployment commands here
# Example:
# - uv sync --frozen
# - uv run python -m app.main &
- echo "✅ Deployment complete"
when:
status: [success]

View File

@@ -0,0 +1,49 @@
when:
event: [push, pull_request]
steps:
check-branch:
image: alpine/git
commands:
- BRANCH=$(git rev-parse --abbrev-ref HEAD)
- |
echo "Branch: $BRANCH"
if [ "$BRANCH" = "main" ]; then
echo "✓ Production branch (protected)"
elif [ "$BRANCH" = "dev" ]; then
echo "✓ Development branch (protected)"
elif echo "$BRANCH" | grep -qE "^feature/"; then
echo "✓ Feature branch"
elif echo "$BRANCH" | grep -qE "^(fix|hotfix|release)/"; then
echo "✓ Special branch"
else
echo "⚠️ Unusual branch name: $BRANCH"
echo " Recommended: feature/<description>, fix/<description>"
fi
check-commit-message:
image: alpine/git
commands:
- MSG=$(git log -1 --pretty=%s)
- |
echo "Last commit: $MSG"
if echo "$MSG" | grep -qE "^(feat|fix|docs|style|refactor|test|chore): [a-z]"; then
echo "✓ Commit message follows convention"
else
echo "❌ Invalid commit message format"
echo " Expected: <type>: <description>"
echo " Types: feat, fix, docs, style, refactor, test, chore"
exit 1
fi
check-cache-files:
image: python:3.13
commands:
- |
CACHE_FILES=$(git diff --name-only HEAD~1 | grep -E "__pycache__|\.pyc$" || true)
if [ -n "$CACHE_FILES" ]; then
echo "❌ Cache files in commit:"
echo "$CACHE_FILES"
exit 1
fi
- echo "✓ No cache files in commit"

13
.woodpecker/lints.yaml Normal file
View File

@@ -0,0 +1,13 @@
when:
- event: [push, pull_request]
branch: main
steps:
- name: lint
image: python:3.11
commands:
- pip install uv
- uv sync --no-dev --only-group lints
- uv run black --check .
- uv run ruff check .
- uv run isort --check-only .

12
.woodpecker/tests.yaml Normal file
View File

@@ -0,0 +1,12 @@
when:
- event: [push, pull_request]
branch: main
steps:
- name: tests
image: python:3.11
commands:
- pip install uv
- uv sync --no-dev --group tests
- uv run pytest --cov=app --cov-fail-under=70 --cov-report=term-missing

11
.woodpecker/types.yaml Normal file
View File

@@ -0,0 +1,11 @@
when:
- event: [push, pull_request]
branch: main
steps:
- name: types
image: python:3.11
commands:
- pip install uv
- uv sync --no-dev --only-group types
- uv run mypy .