|
| 1 | +# SPDX-FileCopyrightText: 2026 The Botanu Authors |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +name: CI |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [main, developer-deborah] |
| 9 | + pull_request: |
| 10 | + branches: [main] |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + # ------------------------------------------------------------------- |
| 17 | + # Lint & format check |
| 18 | + # ------------------------------------------------------------------- |
| 19 | + lint: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + - uses: actions/setup-python@v5 |
| 24 | + with: |
| 25 | + python-version: "3.12" |
| 26 | + - run: pip install ruff |
| 27 | + - run: ruff check src/ tests/ |
| 28 | + - run: ruff format --check src/ tests/ |
| 29 | + |
| 30 | + # ------------------------------------------------------------------- |
| 31 | + # Type checking |
| 32 | + # ------------------------------------------------------------------- |
| 33 | + typecheck: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + - uses: actions/setup-python@v5 |
| 38 | + with: |
| 39 | + python-version: "3.12" |
| 40 | + - run: pip install -e ".[dev]" |
| 41 | + - run: mypy src/botanu/ |
| 42 | + |
| 43 | + # ------------------------------------------------------------------- |
| 44 | + # Test matrix — Python 3.9 → 3.13 |
| 45 | + # ------------------------------------------------------------------- |
| 46 | + test: |
| 47 | + runs-on: ubuntu-latest |
| 48 | + strategy: |
| 49 | + fail-fast: false |
| 50 | + matrix: |
| 51 | + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v4 |
| 54 | + with: |
| 55 | + fetch-depth: 0 # hatch-vcs needs full history |
| 56 | + |
| 57 | + - uses: actions/setup-python@v5 |
| 58 | + with: |
| 59 | + python-version: ${{ matrix.python-version }} |
| 60 | + |
| 61 | + - name: Install dependencies |
| 62 | + run: pip install -e ".[dev]" |
| 63 | + |
| 64 | + - name: Run tests with coverage |
| 65 | + run: pytest --cov=botanu --cov-report=xml --cov-report=term-missing |
| 66 | + |
| 67 | + - name: Upload coverage |
| 68 | + if: matrix.python-version == '3.12' |
| 69 | + uses: codecov/codecov-action@v4 |
| 70 | + with: |
| 71 | + file: coverage.xml |
| 72 | + fail_ci_if_error: false |
| 73 | + |
| 74 | + # ------------------------------------------------------------------- |
| 75 | + # Build verification — ensure the package builds cleanly |
| 76 | + # ------------------------------------------------------------------- |
| 77 | + build: |
| 78 | + runs-on: ubuntu-latest |
| 79 | + steps: |
| 80 | + - uses: actions/checkout@v4 |
| 81 | + with: |
| 82 | + fetch-depth: 0 |
| 83 | + - uses: actions/setup-python@v5 |
| 84 | + with: |
| 85 | + python-version: "3.12" |
| 86 | + - run: pip install build |
| 87 | + - run: python -m build |
| 88 | + - uses: actions/upload-artifact@v4 |
| 89 | + with: |
| 90 | + name: dist |
| 91 | + path: dist/ |
| 92 | + |
| 93 | + # ------------------------------------------------------------------- |
| 94 | + # DCO sign-off check (required by Linux Foundation) |
| 95 | + # ------------------------------------------------------------------- |
| 96 | + dco: |
| 97 | + runs-on: ubuntu-latest |
| 98 | + if: github.event_name == 'pull_request' |
| 99 | + steps: |
| 100 | + - uses: actions/checkout@v4 |
| 101 | + with: |
| 102 | + fetch-depth: 0 |
| 103 | + - name: DCO check |
| 104 | + uses: dcoapp/app@v1 |
0 commit comments