Skip to content

feat(release): implement weekly release plan infrastructure #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 27, 2025
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
14 changes: 14 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[bumpversion]
current_version = 4.1.1
commit = True
tag = True
tag_name = v{new_version}
message = Bump version: {current_version} → {new_version}

[bumpversion:file:datafog/__about__.py]
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"

[bumpversion:file:setup.py]
search = version="{current_version}"
replace = version="{new_version}"
31 changes: 28 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ jobs:
sudo apt-get update
sudo apt-get install -y tesseract-ocr libtesseract-dev

- name: Install dependencies
- name: Install all dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[nlp,ocr]"
pip install -e ".[all]"
pip install -r requirements-dev.txt

- name: Run tests
- name: Run full test suite
run: |
python -m pytest tests/ --cov=datafog --cov-report=xml --cov-report=term

Expand All @@ -54,6 +54,31 @@ jobs:
file: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}

test-core:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install core dependencies only
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest pytest-cov

- name: Test core functionality
run: |
python -c "from datafog import detect_pii, anonymize_text; print('Core API works')"
python -c "from datafog import detect, process; print('Legacy API works')"
python -m pytest tests/test_regex_annotator.py -v

wheel-size:
runs-on: ubuntu-latest
steps:
Expand Down
112 changes: 112 additions & 0 deletions .github/workflows/weekly-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Weekly Release

on:
schedule:
# Every Friday at 2 PM UTC
- cron: "0 14 * * 5"
workflow_dispatch:
inputs:
release_type:
description: "Release type"
required: true
default: "patch"
type: choice
options:
- patch
- minor
- major

jobs:
release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev'

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install bump2version build twine
pip install -e .[all]

- name: Run full test suite
run: |
python -m pytest tests/ --cov=datafog
python -m pytest tests/benchmark_text_service.py

- name: Generate changelog
run: |
python scripts/generate_changelog.py

- name: Determine version bump
id: version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "bump_type=${{ github.event.inputs.release_type }}" >> $GITHUB_OUTPUT
else
# Auto-determine based on commit messages
if git log --oneline $(git describe --tags --abbrev=0)..HEAD | grep -q "BREAKING"; then
echo "bump_type=major" >> $GITHUB_OUTPUT
elif git log --oneline $(git describe --tags --abbrev=0)..HEAD | grep -q "feat:"; then
echo "bump_type=minor" >> $GITHUB_OUTPUT
else
echo "bump_type=patch" >> $GITHUB_OUTPUT
fi
fi

- name: Bump version
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
bump2version ${{ steps.version.outputs.bump_type }}
echo "NEW_VERSION=$(python -c 'from datafog import __version__; print(__version__)')" >> $GITHUB_ENV

- name: Build package
run: |
python -m build

- name: Check wheel size
run: |
WHEEL_SIZE=$(du -m dist/*.whl | cut -f1)
if [ "$WHEEL_SIZE" -ge 5 ]; then
echo "❌ Wheel size too large: ${WHEEL_SIZE}MB"
exit 1
fi
echo "✅ Wheel size OK: ${WHEEL_SIZE}MB"

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*

- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v${{ env.NEW_VERSION }} \
--title "DataFog v${{ env.NEW_VERSION }}" \
--notes-file CHANGELOG_LATEST.md \
dist/*

- name: Push changes
run: |
git push origin dev --tags

- name: Notify Discord
if: env.DISCORD_WEBHOOK
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: |
curl -X POST "$DISCORD_WEBHOOK" \
-H "Content-Type: application/json" \
-d "{\"content\": \"🚀 DataFog v${{ env.NEW_VERSION }} is live! Install with: \`pip install datafog==${{ env.NEW_VERSION }}\`\"}"
38 changes: 0 additions & 38 deletions .github/workflows/wheel_size.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Claude.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
- **Graceful Degradation**: Smart imports with helpful error messages for missing extras
- **Fair Benchmark Analysis**: Independent performance validation scripts

### ✅ Critical Bug Fixes Resolved (December 2024)
### ✅ Critical Bug Fixes Resolved (May 2025)
- **CI/CD Stability**: Fixed GitHub Actions failures while preserving lean architecture
- **Structured Output Bug**: Resolved multi-chunk text processing in TextService
- **Test Suite Health**: Improved from 33% to 87% test success rate (156/180 passing)
Expand Down
9 changes: 8 additions & 1 deletion datafog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

from .__about__ import __version__

# Import core API functions
from .core import anonymize_text, detect_pii, get_supported_entities, scan_text

# Core imports - always available
from .models.annotator import AnnotationResult, AnnotatorRequest
from .models.anonymizer import (
Expand Down Expand Up @@ -78,7 +81,7 @@ def _missing_dependency(*args, **kwargs):
)


# Simple API for core functionality
# Simple API for core functionality (backward compatibility)
def detect(text: str) -> list:
"""
Detect PII in text using regex patterns.
Expand Down Expand Up @@ -169,6 +172,10 @@ def process(text: str, anonymize: bool = False, method: str = "redact") -> dict:
"__version__",
"detect",
"process",
"detect_pii",
"anonymize_text",
"scan_text",
"get_supported_entities",
"AnnotationResult",
"AnnotatorRequest",
"AnonymizationResult",
Expand Down
Loading