Skip to content

fix: repair MASK strategy and reject unusable hash_type values #54

fix: repair MASK strategy and reject unusable hash_type values

fix: repair MASK strategy and reject unusable hash_type values #54

Workflow file for this run

name: CI - Test Suite
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
env:
PYTHONUNBUFFERED: 1
PYTHONDONTWRITEBYTECODE: 1
ENVIRONMENT: testing
jobs:
test:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
permissions:
checks: write
pull-requests: write
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.12", "3.13"]
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: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y build-essential
- name: Install system dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install gcc
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel pytest httpx pytest-cov pytest-asyncio mypy black isort flake8
pip install -r requirements.txt
- name: Install spaCy model
run: |
python -m spacy download en_core_web_lg --quiet
continue-on-error: true
- name: Type check with mypy
run: |
mypy main.py --ignore-missing-imports
continue-on-error: true
- name: Format check with black
run: |
black --check main.py tests/
continue-on-error: true
# - name: Import sort check with isort
# run: |
# isort --check-only main.py tests/
# continue-on-error: true
- name: Run simple tests first
run: |
pytest tests/test_simple.py -v --tb=short
- name: Run unit tests
run: |
pytest -m "unit" -v --tb=short --cov=main --cov-report=term-missing
continue-on-error: true
- name: Run integration tests
run: |
pytest -m "integration" -v --tb=short --cov=main --cov-append --cov-report=term-missing
continue-on-error: true
- name: Run performance tests
run: |
pytest -m "performance" -v --tb=short --cov=main --cov-append --cov-report=term-missing
continue-on-error: true
- name: Run all tests with coverage
run: |
pytest --cov=main --cov-report=xml --cov-report=html --cov-report=term-missing --junitxml=pytest-results.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.os }}-${{ matrix.python-version }}
path: |
pytest-results.xml
htmlcov/
coverage.xml
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always() && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
continue-on-error: true
with:
files: pytest-results.xml
check_name: "Test Results (Python ${{ matrix.python-version }})"
comment_title: "Test Results"
fail_on: "errors"
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: test
if: always()
steps:
- name: Check test results
run: |
if [[ "${{ needs.test.result }}" == "failure" ]]; then
echo "❌ Some tests failed"
exit 1
elif [[ "${{ needs.test.result }}" == "success" ]]; then
echo "✅ All tests passed"
else
echo "⚠️ Tests completed with issues"
fi
security-scan:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- 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 safety bandit
- name: Run safety check
run: |
pip freeze | safety check --json || true
- name: Run bandit security check
run: |
bandit -r main.py -f json || true
code-quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- name: Checkout code
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
- name: Run comprehensive linting
run: |
echo "🔍 Running flake8..."
flake8 main.py tests/ --statistics || true
echo "🔍 Running mypy..."
mypy main.py --ignore-missing-imports || true
echo "🔍 Checking code formatting..."
black --check main.py tests/ || true
echo "🔍 Checking import sorting..."
isort --check-only main.py tests/ || true
- name: Generate code quality report
run: |
echo "📊 Code Quality Summary:" > quality-report.txt
echo "=========================" >> quality-report.txt
echo "" >> quality-report.txt
echo "Flake8 Issues:" >> quality-report.txt
flake8 main.py tests/ --count || echo "No issues found" >> quality-report.txt
echo "" >> quality-report.txt
echo "Lines of Code:" >> quality-report.txt
find . -name "*.py" -not -path "./venv/*" -not -path "./.venv/*" | xargs wc -l | tail -1 >> quality-report.txt
cat quality-report.txt
- name: Upload quality report
uses: actions/upload-artifact@v4
with:
name: code-quality-report
path: quality-report.txt