|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, master, develop, gamma, beta, "feature/*", "claude/*"] |
| 6 | + pull_request: |
| 7 | + branches: [main, master, develop, gamma, beta] |
| 8 | + |
| 9 | +jobs: |
| 10 | + lint: |
| 11 | + name: Lint & Format |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Set up Python |
| 17 | + uses: actions/setup-python@v5 |
| 18 | + with: |
| 19 | + python-version: "3.11" |
| 20 | + |
| 21 | + - name: Install dependencies |
| 22 | + run: | |
| 23 | + python -m pip install --upgrade pip |
| 24 | + pip install ruff black |
| 25 | +
|
| 26 | + - name: Check formatting with Black |
| 27 | + run: black --check --diff . |
| 28 | + |
| 29 | + - name: Lint with Ruff |
| 30 | + run: ruff check . |
| 31 | + |
| 32 | + type-check: |
| 33 | + name: Type Check |
| 34 | + runs-on: ubuntu-latest |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + |
| 38 | + - name: Set up Python |
| 39 | + uses: actions/setup-python@v5 |
| 40 | + with: |
| 41 | + python-version: "3.11" |
| 42 | + |
| 43 | + - name: Install dependencies |
| 44 | + run: | |
| 45 | + python -m pip install --upgrade pip |
| 46 | + pip install -e ".[dev]" |
| 47 | +
|
| 48 | + - name: Run mypy |
| 49 | + run: mypy quantcoder --ignore-missing-imports |
| 50 | + |
| 51 | + test: |
| 52 | + name: Test (Python ${{ matrix.python-version }}) |
| 53 | + runs-on: ubuntu-latest |
| 54 | + strategy: |
| 55 | + fail-fast: false |
| 56 | + matrix: |
| 57 | + python-version: ["3.10", "3.11", "3.12"] |
| 58 | + |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + |
| 62 | + - name: Set up Python ${{ matrix.python-version }} |
| 63 | + uses: actions/setup-python@v5 |
| 64 | + with: |
| 65 | + python-version: ${{ matrix.python-version }} |
| 66 | + |
| 67 | + - name: Install dependencies |
| 68 | + run: | |
| 69 | + python -m pip install --upgrade pip |
| 70 | + pip install -e ".[dev]" |
| 71 | + pip install pytest-cov pytest-mock |
| 72 | + python -m spacy download en_core_web_sm |
| 73 | +
|
| 74 | + - name: Run tests |
| 75 | + run: pytest tests/ -v --cov=quantcoder --cov-report=xml |
| 76 | + |
| 77 | + - name: Upload coverage |
| 78 | + uses: codecov/codecov-action@v3 |
| 79 | + if: matrix.python-version == '3.11' |
| 80 | + with: |
| 81 | + files: ./coverage.xml |
| 82 | + fail_ci_if_error: false |
| 83 | + |
| 84 | + security: |
| 85 | + name: Security Scan |
| 86 | + runs-on: ubuntu-latest |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v4 |
| 89 | + |
| 90 | + - name: Set up Python |
| 91 | + uses: actions/setup-python@v5 |
| 92 | + with: |
| 93 | + python-version: "3.11" |
| 94 | + |
| 95 | + - name: Install dependencies |
| 96 | + run: | |
| 97 | + python -m pip install --upgrade pip |
| 98 | + pip install pip-audit |
| 99 | +
|
| 100 | + - name: Run pip-audit |
| 101 | + run: pip-audit --require-hashes=false || true |
| 102 | + |
| 103 | + secret-scan: |
| 104 | + name: Secret Scanning |
| 105 | + runs-on: ubuntu-latest |
| 106 | + steps: |
| 107 | + - uses: actions/checkout@v4 |
| 108 | + with: |
| 109 | + fetch-depth: 0 |
| 110 | + |
| 111 | + - name: TruffleHog Secret Scan |
| 112 | + uses: trufflesecurity/trufflehog@main |
| 113 | + with: |
| 114 | + extra_args: --only-verified |
0 commit comments