Skip to content

Commit af51965

Browse files
committed
Modernize CI/CD workflows and release v1.1.3
- Updated CI workflow to use official pdm-project/setup-pdm@v4 action - Added Python multi-version matrix testing (3.10, 3.11, 3.12) - Enabled dependency caching for faster builds - Added Codecov integration and security scanning - Created modern publishing workflow with PyPI Trusted Publishers - Added Dependabot configuration for automatic dependency updates - Updated development dependencies (coverage 7.0+, safety, twine) - Comprehensive changelog documenting all Vibe Coding enhancements
1 parent f00c2a2 commit af51965

File tree

6 files changed

+355
-8
lines changed

6 files changed

+355
-8
lines changed

.github/dependabot.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: 2
2+
3+
updates:
4+
# Enable version updates for Python dependencies
5+
- package-ecosystem: "pip"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+
day: "monday"
10+
time: "09:00"
11+
open-pull-requests-limit: 10
12+
reviewers:
13+
- "pi-dal"
14+
labels:
15+
- "dependencies"
16+
- "python"
17+
commit-message:
18+
prefix: "deps"
19+
include: "scope"
20+
21+
# Enable version updates for GitHub Actions
22+
- package-ecosystem: "github-actions"
23+
directory: "/"
24+
schedule:
25+
interval: "weekly"
26+
day: "monday"
27+
time: "09:00"
28+
open-pull-requests-limit: 5
29+
reviewers:
30+
- "pi-dal"
31+
labels:
32+
- "dependencies"
33+
- "github-actions"
34+
commit-message:
35+
prefix: "ci"
36+
include: "scope"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Dependabot auto-merge
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
dependabot:
9+
runs-on: ubuntu-latest
10+
if: github.actor == 'dependabot[bot]'
11+
12+
steps:
13+
- name: Dependabot metadata
14+
id: metadata
15+
uses: dependabot/fetch-metadata@v2
16+
with:
17+
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
19+
- name: Enable auto-merge for Dependabot PRs
20+
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' }}
21+
run: gh pr merge --auto --merge "$PR_URL"
22+
env:
23+
PR_URL: ${{ github.event.pull_request.html_url }}
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/main_ci.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.10", "3.11", "3.12"]
17+
django-version: ["5.2"]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Setup PDM
23+
uses: pdm-project/setup-pdm@v4
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
cache: true
27+
28+
- name: Install dependencies
29+
run: |
30+
pdm install --dev
31+
pdm add django==${{ matrix.django-version }}
32+
33+
- name: Run Linting (flake8)
34+
run: pdm run flake8 .
35+
36+
- name: Run Formatting Check (black)
37+
run: pdm run black --check .
38+
39+
- name: Run Type Checking (mypy)
40+
run: pdm run mypy .
41+
42+
- name: Run Unit Tests with Coverage
43+
run: |
44+
pdm run coverage run manage.py test
45+
pdm run coverage report -m
46+
pdm run coverage xml
47+
48+
- name: Upload coverage to Codecov
49+
uses: codecov/codecov-action@v4
50+
with:
51+
file: ./coverage.xml
52+
flags: unittests
53+
name: codecov-umbrella
54+
fail_ci_if_error: false
55+
56+
security:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- name: Setup PDM
62+
uses: pdm-project/setup-pdm@v4
63+
with:
64+
python-version: '3.11'
65+
cache: true
66+
67+
- name: Install dependencies
68+
run: pdm install --dev
69+
70+
- name: Run security scan
71+
run: pdm run safety check --json || true

