From 75b66a72b87c49a1f8b6585e447dc795b5b97bd1 Mon Sep 17 00:00:00 2001 From: "qwen.ai[bot]" Date: Wed, 12 Aug 2026 13:57:58 +0000 Subject: [PATCH] ci: add comprehensive CI/CD pipeline with linting, testing, security, and build jobs --- .github/workflows/ci.yml | 107 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..90eb102 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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