-
Notifications
You must be signed in to change notification settings - Fork 0
320 lines (268 loc) · 8.91 KB
/
ci.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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
name: ci
on:
pull_request:
branches:
- "main"
- "release/*"
- "deps/*"
paths-ignore:
- "LICENSE"
- "SECURITY.md"
- "README.md"
- "makefile"
- ".gitingore"
#- ".github/workflows/*"
push:
branches:
- "main"
- "release/*"
- "deps/*"
paths-ignore:
- "LICENSE"
- "SECURITY.md"
- "README.md"
- "makefile"
- ".gitingore"
#- ".github/workflows/*"
env:
PKG_CONFIG_ALLOW_CROSS: 1
jobs:
rust-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: cache-rust
name: cache rust
uses: Swatinem/rust-cache@v2
with:
key: v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: run test
run: cargo test -p database -p convert -p py_types
build:
name: build on ${{ matrix.platform || matrix.os }} (${{ matrix.target }} - ${{ matrix.manylinux || 'auto' }})
needs: [rust-test]
strategy:
fail-fast: true
matrix:
os: [ubuntu, macos, windows]
target: [x86_64, aarch64]
manylinux: [auto]
include:
- os: ubuntu
platform: linux
- os: windows
ls: dir
interpreter: 3.7 3.8 3.9 3.10 3.11
- os: windows
ls: dir
target: i686
python-architecture: x86
interpreter: 3.7 3.8 3.9 3.10 3.11
- os: macos
target: aarch64
interpreter: 3.7 3.8 3.9 3.10 3.11
- os: ubuntu
platform: linux
target: i686
# GCC 4.8.5 in manylinux2014 container doesn't support c11 atomic
# we use manylinux_2_24 container for aarch64 and armv7 targets instead,
- os: ubuntu
platform: linux
target: aarch64
container: messense/manylinux_2_24-cross:aarch64
- os: ubuntu
platform: linux
target: armv7
container: messense/manylinux_2_24-cross:armv7
interpreter: 3.7 3.8 3.9 3.10 3.11
# musllinux
- os: ubuntu
platform: linux
target: x86_64
manylinux: musllinux_1_1
- os: ubuntu
platform: linux
target: aarch64
manylinux: musllinux_1_1
- os: ubuntu
platform: linux
target: ppc64le
container: messense/manylinux_2_24-cross:ppc64le
interpreter: 3.7 3.8 3.9 3.10 3.11
- os: ubuntu
platform: linux
target: s390x
container: messense/manylinux_2_24-cross:s390x
interpreter: 3.7 3.8 3.9 3.10 3.11
exclude:
# Optimized PGO builds for x86_64 manylinux and windows follow a different matrix,
# maybe in future maturin-action can support this automatically
- os: ubuntu
target: x86_64
manylinux: auto
- os: windows
target: x86_64
# Windows on arm64 only supports Python 3.11+
- os: windows
target: aarch64
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.11"
architecture: ${{ matrix.python-architecture || 'x64' }}
- run: pip install -U twine 'black>=22.3.0,<23' typing_extensions httpx toml
- name: production - check package version
if: github.ref == 'refs/heads/main'
run: |
python .github/prod.py
- name: release - check package version
if: contains(github.ref, 'release')
run: |
python .github/release.py
- name: build sdist
if: ${{ matrix.os == 'ubuntu' && matrix.target == 'x86_64' && matrix.manylinux == 'auto' }}
uses: messense/maturin-action@v1
with:
command: sdist
args: --out dist
rust-toolchain: stable
- name: build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux || 'auto' }}
container: ${{ matrix.container }}
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.7 3.8 3.9 3.10 3.11 pypy3.7 pypy3.8 pypy3.9' }}
rust-toolchain: stable
- run: ${{ matrix.ls || 'ls -lh' }} dist/
- run: twine check --strict dist/*
- uses: actions/upload-artifact@v3
with:
name: pypi_files
path: dist
build-pgo:
name: build pgo-optimized on ${{ matrix.platform || matrix.os }} (${{ matrix.interpreter}} - ${{ matrix.target }} - ${{ matrix.manylinux || 'auto' }})
needs: [rust-test]
strategy:
fail-fast: true
matrix:
os: [ubuntu, windows]
target: [x86_64]
manylinux: [auto]
interpreter: ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10"]
include:
- os: ubuntu
platform: linux
- os: windows
ls: dir
#- interpreter: 3.12-dev
# maturin-interpreter: "3.12"
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.interpreter }}
architecture: ${{ matrix.python-architecture || 'x64' }}
- name: install rust stable
id: rust-toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools
- run: pip install -U 'black>=22.3.0,<23' typing_extensions
- name: build initial wheel
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux || 'auto' }}
args: >
--release
--out pgo-wheel
--interpreter ${{ matrix.interpreter }}
rust-toolchain: stable
docker-options: -e CI
env:
RUSTFLAGS: "-Cprofile-generate=${{ github.workspace }}/profdata"
- name: detect rust host
run: echo RUST_HOST=$(rustc -Vv | grep host | cut -d ' ' -f 2) >> "$GITHUB_ENV"
shell: bash
- name: generate pgo data
run: |
pip install -U pip poetry
poetry export -f requirements.txt --without-hashes -o requirements.txt --with dev
pip install -r requirements.txt
pip install pysqlx-core --no-index --no-deps --find-links pgo-wheel --force-reinstall
rustup run stable bash -c 'echo LLVM_PROFDATA=$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN/lib/rustlib/${{ env.RUST_HOST }}/bin/llvm-profdata >> "$GITHUB_ENV"'
- name: merge pgo data
run: ${{ env.LLVM_PROFDATA }} merge -o ${{ github.workspace }}/merged.profdata ${{ github.workspace }}/profdata
- name: build pgo-optimized wheel
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux || 'auto' }}
args: >
--release
--out dist
--interpreter ${{ matrix.interpreter }}
rust-toolchain: stable
docker-options: -e CI
env:
RUSTFLAGS: "-Cprofile-use=${{ github.workspace }}/merged.profdata"
- run: ${{ matrix.ls || 'ls -lh' }} dist/
- uses: actions/upload-artifact@v3
with:
name: pypi_files
path: dist
release:
name: Release
if: contains(github.ref, 'main') || contains(github.ref, 'release')
needs: [build,build-pgo]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: install deps
run: pip install -U twine httpx toml
- name: production - check package version
if: github.ref == 'refs/heads/main'
run: |
python .github/prod.py
- name: release - check package version
if: contains(github.ref, 'release')
run: |
python .github/release.py
- name: download articart
uses: actions/download-artifact@v2
with:
name: pypi_files
path: dist
- run: twine check --strict dist/*
- name: upload to pypi
run: twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
- name: create release
if: github.ref == 'refs/heads/main'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.PY_SQLX_VERSION }}
release_name: ${{ env.PY_SQLX_VERSION }}
body: |
Changes in this Release
${{ github.event.head_commit.message }}
draft: false
prerelease: false