Skip to content

Add regression guardrails for restored features #114

Add regression guardrails for restored features

Add regression guardrails for restored features #114

Workflow file for this run

name: CI
on:
push:
pull_request:
jobs:
restored-feature-guard:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install project
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
- name: Restored feature regression guard
run: >
pytest -q
tests/test_protector.py
tests/test_privacy_profiles.py
tests/web/test_pcap_runner.py
tests/web/test_profiles.py
tests/web/test_profiles_routes.py
tests/web/test_web_upload.py
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install project
run: |
python -m pip install --upgrade pip setuptools wheel build
python -m pip install -e .[dev]
- name: Ruff
run: ruff check .
- name: Bandit web hardening scan
run: bandit -r -ll src/pcap2llm/web/
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install tshark
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y tshark
- name: Install project
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev,encrypt]
- name: Tests
run: pytest -q
- name: Web smoke test
if: matrix.python-version == '3.12'
run: bash scripts/smoke_test_web_gui.sh
- name: Upload failure artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-debug-${{ matrix.python-version }}
path: |
tests/fixtures/golden/**/expected_*.json
artifacts/**
local-files-guard:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Block tracked local runtime artifacts
run: |
tracked="$(git ls-files '.local' | grep -Ev '^\.local/(\.gitkeep|README\.md)$' || true)"
if [ -n "$tracked" ]; then
echo "ERROR: forbidden tracked files found under .local/:" >&2
printf '%s\n' "$tracked" | sed 's/^/ /' >&2
exit 1
fi
tracked_profiles="$(git ls-files 'profiles' | grep -E '^profiles/.+\.json$' || true)"
if [ -n "$tracked_profiles" ]; then
echo "ERROR: forbidden tracked runtime profiles found under profiles/:" >&2
printf '%s\n' "$tracked_profiles" | sed 's/^/ /' >&2
exit 1
fi
echo "OK: no disallowed runtime artifacts tracked under .local/ or profiles/"
packaging:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install project
run: |
python -m pip install --upgrade pip setuptools wheel build
python -m pip install -e .[dev]
- name: Build package
run: python -m build --no-isolation
- name: Validate wheel metadata
run: python scripts/check_package_metadata.py dist/*.whl dist/*.tar.gz
- name: Upload packaging artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: packaging-debug
path: |
dist/**
pyproject.toml