name: Python Check
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - name: Install deps
        run: pip install -r requirements.txt
      - name: Compile touched Python files
        run: python3 -m py_compile python/*.py qubo/*.py tests/*.py
      - name: Run tests
        run: PYTHONPATH=$GITHUB_WORKSPACE pytest tests/ -v
      - name: Check for secrets
        run: |
          if grep -rn "api_key\|password\|token\|secret" --include="*.py" python/ qubo/ tests/; then
            echo "ERROR: Hardcoded secrets found"
            exit 1
          fi
