|
1 | | -name: test |
| 1 | +name: CI |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: [main] |
6 | 6 | pull_request: |
| 7 | + schedule: |
| 8 | + # Weekly (Mon 06:00 UTC) so pip-audit catches newly disclosed CVEs even |
| 9 | + # without a code change. |
| 10 | + - cron: "0 6 * * 1" |
7 | 11 |
|
8 | 12 | jobs: |
9 | 13 | lint: |
@@ -70,10 +74,27 @@ jobs: |
70 | 74 | - name: Install dependencies |
71 | 75 | run: | |
72 | 76 | python -m pip install --upgrade pip |
73 | | - pip install -e . |
| 77 | + pip install -e . "coverage[toml]>=7.0" |
74 | 78 |
|
75 | | - - name: Run tests |
76 | | - run: python -m unittest discover -s tests -v |
| 79 | + - name: Run tests with coverage |
| 80 | + run: coverage run -m unittest discover -s tests -v |
| 81 | + |
| 82 | + # `coverage report` enforces `fail_under` from pyproject.toml (90%), |
| 83 | + # so an insufficiently-tested change fails this job. |
| 84 | + - name: Coverage report (enforces fail_under) |
| 85 | + run: coverage report |
| 86 | + |
| 87 | + - name: Coverage XML |
| 88 | + if: always() |
| 89 | + run: coverage xml |
| 90 | + |
| 91 | + - name: Upload coverage report |
| 92 | + if: always() |
| 93 | + uses: actions/upload-artifact@v4 |
| 94 | + with: |
| 95 | + name: coverage-${{ matrix.python-version }} |
| 96 | + path: coverage.xml |
| 97 | + if-no-files-found: ignore |
77 | 98 |
|
78 | 99 | package: |
79 | 100 | name: Build wheel, install & CLI smoke test |
@@ -128,3 +149,25 @@ jobs: |
128 | 149 | with: |
129 | 150 | name: dist |
130 | 151 | path: dist/* |
| 152 | + |
| 153 | + audit: |
| 154 | + name: pip-audit (dependency CVEs) |
| 155 | + runs-on: ubuntu-latest |
| 156 | + steps: |
| 157 | + - uses: actions/checkout@v4 |
| 158 | + |
| 159 | + - uses: actions/setup-python@v5 |
| 160 | + with: |
| 161 | + python-version: "3.12" |
| 162 | + |
| 163 | + - name: Install pip-audit |
| 164 | + run: | |
| 165 | + python -m pip install --upgrade pip |
| 166 | + pip install "pip-audit>=2.7" |
| 167 | +
|
| 168 | + # Audit the PROJECT's dependency closure resolved from pyproject.toml |
| 169 | + # (rich, httpx, prompt_toolkit + transitives) — NOT the whole runner |
| 170 | + # environment, which would flag unrelated tooling like pip/setuptools. |
| 171 | + # Record accepted/unfixable advisories with `--ignore-vuln <ID>`. |
| 172 | + - name: pip-audit |
| 173 | + run: pip-audit . --strict --progress-spinner=off |
0 commit comments