8000 Feature/phase 1 docs di by dominicusin · Pull Request #23 · dominicusin/package-maximizer · GitHub
[go: up one dir, main page]

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
131 changes: 122 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,77 @@ env:
PYTHON_VERSION: "3.11"

jobs:
# ─── Security checks ────────────────────────────────────────
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install bandit safety

- name: Run Bandit security linter
run: |
bandit -r package_maximizer/ -f json -o bandit-report.json || true
bandit -r package_maximizer/ -f screen --severity-level medium

- name: Check for known vulnerabilities
run: safety check -r requirements.txt --full-report || true

- name: Upload security report
if: always()
uses: actions/upload-artifact@v4
with:
name: security-report
path: bandit-report.json

# ─── Linting ────────────────────────────────────────────────
lint:
name: Code Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt

- name: Lint with flake8
run: |
flake8 package_maximizer/ tests/ --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 package_maximizer/ tests/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Type check with mypy
run: mypy package_maximizer/ --ignore-missing-imports || true

- name: Check formatting with black
run: black --check package_maximizer/ tests/ || true

- name: Check imports with isort
run: isort --check-only package_maximizer/ tests/ || true

# ─── Tests across matrix ────────────────────────────────────
test:
name: Test (${{ matrix.os }}, Python ${{ matrix.python-version }})
needs: [security, lint]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12"]
Expand Down Expand Up @@ -45,20 +113,65 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e ".[dev,all]"

- name: Lint with flake8
run: |
flake8 package_maximizer/ tests/ --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 package_maximizer/ tests/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
pip install -e ".[dev]"

- name: Test with pytest
- name: Run tests with pytest
run: |
pytest tests/ -v --cov=package_maximizer --cov-report=xml --cov-report=term
pytest tests/ -v --cov=package_maximizer --cov-report=xml --cov-report=term -n auto --tb=short

- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }}
name: codecov-ubuntu-py311

# ─── Build package ─────────────────────────────────────────
build:
name: Build Distribution
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v4

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

- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: python -m build

- name: Check package with twine
run: twine check dist/*

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

# ─── Publish to PyPI ────────────────────────────────────────
publish:
name: Publish to PyPI
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
environment: production
permissions:
id-token: write

steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Loading
Loading
0