ci: add comprehensive CI/CD pipeline with linting, testing, security, and build jobs

This commit is contained in:
qwen.ai[bot] 2026-08-12 13:57:58 +00:00
parent 425aba531b
commit 75b66a72b8

107
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,107 @@
name: CI/CD Pipeline
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
schedule:
- cron: '0 2 * * *' # Daily security checks
jobs:
lint:
name: Lint & Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
run: pip install uv
- name: Install dependencies
run: uv pip install -e .[dev]
- name: Run Ruff
run: ruff check src/ tests/
- name: Run Black
run: black --check src/ tests/
- name: Run MyPy
run: mypy src/ --ignore-missing-imports
test:
name: Test Suite
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 }}
- name: Install uv
run: pip install uv
- name: Install dependencies
run: uv pip install -e .[dev]
- name: Run pytest with coverage
run: pytest tests/ -v --cov=src/netsleuth --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
security:
name: Security Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
run: pip install uv
- name: Install dependencies
run: uv pip install -e . bandit pip-audit
- name: Run Bandit
run: bandit -r src/ -ll
- name: Run pip-audit
run: pip-audit || true
build:
name: Build & Package
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
run: pip install uv
- name: Build package
run: uv pip install build && python -m build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
docs:
name: Documentation Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
run: pip install uv
- name: Install dependencies
run: uv pip install -e .[docs]
- name: Build documentation
run: sphinx-build -b html docs/source docs/build