|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master, development ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + test: |
| 14 | + name: Test (py${{ matrix.python-version }}) |
| 15 | + runs-on: ubuntu-latest |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ] |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v6 |
| 22 | + - uses: actions/setup-python@v6 |
| 23 | + with: |
| 24 | + python-version: ${{ matrix.python-version }} |
| 25 | + allow-prereleases: true |
| 26 | + - name: Install dependencies |
| 27 | + run: | |
| 28 | + python -m pip install --upgrade pip wheel setuptools |
| 29 | + pip install -e . -r requirements-dev.txt |
| 30 | + - name: Run tests (PostgreSQL + ClickHouse via testcontainers) |
| 31 | + run: python -m pytest --cov=rick_db --cov-report=term-missing |
| 32 | + |
| 33 | + lint: |
| 34 | + name: Lint |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v6 |
| 38 | + - uses: actions/setup-python@v6 |
| 39 | + with: |
| 40 | + python-version: "3.12" |
| 41 | + - name: Install lint tools |
| 42 | + run: pip install flake8 black |
| 43 | + - name: flake8 (real errors) |
| 44 | + run: flake8 --select=E9,F63,F7,F82,F811 rick_db |
| 45 | + - name: black --check (advisory) |
| 46 | + # Advisory only: emit a clean notice on drift instead of a failing step. |
| 47 | + run: | |
| 48 | + black --check --diff rick_db \ |
| 49 | + || echo "::notice title=black::formatting drift detected (advisory; run 'black rick_db')" |
| 50 | +
|
| 51 | + build: |
| 52 | + name: Build |
| 53 | + runs-on: ubuntu-latest |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v6 |
| 56 | + - uses: actions/setup-python@v6 |
| 57 | + with: |
| 58 | + python-version: "3.12" |
| 59 | + - name: Build sdist + wheel |
| 60 | + run: | |
| 61 | + pip install build |
| 62 | + python -m build |
| 63 | +
|
| 64 | + security: |
| 65 | + name: Vulnerability + SAST |
| 66 | + runs-on: ubuntu-latest |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@v6 |
| 69 | + - uses: actions/setup-python@v6 |
| 70 | + with: |
| 71 | + python-version: "3.12" |
| 72 | + - name: Install |
| 73 | + run: | |
| 74 | + python -m pip install --upgrade pip |
| 75 | + pip install -e . pip-audit bandit |
| 76 | + - name: pip-audit (dependency CVEs) |
| 77 | + # editable self-install is skipped; dependencies are still audited and |
| 78 | + # the step fails on any known CVE. |
| 79 | + run: pip-audit --skip-editable --desc |
| 80 | + - name: bandit (SAST) |
| 81 | + run: bandit -r rick_db -ll -x tests |
| 82 | + |
| 83 | + ci-success: |
| 84 | + name: CI Success |
| 85 | + runs-on: ubuntu-latest |
| 86 | + needs: [ test, lint, build, security ] |
| 87 | + if: always() |
| 88 | + steps: |
| 89 | + - name: Verify all jobs passed |
| 90 | + if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} |
| 91 | + run: | |
| 92 | + echo "One or more required jobs failed." |
| 93 | + exit 1 |
| 94 | + - name: Success |
| 95 | + run: echo "All CI jobs passed." |
0 commit comments