|
| 1 | +# CI pipeline for the OpenDecree Python SDK. |
| 2 | +# |
| 3 | +# Jobs: lint, typecheck, test (matrix: 3.11-3.13), examples → check (alls-green gate) |
| 4 | +# The check job aggregates all results for branch protection. |
| 5 | + |
| 6 | +name: CI |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: [main] |
| 11 | + pull_request: |
| 12 | + branches: [main] |
| 13 | + workflow_call: |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +jobs: |
| 20 | + lint: |
| 21 | + name: Lint |
| 22 | + runs-on: ubuntu-latest |
| 23 | + timeout-minutes: 10 |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@v6 |
| 27 | + with: |
| 28 | + persist-credentials: false |
| 29 | + |
| 30 | + - name: Set up Python |
| 31 | + uses: actions/setup-python@v5 |
| 32 | + with: |
| 33 | + python-version: "3.12" |
| 34 | + |
| 35 | + - name: Install ruff |
| 36 | + run: pip install ruff |
| 37 | + |
| 38 | + - name: Check lint |
| 39 | + run: ruff check sdk/src/ sdk/tests/ |
| 40 | + |
| 41 | + - name: Check formatting |
| 42 | + run: ruff format --check sdk/src/ sdk/tests/ |
| 43 | + |
| 44 | + typecheck: |
| 45 | + name: Typecheck |
| 46 | + runs-on: ubuntu-latest |
| 47 | + timeout-minutes: 10 |
| 48 | + steps: |
| 49 | + - name: Checkout |
| 50 | + uses: actions/checkout@v6 |
| 51 | + with: |
| 52 | + persist-credentials: false |
| 53 | + |
| 54 | + - name: Set up Python |
| 55 | + uses: actions/setup-python@v5 |
| 56 | + with: |
| 57 | + python-version: "3.12" |
| 58 | + cache: pip |
| 59 | + cache-dependency-path: sdk/pyproject.toml |
| 60 | + |
| 61 | + - name: Install SDK with dev dependencies |
| 62 | + run: pip install -e "sdk[dev]" |
| 63 | + |
| 64 | + - name: Run mypy |
| 65 | + run: cd sdk && mypy src/ |
| 66 | + |
| 67 | + test: |
| 68 | + name: Test (Python ${{ matrix.python-version }}) |
| 69 | + runs-on: ubuntu-latest |
| 70 | + timeout-minutes: 15 |
| 71 | + strategy: |
| 72 | + fail-fast: false |
| 73 | + matrix: |
| 74 | + python-version: ["3.11", "3.12", "3.13"] |
| 75 | + steps: |
| 76 | + - name: Checkout |
| 77 | + uses: actions/checkout@v6 |
| 78 | + with: |
| 79 | + persist-credentials: false |
| 80 | + |
| 81 | + - name: Set up Python ${{ matrix.python-version }} |
| 82 | + uses: actions/setup-python@v5 |
| 83 | + with: |
| 84 | + python-version: ${{ matrix.python-version }} |
| 85 | + cache: pip |
| 86 | + cache-dependency-path: sdk/pyproject.toml |
| 87 | + |
| 88 | + - name: Install SDK with dev dependencies |
| 89 | + run: pip install -e "sdk[dev]" |
| 90 | + |
| 91 | + - name: Run tests with coverage |
| 92 | + run: cd sdk && pytest --cov --cov-report=term-missing |
| 93 | + |
| 94 | + examples: |
| 95 | + name: Examples |
| 96 | + runs-on: ubuntu-latest |
| 97 | + timeout-minutes: 10 |
| 98 | + steps: |
| 99 | + - name: Checkout |
| 100 | + uses: actions/checkout@v6 |
| 101 | + with: |
| 102 | + persist-credentials: false |
| 103 | + |
| 104 | + - name: Set up Python |
| 105 | + uses: actions/setup-python@v5 |
| 106 | + with: |
| 107 | + python-version: "3.12" |
| 108 | + cache: pip |
| 109 | + cache-dependency-path: sdk/pyproject.toml |
| 110 | + |
| 111 | + - name: Install SDK |
| 112 | + run: pip install -e sdk/ |
| 113 | + |
| 114 | + - name: Compile-check all examples |
| 115 | + run: | |
| 116 | + python -m py_compile examples/quickstart/main.py |
| 117 | + python -m py_compile examples/async-client/main.py |
| 118 | + python -m py_compile examples/live-config/main.py |
| 119 | + python -m py_compile examples/error-handling/main.py |
| 120 | + python -m py_compile examples/setup.py |
| 121 | +
|
| 122 | + check: |
| 123 | + name: CI check |
| 124 | + if: always() |
| 125 | + needs: [lint, typecheck, test, examples] |
| 126 | + runs-on: ubuntu-latest |
| 127 | + timeout-minutes: 5 |
| 128 | + steps: |
| 129 | + - uses: re-actors/alls-green@release/v1 |
| 130 | + with: |
| 131 | + jobs: ${{ toJSON(needs) }} |
0 commit comments