-
Notifications
You must be signed in to change notification settings - Fork 223
292 lines (263 loc) · 8.98 KB
/
linux.yaml
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
name: linux
on: push
jobs:
sdist:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
env:
RUST_TOOLCHAIN: "1.65" # MSRV
steps:
- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $RUST_TOOLCHAIN -y
- run: rustup default $RUST_TOOLCHAIN
- uses: actions/checkout@v4
- run: python3 -m pip install --user --upgrade pip "maturin>=1,<2" wheel
- run: maturin build
- run: cargo fetch
- run: mkdir .cargo
- run: cp ci/sdist.toml .cargo/config.toml
- run: cargo vendor include/cargo --versioned-dirs
- run: maturin sdist --out=dist
- run: python3 -m pip install --user dist/orjson*.tar.gz
env:
CARGO_NET_OFFLINE: "true"
- run: python3 -m pip install --user -r test/requirements.txt -r integration/requirements.txt mypy
- run: pytest -s -rxX -v test
env:
PYTHONMALLOC: "debug"
- run: ./integration/run thread
- run: ./integration/run http
- run: ./integration/run init
- run: ./integration/run typestubs
- name: Store sdist
if: "startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
retention-days: 1
manylinux_2_17_amd64:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python: [
{ version: '3.12', abi: 'cp312-cp312' },
{ version: '3.11', abi: 'cp311-cp311' },
{ version: '3.10', abi: 'cp310-cp310' },
{ version: '3.9', abi: 'cp39-cp39' },
{ version: '3.8', abi: 'cp38-cp38' },
]
env:
PATH: /github/home/.local/bin:/github/home/.cargo/bin:/opt/python/${{ matrix.python.abi }}/bin:/opt/rh/gcc-toolset-12/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
CC: "clang"
CFLAGS: "-O2 -fno-plt -flto=thin"
LDFLAGS: "-O2 -flto=thin -fuse-ld=lld -Wl,--as-needed"
RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=lld"
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
container:
image: quay.io/pypa/manylinux_2_28_x86_64:latest
options: --user 0
steps:
- run: yum install -y clang lld
- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2023-10-10 --profile minimal -y
- run: rustup component add rust-src --toolchain nightly-2023-10-10-x86_64-unknown-linux-gnu
- uses: actions/checkout@v4
- name: build-std
run: |
mkdir .cargo
cp ci/config.toml .cargo/config.toml
- run: python3 -m pip install --user --upgrade pip "maturin>=1,<2" wheel
- run: |
maturin build --release --strip \
--out=dist \
--features=no-panic,yyjson \
--compatibility manylinux_2_17 \
--interpreter python${{ matrix.python.version }} \
--target=x86_64-unknown-linux-gnu
- run: python3 -m pip install --user dist/orjson*.whl
- run: python3 -m pip install --user -r test/requirements.txt -r integration/requirements.txt
- run: pytest -s -rxX -v test
env:
PYTHONMALLOC: "debug"
- run: ./integration/run thread
- run: ./integration/run http
- run: ./integration/run init
- name: Store wheels
if: "startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
retention-days: 1
musllinux_1_1:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python: [
{ version: '3.12' },
{ version: '3.11' },
{ version: '3.10' },
{ version: '3.9' },
{ version: '3.8' },
]
platform:
- target: aarch64-unknown-linux-musl
arch: aarch64
platform: linux/arm64
- target: x86_64-unknown-linux-musl
arch: x86_64
platform: linux/amd64
steps:
- uses: actions/checkout@v4
- name: build-std
run: |
mkdir .cargo
cp ci/config.toml .cargo/config.toml
- name: Build
uses: PyO3/maturin-action@v1
env:
CC: "gcc"
CFLAGS: "-O2 -fno-plt"
LDFLAGS: "-O2 -flto -Wl,--as-needed"
RUSTFLAGS: "-C target-feature=-crt-static"
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
with:
rust-toolchain: nightly-2023-10-10
rustup-components: rust-src
target: ${{ matrix.platform.target }}
manylinux: musllinux_1_1
args: --release --strip --out=dist --features=no-panic,yyjson -i python${{ matrix.python.version }}
- name: Set up QEMU
if: matrix.platform.arch != 'x86_64'
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:qemu-v7.0.0
platforms: ${{ matrix.platform.platform }}
- name: Test
uses: addnab/docker-run-action@v3
with:
image: quay.io/pypa/musllinux_1_1_${{ matrix.platform.arch }}:latest
options: -v ${{ github.workspace }}:/io -w /io
run: |
apk add tzdata
sed -i '/^numpy/d' test/requirements.txt
python${{ matrix.python.version }} -m venv venv
venv/bin/pip install -U pip wheel
venv/bin/pip install -r test/requirements.txt
venv/bin/pip install orjson --no-index --find-links dist/ --force-reinstall
venv/bin/python -m pytest -s -rxX -v test
- name: Store wheels
if: "startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
retention-days: 1
manylinux_2_17_non_amd64:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python: [
{ version: '3.12', abi: 'cp312-cp312' },
{ version: '3.11', abi: 'cp311-cp311' },
{ version: '3.10', abi: 'cp310-cp310' },
{ version: '3.9', abi: 'cp39-cp39' },
{ version: '3.8', abi: 'cp38-cp38' },
]
target: [
{
arch: 'aarch64',
target: 'aarch64-unknown-linux-gnu',
cflags: '-O2',
},
{
arch: 'armv7',
target: 'armv7-unknown-linux-gnueabihf',
cflags: '-Os -fstrict-aliasing',
},
{
arch: 'ppc64le',
target: 'powerpc64le-unknown-linux-gnu',
cflags: '-O2',
},
{
arch: 's390x',
target: 's390x-unknown-linux-gnu',
cflags: '-O2 -march=z10',
},
]
steps:
- uses: actions/checkout@v4
- name: build-std
run: |
mkdir .cargo
cp ci/config.toml .cargo/config.toml
- name: Build
uses: PyO3/maturin-action@v1
env:
PYO3_CROSS_LIB_DIR: "/opt/python/${{ matrix.python.abi }}"
CFLAGS: "${{ matrix.target.cflags }}"
LDFLAGS: "${{ matrix.target.cflags }} -flto -Wl,--as-needed"
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
with:
target: ${{ matrix.target.target }}
rust-toolchain: nightly-2023-10-10
rustup-components: rust-src
manylinux: auto
args: --release --strip --out=dist --features=no-panic,yyjson -i python${{ matrix.python.version }}
- uses: uraimo/run-on-arch-action@v2
name: Test
with:
arch: ${{ matrix.target.arch }}
distro: ubuntu22.04
githubToken: ${{ github.token }}
install: |
export TZ=UTC
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y --no-install-recommends software-properties-common gpg gpg-agent curl
add-apt-repository ppa:deadsnakes/ppa
apt-get update
apt-get install -y python${{ matrix.python.version }}-dev python${{ matrix.python.version }}-venv
run: |
python${{ matrix.python.version }} -m venv venv
venv/bin/pip install -U pip wheel
venv/bin/pip install -r test/requirements.txt
venv/bin/pip install orjson --no-index --find-links dist/ --force-reinstall
venv/bin/python -m pytest -s -rxX -v test
- name: Store wheels
if: "startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
retention-days: 1
pypi:
name: PyPI
permissions:
# trusted publisher
id-token: write
contents: write
runs-on: ubuntu-22.04
if: "startsWith(github.ref, 'refs/tags/')"
needs: [ manylinux_2_17_amd64, manylinux_2_17_non_amd64, musllinux_1_1, sdist ]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- run: pip install pip "maturin>=1,<2"
- run: ls -1 .
- name: deploy wheel
run: maturin upload --skip-existing --username "$MATURIN_USERNAME" *.whl
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
- name: deploy sdist
run: maturin upload --skip-existing --username "$MATURIN_USERNAME" *.tar.gz
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}