Update test_logger.py #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI – Test, Lint & Security | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| # ── Unit Tests (Matrix Python Versions) ────────────────────────────── | |
| test: | |
| name: Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest | |
| - name: Run unit tests | |
| run: pytest tests/ -v | |
| # ── Linting (PEP8 & Code Quality) ──────────────────────────────────── | |
| lint: | |
| name: Lint with flake8 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install flake8 | |
| run: pip install flake8 | |
| - name: Run flake8 on source files | |
| run: | | |
| # Find all Python files excluding tests/ and helloworld.py | |
| find . -type f -name '*.py' \ | |
| ! -path './tests/*' \ | |
| ! -name 'helloworld.py' \ | |
| -exec flake8 --count --select=E9,F63,F7,F82 --show-source --statistics {} + | |
| # ── Security Scan (Bandit) ─────────────────────────────────────────── | |
| security: | |
| name: Security scan with Bandit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Bandit | |
| run: pip install bandit | |
| - name: Run Bandit | |
| run: bandit -r core/ lib/ main.py -f custom -ll | |
| # ── Dependency Vulnerability Check (Safety) ────────────────────────── | |
| dependency-check: | |
| name: Dependency vulnerability check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install safety | |
| run: pip install safety | |
| - name: Check dependencies | |
| run: safety check -r requirements.txt |