-
Notifications
You must be signed in to change notification settings - Fork 1
115 lines (96 loc) · 3.31 KB
/
Copy pathpython-sdk-ci.yml
File metadata and controls
115 lines (96 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Python SDK CI
on:
push:
branches: [main]
paths:
- 'packages/sdk-python/**'
- '.github/workflows/python-sdk-ci.yml'
pull_request:
paths:
- 'packages/sdk-python/**'
- '.github/workflows/python-sdk-ci.yml'
# H9 hostile fix — least-privilege explicit permissions (default for new
# repos, but stating it here makes the contract explicit and survives
# org-level default changes).
permissions:
contents: read
# Cancel in-progress runs when a new commit lands on the same ref —
# avoids burning CI minutes on superseded commits.
concurrency:
group: python-sdk-ci-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: packages/sdk-python
jobs:
test:
name: test (py${{ matrix.python-version }} / ${{ matrix.os }})
runs-on: ${{ matrix.os }}
# H8 hostile fix — bound CI duration; a hung pytest used to be able
# to consume 6h of CI time silently before getting killed.
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: packages/sdk-python/pyproject.toml
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Verify no transitive-dep conflicts
run: pip check
- name: Lint (ruff)
run: ruff check settlegrid tests
- name: Type check (mypy)
run: mypy settlegrid
- name: Tests + coverage
run: pytest --cov=settlegrid --cov-report=xml --cov-report=term --cov-fail-under=90
- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: coverage-xml
path: packages/sdk-python/coverage.xml
if-no-files-found: error
build:
name: build wheel + sdist + smoke install
runs-on: ubuntu-latest
needs: test
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install build backend
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build wheel + sdist
run: python -m build
- name: twine check
run: twine check dist/*
- name: Smoke install in fresh venv
run: |
python -m venv /tmp/smoke
/tmp/smoke/bin/pip install --upgrade pip
/tmp/smoke/bin/pip install dist/*.whl
/tmp/smoke/bin/pip check
/tmp/smoke/bin/python -c "import settlegrid; print(settlegrid.SDK_VERSION)"
/tmp/smoke/bin/python -c "from settlegrid import SettleGrid, Wrapper, Invocation, InvalidKeyError, RateLimitedError, KeyValidationResult, MeterResult"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: sdk-python-dist
path: packages/sdk-python/dist/
if-no-files-found: error