|
| 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 | + |
1 | 6 | name: CI |
2 | 7 |
|
3 | 8 | on: |
|
7 | 12 | branches: [main] |
8 | 13 | workflow_call: |
9 | 14 |
|
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
10 | 19 | jobs: |
11 | 20 | lint: |
| 21 | + name: Lint |
12 | 22 | runs-on: ubuntu-latest |
| 23 | + timeout-minutes: 10 |
13 | 24 | steps: |
14 | | - - uses: actions/checkout@v4 |
15 | | - - uses: actions/setup-python@v5 |
| 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 |
16 | 32 | with: |
17 | 33 | python-version: "3.12" |
18 | | - - run: pip install ruff |
19 | | - - run: ruff check sdk/src/ sdk/tests/ |
20 | | - - run: ruff format --check sdk/src/ sdk/tests/ |
| 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/ |
21 | 43 |
|
22 | 44 | typecheck: |
| 45 | + name: Typecheck |
23 | 46 | runs-on: ubuntu-latest |
| 47 | + timeout-minutes: 10 |
24 | 48 | steps: |
25 | | - - uses: actions/checkout@v4 |
26 | | - - uses: actions/setup-python@v5 |
| 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 |
27 | 56 | with: |
28 | 57 | python-version: "3.12" |
29 | | - - run: pip install -e "sdk[dev]" |
30 | | - - run: cd sdk && mypy src/ |
| 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/ |
31 | 66 |
|
32 | 67 | test: |
| 68 | + name: Test (Python ${{ matrix.python-version }}) |
33 | 69 | runs-on: ubuntu-latest |
| 70 | + timeout-minutes: 15 |
34 | 71 | strategy: |
| 72 | + fail-fast: false |
35 | 73 | matrix: |
36 | 74 | python-version: ["3.11", "3.12", "3.13"] |
37 | 75 | steps: |
38 | | - - uses: actions/checkout@v4 |
39 | | - - uses: actions/setup-python@v5 |
| 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 |
40 | 83 | with: |
41 | 84 | python-version: ${{ matrix.python-version }} |
42 | | - - run: pip install -e "sdk[dev]" |
43 | | - - run: cd sdk && pytest --cov --cov-report=term-missing |
| 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