-
Notifications
You must be signed in to change notification settings - Fork 0
246 lines (239 loc) · 9.88 KB
/
Copy pathpython-sdk.yml
File metadata and controls
246 lines (239 loc) · 9.88 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
name: Python SDK package
on:
pull_request:
paths:
- "bindings/python/**"
- "bindings/python-adapters/sqlite/**"
- "bindings/wasm/auths-proof-wasm/examples/generate-node-vectors.rs"
- ".github/workflows/python-sdk.yml"
- "Cargo.lock"
- "Cargo.toml"
push:
branches: [main]
paths:
- "bindings/python/**"
- "bindings/python-adapters/sqlite/**"
- "bindings/wasm/auths-proof-wasm/examples/generate-node-vectors.rs"
- ".github/workflows/python-sdk.yml"
- "Cargo.lock"
- "Cargo.toml"
workflow_dispatch:
permissions:
contents: read
jobs:
source-contract:
name: source behavior and contracts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
- uses: ./.github/actions/setup-rust-cache
with:
toolchain: 1.97.1
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.12"
- name: Create source-test virtual environment
shell: bash
run: |
python -m venv .venv
echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
- run: >-
python -m pip install maturin==1.9.6 pytest==9.0.2
pytest-asyncio==1.3.0 ruff==0.14.9 mypy==1.19.1 pyright==1.1.407
- run: >-
cargo run --locked -p auths-proof-wasm
--example generate-node-vectors -- target/binding-vectors
- run: maturin develop --manifest-path bindings/python/Cargo.toml
- run: python -m pip install --no-deps -e bindings/python-adapters/sqlite
- run: pytest -q bindings/python/tests
- run: pytest -q bindings/python-adapters/sqlite/tests
- run: >-
ruff check bindings/python/python bindings/python/tests
bindings/python/external bindings/python/typecheck
bindings/python-adapters/sqlite
- run: >-
python -m mypy --strict --warn-unused-ignores
bindings/python-adapters/sqlite/python/auths_sqlite
- run: >-
python -m pyright --pythonpath "$(command -v python)"
-p bindings/python-adapters/sqlite/pyrightconfig.json
- run: python bindings/python/tools/check_public_api.py
- run: python bindings/python/tools/check_contract.py
- run: python bindings/python/tools/check_doc_snippets.py
consumer-contract:
name: build external-consumer contract
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
- uses: ./.github/actions/setup-rust-cache
with:
toolchain: 1.97.1
- run: >-
cargo run --locked -p auths-proof-wasm
--example generate-node-vectors -- target/binding-vectors
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: python-sdk-consumer-${{ github.run_id }}-${{ github.run_attempt }}
path: |
target/binding-vectors/
bindings/customer-journey-matrix-v1.json
bindings/public-topology-v1.json
bindings/python/api/public-api.txt
bindings/python/adapter-contracts.json
bindings/python/external/full_workflow_consumer.py
bindings/python/external/conformance_consumer.py
bindings/recipes/python/01_authenticate_identity.py
bindings/python/identity-conformance-v1.json
bindings/python/native-abi-v2.json
bindings/python/performance-baseline.json
bindings/python/pyrightconfig.json
bindings/python/python/auths/
bindings/python/tools/check_public_api.py
bindings/python/tools/check_contract.py
bindings/python/tools/check_doc_snippets.py
bindings/python/tools/check_performance.py
bindings/python/tools/check_wheel.py
bindings/python/sdk-capability.json
bindings/python/sdk-runtime-contract.json
bindings/python/typecheck/*.py
bindings/python/typecheck/installed-pyrightconfig.json
if-no-files-found: error
retention-days: 1
compression-level: 9
wheel-build:
name: build abi3 wheel (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
- uses: ./.github/actions/setup-rust-cache
with:
toolchain: 1.97.1
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.9"
- run: python -m pip install maturin==1.9.6
- run: >-
maturin build --release --locked
--manifest-path bindings/python/Cargo.toml
--out target/python-release-wheels
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: python-wheel-${{ matrix.os }}-${{ github.run_id }}-${{ github.run_attempt }}
path: target/python-release-wheels/*.whl
if-no-files-found: error
retention-days: 1
compression-level: 0
installed-workflow:
name: installed CPython ${{ matrix.python }} (${{ matrix.os }})
needs: [consumer-contract, wheel-build]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: ${{ matrix.python }}
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: python-wheel-${{ matrix.os }}-${{ github.run_id }}-${{ github.run_attempt }}
path: wheelhouse
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: python-sdk-consumer-${{ github.run_id }}-${{ github.run_attempt }}
path: consumer
- name: Assert a source-free consumer boundary
shell: bash
run: |
if find consumer -type f \( \
-name '*.rs' -o \
-name 'Cargo.toml' -o \
-name 'Cargo.lock' -o \
-name 'rust-toolchain*' \
\) -print -quit | grep -q .; then
echo "::error::External wheel workflow received Rust build inputs."
exit 1
fi
- name: Install only the built wheel
shell: bash
run: python -m pip install wheelhouse/*.whl
- name: Inspect exact wheel contents
shell: bash
run: python consumer/bindings/python/tools/check_wheel.py wheelhouse/*.whl
- name: Execute the external Full Workflow consumer
shell: bash
working-directory: ${{ runner.temp }}
run: >-
python "${{ github.workspace }}/consumer/bindings/python/external/full_workflow_consumer.py"
"${{ github.workspace }}/consumer/target/binding-vectors"
- name: Execute the installed identity quickstart
shell: bash
working-directory: ${{ runner.temp }}
run: >-
python "${{ github.workspace }}/consumer/bindings/recipes/python/01_authenticate_identity.py"
- name: Execute installed Auths-owned conformance
shell: bash
working-directory: ${{ runner.temp }}
run: >-
python "${{ github.workspace }}/consumer/bindings/python/external/conformance_consumer.py"
- name: Check exact package/native contracts
shell: bash
run: python consumer/bindings/python/tools/check_contract.py
- name: Check installed-wheel performance contract
shell: bash
run: >-
python consumer/bindings/python/tools/check_performance.py
consumer/target/binding-vectors wheelhouse/*.whl
typing-and-api:
name: installed typing and API contract
needs: [consumer-contract, wheel-build]
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.9"
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: python-wheel-ubuntu-latest-${{ github.run_id }}-${{ github.run_attempt }}
path: wheelhouse
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: python-sdk-consumer-${{ github.run_id }}-${{ github.run_attempt }}
path: consumer
- name: Install the wheel and pinned type checkers
shell: bash
run: >-
python -m pip install wheelhouse/*.whl
mypy==1.19.1 pyright==1.1.407
- name: Check strict mypy source contract
run: >-
python -m mypy --strict --warn-unused-ignores
consumer/bindings/python/python/auths
- name: Check installed mypy consumer narrowing and negative boundaries
run: >-
python -m mypy --strict --warn-unused-ignores
consumer/bindings/python/typecheck/mcp_consumer.py
consumer/bindings/python/typecheck/workflow_consumer.py
consumer/bindings/python/typecheck/mypy_negative.py
- name: Check strict Pyright source contract
run: >-
python -m pyright --pythonpath "$(command -v python)"
-p consumer/bindings/python/pyrightconfig.json
- name: Check installed Pyright consumer narrowing and negative boundaries
run: >-
python -m pyright --pythonpath "$(command -v python)"
-p consumer/bindings/python/typecheck/installed-pyrightconfig.json
- name: Check the installed public API snapshot
run: python consumer/bindings/python/tools/check_public_api.py