-
Notifications
You must be signed in to change notification settings - Fork 19
257 lines (248 loc) · 8.01 KB
/
python-json.yaml
File metadata and controls
257 lines (248 loc) · 8.01 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
name: Python arrow-json CI
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PACKAGE_NAME: arrow-json
PYTHON_VERSION: "3.11" # to build abi3 wheels
MATURIN_VERSION: "v1.7.4"
PACKAGE_DIR: json
UV_SYSTEM_PYTHON: 1
jobs:
macos:
name: Build / MacOS
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
runs-on: macos-14
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ env.PACKAGE_DIR }}
- name: Build wheels - x86_64
uses: messense/maturin-action@v1
with:
target: x86_64
args: -m ${{ env.PACKAGE_DIR }}/Cargo.toml --release --out dist --sdist
maturin-version: ${{ env.MATURIN_VERSION }}
- name: Install built wheel - x86_64
run: |
uv pip install "$(find dist -name '*.whl' -type f | head -n 1)" --force-reinstall --no-deps
- name: Build wheels - universal2
uses: messense/maturin-action@v1
with:
args: -m ${{ env.PACKAGE_DIR }}/Cargo.toml --release --out dist
maturin-version: ${{ env.MATURIN_VERSION }}
target: universal2-apple-darwin
- name: Install built wheel - universal2
run: |
uv pip install "$(find dist -name '*_universal2.whl' -type f | head -n 1)" --force-reinstall --no-deps
- name: Upload wheels
uses: actions/upload-artifact@v6
with:
name: wheels-macos
path: dist
windows:
name: Build / Windows (${{ matrix.target }})
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
runs-on: windows-latest
timeout-minutes: 30
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: ${{ matrix.target }}
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host x86_64-pc-windows-msvc
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
shell: bash
- uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ env.PACKAGE_DIR }}
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
args: -m ${{ env.PACKAGE_DIR }}/Cargo.toml --release --out dist
maturin-version: ${{ env.MATURIN_VERSION }}
- name: Install built wheel
shell: bash
run: |
uv pip install "$(find dist -name '*.whl' -type f | head -n 1)" --force-reinstall --no-deps
- name: Upload wheels
uses: actions/upload-artifact@v6
with:
name: wheels-windows-${{ matrix.target }}
path: dist
linux:
name: Build & Test / Linux (${{ matrix.target }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
target: [x86_64, i686]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ env.PACKAGE_DIR }}
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
args: -m ${{ env.PACKAGE_DIR }}/Cargo.toml --release --out dist
maturin-version: ${{ env.MATURIN_VERSION }}
- name: Install built wheel and test
if: matrix.target == 'x86_64'
run: |
uv pip install "$(find dist -name '*.whl' -type f | head -n 1)[test]" --force-reinstall
uv pip freeze
uv run pytest -v ${{ env.PACKAGE_DIR }}
- name: Upload wheels
uses: actions/upload-artifact@v6
with:
name: wheels-linux-${{ matrix.target }}
path: dist
musllinux:
name: Build / MuslLinux (${{ matrix.target }})
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- i686-unknown-linux-musl
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: musllinux_1_2
args: -m ${{ env.PACKAGE_DIR }}/Cargo.toml --release --out dist
maturin-version: ${{ env.MATURIN_VERSION }}
- name: Install built wheel
if: matrix.target == 'x86_64-unknown-linux-musl'
uses: addnab/docker-run-action@v3
with:
image: alpine:latest
options: -v ${{ github.workspace }}:/io -w /io
run: |
apk add python3 curl
curl -LsSf https://astral.sh/uv/install.sh | sh
. $HOME/.local/bin/env
uv venv
. .venv/bin/activate
uv pip install ${{ env.PACKAGE_NAME }} --no-index --find-links /io/dist/ --force-reinstall --no-deps
- name: Upload wheels
uses: actions/upload-artifact@v6
with:
name: wheels-musllinux-${{ matrix.target }}
path: dist
lint:
name: Lint (${{ matrix.python }})
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
# Lint on earliest and latest
python: ["3.8", "3.x"]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ env.PACKAGE_DIR }}
- name: Lint
run: |
make lint
# https://github.com/marketplace/actions/alls-green
alls-green:
name: "Check release process / arrow-json"
if: always()
needs:
- lint
- linux
- macos
- windows
- musllinux
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
# These get skipped in PRs and only run on main
# If they get skipped in a PR, we still want to consider them "green"
# If they fail in main, we want to fail the alls-green check
allowed-skips: macos,windows, musllinux
release:
name: Release
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
runs-on: ubuntu-latest
timeout-minutes: 15
needs:
- lint
- macos
- windows
- linux
- musllinux
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
- uses: astral-sh/setup-uv@v5
- uses: actions/setup-python@v5
- name: Publish to PyPi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
uvx twine upload --skip-existing *