forked from tensorzero/tensorzero
-
Notifications
You must be signed in to change notification settings - Fork 0
270 lines (256 loc) · 9.31 KB
/
python-client-build.yml
File metadata and controls
270 lines (256 loc) · 9.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
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# NOTE - this workflow is run on every push to 'main' in order to populate the cache
# If you ever switch this to a non-free runner (e.g. a Namespace runner), be aware that
# this might end up costing us much more than expected.
on:
workflow_call:
permissions:
contents: read
env:
CARGO_INCREMENTAL: 0
RUST_TOOLCHAIN: "1.90"
jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
if: github.repository == 'tensorzero/tensorzero'
strategy:
matrix:
platform:
- runner: ubuntu-24.04
target: x86_64
- runner: ubuntu-24.04-arm
target: aarch64
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b
with:
version: "0.9.27"
- name: Install Rust toolchain
run: |
for attempt in 1 2 3; do
if rustup toolchain install $RUST_TOOLCHAIN --profile minimal && rustup default $RUST_TOOLCHAIN; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install Rust toolchain after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Build wheels
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380
with:
working-directory: ./clients/python
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.10
#sccache: "true"
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: ./clients/python/dist
- name: Check built wheel
run: |
./ci/check-local-wheel.sh ./clients/python/dist/tensorzero*.whl
musllinux:
runs-on: ${{ matrix.platform.runner }}
if: github.repository == 'tensorzero/tensorzero'
strategy:
matrix:
platform:
- runner: ubuntu-24.04
target: x86_64
- runner: ubuntu-24.04-arm
target: aarch64
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Install Rust toolchain
run: |
for attempt in 1 2 3; do
if rustup toolchain install $RUST_TOOLCHAIN --profile minimal && rustup default $RUST_TOOLCHAIN; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install Rust toolchain after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b
with:
version: "0.9.27"
- name: Build wheels
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380
with:
working-directory: ./clients/python
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.10
#sccache: "true"
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: ./clients/python/dist
- name: Check built musl wheel
run: |
./ci/check-musl-wheel.sh ./clients/python/dist/tensorzero*.whl
windows:
runs-on: ${{ matrix.platform.runner }}
if: github.repository == 'tensorzero/tensorzero'
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Install Rust toolchain
run: |
for attempt in 1 2 3; do
if rustup toolchain install $RUST_TOOLCHAIN --profile minimal && rustup default $RUST_TOOLCHAIN; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install Rust toolchain after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38
with:
python-version: "3.10"
architecture: ${{ matrix.platform.target }}
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b
with:
version: "0.9.27"
- name: Build wheels
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380
with:
working-directory: ./clients/python
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.10
#sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: ./clients/python/dist
- name: Check built wheel
run: |
./ci/check-local-wheel.sh ./clients/python/dist/tensorzero*.whl
shell: bash
macos:
runs-on: ${{ matrix.platform.runner }}
if: github.repository == 'tensorzero/tensorzero'
strategy:
matrix:
platform:
# TODO - add back x86_64 support
- runner: macos-14
target: aarch64
# TODO - add this back (without the conflicting artifact upload)
#- runner: macos-15
# target: aarch64
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Install Rust toolchain
run: |
for attempt in 1 2 3; do
if rustup toolchain install $RUST_TOOLCHAIN --profile minimal && rustup default $RUST_TOOLCHAIN; then
break
fi
if [ $attempt -eq 3 ]; then
echo "Failed to install Rust toolchain after 3 attempts"
exit 1
fi
sleep $((10 * attempt))
done
shell: bash
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b
with:
version: "0.9.27"
- name: Build wheels
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380
with:
working-directory: ./clients/python
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.10
#sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: ./clients/python/dist
- name: Check built wheel
run: |
./ci/check-local-wheel.sh ./clients/python/dist/tensorzero*.whl
sdist:
runs-on: ubuntu-latest
if: github.repository == 'tensorzero/tensorzero'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Build sdist
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380
with:
working-directory: ./clients/python
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: wheels-sdist
path: ./clients/python/dist
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b
with:
version: "0.9.27"
- name: Check local sdist
run: |
./ci/check-local-wheel.sh ./clients/python/dist/tensorzero-*.tar.gz
- name: Run twine on sdist
run: |
uv pip install twine
uv run twine check ./clients/python/dist/tensorzero-*.tar.gz
check-artifacts:
needs: [linux, musllinux, windows, macos, sdist]
runs-on: ubuntu-latest
if: github.repository == 'tensorzero/tensorzero'
steps:
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
with:
pattern: wheels-*
- name: Count wheels
run: |
ls -lh ./wheels-*/*
# Count the number of files named 'tensorzero-*.whl', and verify that it equals 5
# If we add new platforms / python versions, update this number
ls -lh ./wheels-*/* | grep -c 'tensorzero-.*\.whl' | grep -q 6