This commit is contained in:
parent
968661b3ce
commit
57c927efc5
@ -27,7 +27,7 @@ jobs:
|
|||||||
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
|
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
|
||||||
if [ -f requirements/test.txt ]; then pip install -r requirements/test.txt; fi
|
if [ -f requirements/test.txt ]; then pip install -r requirements/test.txt; fi
|
||||||
# Install common test packages
|
# Install common test packages
|
||||||
pip install pytest pytest-cov flake8
|
pip install pytest pytest-cov flake8 coverage-badge interrogate
|
||||||
|
|
||||||
- name: Lint with flake8
|
- name: Lint with flake8
|
||||||
run: |
|
run: |
|
||||||
@ -37,25 +37,41 @@ jobs:
|
|||||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||||
|
|
||||||
- name: Run tests with pytest
|
- name: Run tests with pytest
|
||||||
|
id: pytest
|
||||||
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
# Run tests with coverage
|
# Run tests with coverage
|
||||||
python -m pytest tests/ -v --cov=pyWebLayout --cov-report=term-missing --cov-report=json --cov-report=html
|
python -m pytest tests/ -v --cov=pyWebLayout --cov-report=term-missing --cov-report=json --cov-report=html
|
||||||
|
|
||||||
- name: Generate test coverage badge
|
|
||||||
run: |
|
|
||||||
# Install coverage-badge for generating badges
|
|
||||||
pip install coverage-badge
|
|
||||||
# Generate coverage badge from coverage data
|
|
||||||
coverage-badge -o coverage.svg
|
|
||||||
|
|
||||||
- name: Check documentation coverage
|
- name: Check documentation coverage
|
||||||
|
id: docs
|
||||||
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
# Install interrogate for documentation coverage
|
# Generate documentation coverage report
|
||||||
pip install interrogate
|
interrogate -v --ignore-init-method --ignore-init-module --ignore-magic --ignore-private --ignore-property-decorators --ignore-semiprivate --fail-under=80 pyWebLayout/
|
||||||
# Generate documentation coverage report and badge
|
|
||||||
interrogate -v --ignore-init-method --ignore-init-module --ignore-magic --ignore-private --ignore-property-decorators --ignore-semiprivate --fail-under=80 --generate-badge coverage-docs.svg pyWebLayout/
|
- name: Generate coverage badges
|
||||||
|
run: |
|
||||||
|
COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||||
|
|
||||||
|
# Generate test coverage badge or error badge
|
||||||
|
if [ "${{ steps.pytest.outcome }}" == "success" ] && [ -f coverage.json ]; then
|
||||||
|
coverage-badge -o coverage-${COMMIT_HASH}.svg
|
||||||
|
else
|
||||||
|
# Create error badge for test coverage
|
||||||
|
curl -o coverage-${COMMIT_HASH}.svg "https://img.shields.io/badge/coverage-error-red.svg"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate docs coverage badge or error badge
|
||||||
|
if [ "${{ steps.docs.outcome }}" == "success" ]; then
|
||||||
|
interrogate --generate-badge coverage-docs-${COMMIT_HASH}.svg pyWebLayout/
|
||||||
|
else
|
||||||
|
# Create error badge for docs coverage
|
||||||
|
curl -o coverage-docs-${COMMIT_HASH}.svg "https://img.shields.io/badge/docs-error-red.svg"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Generate coverage reports
|
- name: Generate coverage reports
|
||||||
|
if: steps.pytest.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
# Generate coverage summary for README
|
# Generate coverage summary for README
|
||||||
python -c "
|
python -c "
|
||||||
@ -79,8 +95,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: coverage-reports
|
name: coverage-reports
|
||||||
path: |
|
path: |
|
||||||
coverage.svg
|
coverage-*.svg
|
||||||
coverage-docs.svg
|
coverage-docs-*.svg
|
||||||
htmlcov/
|
htmlcov/
|
||||||
coverage.json
|
coverage.json
|
||||||
coverage-summary.txt
|
coverage-summary.txt
|
||||||
@ -89,28 +105,3 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
# Test that the package can be imported
|
# Test that the package can be imported
|
||||||
python -c "import pyWebLayout; print('Package imported successfully')"
|
python -c "import pyWebLayout; print('Package imported successfully')"
|
||||||
|
|
||||||
- name: Commit coverage badges
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
run: |
|
|
||||||
echo "Current directory contents:"
|
|
||||||
ls -la *.svg || echo "No SVG files found"
|
|
||||||
echo "Checking if coverage files exist:"
|
|
||||||
ls -la coverage* || echo "No coverage files found"
|
|
||||||
|
|
||||||
git config --local user.email "action@gitea.local"
|
|
||||||
git config --local user.name "Gitea Action"
|
|
||||||
|
|
||||||
if ls coverage*.svg 1> /dev/null 2>&1; then
|
|
||||||
echo "Adding coverage badge files..."
|
|
||||||
git add coverage*.svg
|
|
||||||
if git diff --staged --quiet; then
|
|
||||||
echo "No changes to commit"
|
|
||||||
else
|
|
||||||
echo "Committing badge updates..."
|
|
||||||
git commit -m "Update coverage badges [skip ci]"
|
|
||||||
git push
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "No coverage SVG files found to commit"
|
|
||||||
fi
|
|
||||||
@ -1,13 +1,15 @@
|
|||||||
# PyWebLayout
|
# PyWebLayout
|
||||||
|
|
||||||
|
## Project Status
|
||||||
|
|
||||||
| Badge | Description |
|
| Badge | Description |
|
||||||
|-------|-------------|
|
|-------|-------------|
|
||||||
|  | **Test Coverage** - Percentage of code covered by unit tests |
|
|  | **Test Coverage** - Percentage of code covered by unit tests |
|
||||||
|  | **Documentation Coverage** - Percentage of code with docstrings |
|
|  | **Documentation Coverage** - Percentage of code with docstrings |
|
||||||
|  | **Build Status** - Current CI/CD pipeline status |
|
|  | **Build Status** - Current CI/CD pipeline status |
|
||||||
|  | **License** - Project licensing information |
|
|  | **License** - Project licensing information |
|
||||||
A Python library for HTML-like layout and rendering.
|
A Python library for HTML-like layout and rendering.
|
||||||
|
> 📋 **Note**: Badges show results from the commit referenced in the URLs. Red "error" badges indicate build failures for that specific step.
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
PyWebLayout provides classes for rendering HTML-like content to images using a box-based layout system. It includes support for text, tables, and containers, as well as an HTML parser for converting HTML to layout objects.
|
PyWebLayout provides classes for rendering HTML-like content to images using a box-based layout system. It includes support for text, tables, and containers, as well as an HTML parser for converting HTML to layout objects.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user