.github/workflows/publish.yml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
environment:
9+
description: 'Publishing environment'
10+
required: true
11+
default: 'testpypi'
12+
type: choice
13+
options:
14+
- testpypi
15+
- pypi
16+
17+
jobs:
18+
test:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
python-version: ["3.10", "3.11", "3.12"]
23+
django-version: ["5.2"]
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Setup PDM
29+
uses: pdm-project/setup-pdm@v4
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
cache: true
33+
34+
- name: Install dependencies
35+
run: |
36+
pdm install --dev
37+
pdm add django==${{ matrix.django-version }}
38+
39+
- name: Run tests
40+
run: |
41+
pdm run coverage run manage.py test
42+
pdm run coverage report -m
43+
44+
- name: Run linting
45+
run: |
46+
pdm run flake8 .
47+
pdm run black --check .
48+
pdm run mypy .
49+
50+
build:
51+
runs-on: ubuntu-latest
52+
needs: [test]
53+
54+
steps:
55+
- uses: actions/checkout@v4
56+
with:
57+
fetch-depth: 0 # Needed for version calculation
58+
59+
- name: Setup PDM
60+
uses: pdm-project/setup-pdm@v4
61+
with:
62+
python-version: '3.11'
63+
cache: true
64+
65+
- name: Build package
66+
run: |
67+
pdm build
68+
69+
- name: Check build artifacts
70+
run: |
71+
ls -la dist/
72+
pdm run twine check dist/*
73+
74+
- name: Upload build artifacts
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: python-package-distributions
78+
path: dist/
79+
80+
publish-to-testpypi:
81+
name: Publish to TestPyPI
82+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'testpypi' }}
83+
needs: [build]
84+
runs-on: ubuntu-latest
85+
environment:
86+
name: testpypi
87+
url: https://test.pypi.org/p/django-vditor
88+
permissions:
89+
id-token: write
90+
91+
steps:
92+
- name: Download build artifacts
93+
uses: actions/download-artifact@v4
94+
with:
95+
name: python-package-distributions
96+
path: dist/
97+
98+
- name: Publish to TestPyPI
99+
uses: pypa/gh-action-pypi-publish@release/v1
100+
with:
101+
repository-url: https://test.pypi.org/legacy/
102+
103+
publish-to-pypi:
104+
name: Publish to PyPI
105+
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
106+
needs: [build]
107+
runs-on: ubuntu-latest
108+
environment:
109+
name: pypi
110+
url: https://pypi.org/p/django-vditor
111+
permissions:
112+
id-token: write
113+
114+
steps:
115+
- name: Download build artifacts
116+
uses: actions/download-artifact@v4
117+
with:
118+
name: python-package-distributions
119+
path: dist/
120+
121+
- name: Publish to PyPI
122+
uses: pypa/gh-action-pypi-publish@release/v1
123+
124+
github-release:
125+
name: Sign and upload to GitHub Release
126+
needs: [publish-to-pypi]
127+
runs-on: ubuntu-latest
128+
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
129+
permissions:
130+
contents: write
131+
id-token: write
132+
133+
steps:
134+
- name: Download build artifacts
135+
uses: actions/download-artifact@v4
136+
with:
137+
name: python-package-distributions
138+
path: dist/
139+
140+
- name: Sign the dists with Sigstore
141+
uses: sigstore/[email protected]
142+
with:
143+
inputs: >-
144+
./dist/*.tar.gz
145+
./dist/*.whl
146+
147+
- name: Upload artifact signatures to GitHub Release
148+
env:
149+
GITHUB_TOKEN: ${{ github.token }}
150+
run: >-
151+
gh release upload
152+
'${{ github.ref_name }}' dist/**
153+
--repo '${{ github.repository }}'

CHANGELOG.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,56 @@
1+
## v1.1.3 (2025-01-06)
2+
3+
### Added
4+
- **🚀 Production-Ready Enhancements by Vibe Coding**
5+
- Complete type hints for better IDE support and code safety
6+
- Comprehensive security enhancements with file validation and content sanitization
7+
- Multi-level caching system for improved performance
8+
- Enhanced error handling and logging throughout the codebase
9+
- Django management commands for cache operations (`vditor_cache`)
10+
- Security utilities module with file validation and path traversal protection
11+
- Performance optimizations with LRU caching and file deduplication
12+
13+
### Changed
14+
- **🔧 Code Quality Improvements**
15+
- Formatted all code with Black for consistent style
16+
- Enhanced test suite with 31/31 tests passing
17+
- Improved error messages and user feedback
18+
- Updated README with comprehensive documentation and Vibe Coding attribution
19+
- Modernized CI/CD workflows with GitHub Actions best practices
20+
21+
### Security
22+
- **🔒 Enhanced Security Features**
23+
- File upload validation with magic number detection
24+
- Content sanitization and dangerous pattern detection
25+
- Path traversal protection
26+
- Secure filename handling
27+
- Comprehensive logging for security events
28+
29+
### Performance
30+
- **⚡ Performance Optimizations**
31+
- Configuration caching with LRU cache
32+
- File deduplication using content hashing
33+
- Atomic file operations for safe uploads
34+
- Cache invalidation strategies
35+
36+
### Infrastructure
37+
- **🛠️ CI/CD Modernization**
38+
- Updated to use official `pdm-project/setup-pdm@v4` action
39+
- Added Python multi-version matrix testing (3.10, 3.11, 3.12)
40+
- Enabled dependency caching for faster builds
41+
- Added Codecov integration for coverage reporting
42+
- Implemented security scanning with safety
43+
- Created modern publishing workflow with PyPI Trusted Publishers
44+
- Added Dependabot configuration for automatic dependency updates
45+
- Support for both TestPyPI and PyPI publishing environments
46+
47+
### Requirements
48+
- **📋 Updated Dependencies**
49+
- Minimum Python version: 3.10+
50+
- Minimum Django version: 5.2+
51+
- Updated coverage to 7.0+
52+
- Added safety, twine for development
53+
154
## v1.1.2 (2022-08-30)
255

356
### Feat

pyproject.toml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
[project]
22
name = "django-vditor"
3-
version = {use_scm = true}
3+
version = "0.1.0"
44
description = "A WYSIWYG editor plugin made by vditor for django"
55
readme = "README.md"
6-
keywords = ["django", "editor", "django-application"]
6+
keywords = [
7+
"django",
8+
"editor",
9+
"django-application",
10+
]
711
authors = [
812
{name = "pi-dal", email = "[email protected]"},
913
]
1014
dependencies = [
11-
"django>=2.2",
15+
"django>=5.2",
16+
"werkzeug",
1217
]
13-
requires-python = ">=3.5"
14-
dynamic = ["version", "classifiers"]
18+
requires-python = ">=3.10"
19+
classifiers = []
1520
license = {text = "MIT"}
1621

1722
[project.urls]
@@ -28,9 +33,14 @@ includes = [
2833

2934
[tool.pdm.dev-dependencies]
3035
dev = [
31-
"coverage~=5.4",
36+
"coverage>=7.0",
37+
"flake8",
38+
"black",
39+
"mypy",
40+
"safety",
41+
"twine",
3242
]
3343

3444
[build-system]
35-
requires = ["pdm-pep517"]
36-
build-backend = "pdm.pep517.api"
45+
requires = ["pdm-backend"]
46+
build-backend = "pdm.backend"

0 commit comments

Comments
 (0)