-
Notifications
You must be signed in to change notification settings - Fork 13
253 lines (227 loc) · 7.88 KB
/
publish.yml
File metadata and controls
253 lines (227 loc) · 7.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
247
248
249
250
251
252
253
name: Publish
on:
workflow_dispatch:
push:
tags:
- "v*"
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }} for Python ${{matrix.python-version}}.
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest] # TODO: add windows-2019,
python-version: ["39", "310", "311", "312", "313"]
env:
CIBW_SKIP: "cp36-* pp* *-win32"
CIBW_ARCHS_MACOS: x86_64 universal2 arm64
CIBW_ARCHS_LINUX: auto aarch64
CIBW_BEFORE_ALL_LINUX: "{package}/tools/cibw_before_all_linux.sh"
CIBW_BUILD_VERBOSITY: 1
MACOSX_DEPLOYMENT_TARGET: 10.13
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
target/
key: ${{ matrix.os }}-cargo-${{matrix.python-version}}-${{ hashFiles('**/Cargo.lock') }}
# Used to host cibuildwheel
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- if: runner.os == 'macOS'
name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
targets: aarch64-apple-darwin, x86_64-apple-darwin
toolchain: stable
- if: runner.os != 'Linux'
name: Setup env when not using docker
run: |
python -m pip install --upgrade build wheel setuptools setuptools-rust
- if: runner.os == 'Linux'
name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: arm64
- name: Build wheels for ${{matrix.python-version}} on ${{matrix.os}}
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BUILD: "cp${{matrix.python-version}}-manylinux_x86_64 cp${{matrix.python-version}}-macosx_x86_64 cp${{matrix.python-version}}-macosx_universal2 cp${{matrix.python-version}}-macosx_arm64"
- uses: actions/upload-artifact@v4
with:
name: build-wheel-${{ matrix.python-version }}-${{ matrix.os }}
path: ./wheelhouse/*.whl
overwrite: true
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.13"
- name: Install setuptools and setuptools-rust
run: |
python -m pip install --upgrade build wheel setuptools setuptools-rust
- name: Build sdist
run: make build-sdist
- uses: actions/upload-artifact@v4
with:
name: build-sdist
path: dist/*.tar.gz
build_cc_wheels:
name: Cross Build wheels for ${{ matrix.platform.name }}
runs-on: ubuntu-latest
env:
CARGO: cross
strategy:
matrix:
platform:
[
{ name: "linux_armv7l", target: "armv7-unknown-linux-gnueabihf" },
{ name: "linux_armv6l", target: "arm-unknown-linux-gnueabihf" },
{
name: "manylinux2014_aarch64",
target: "aarch64-unknown-linux-gnu",
},
]
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
target/
key: ${{ matrix.platform.target }}-cargo-${{ matrix.platform.name }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.13"
- name: Install Rust ${{ matrix.platform.target }}
uses: dtolnay/rust-toolchain@master
with:
target: ${{ matrix.platform.target }}
toolchain: stable
- name: Install cross
run: |
cargo install cross --git https://github.com/fraidev/cross
- name: Install setuptools and setuptools-rust
run: |
python -m pip install --upgrade build wheel setuptools setuptools-rust
- name: Build cross image
run: |
docker build -f cross/Dockerfile.${{ matrix.platform.target }} -t fluvio-cross-python:${{ matrix.platform.target }} cross
- name: Build wheel
env:
CARGO_BUILD_TARGET: ${{ matrix.platform.target }}
CARGO_BUILD_TARGET_ARCH: ${{ matrix.platform.target }}
PYO3_CROSS: 1
PYO3_CROSS_PYTHON_VERSION: 3.8
run: |
python -m build \
--wheel \
--no-isolation \
-C--build-option=--py-limited-api=cp38 \
-C--build-option=--plat-name=${{ matrix.platform.name }}
- uses: actions/upload-artifact@v4
with:
name: build-wheel-${{ matrix.platform.name }}
path: dist/*.whl
overwrite: true
upload_pypi:
needs: [build_wheels, build_sdist, build_cc_wheels]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
pattern: build-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_ACCESS_TOKEN }}
skip_existing: true
build_docs:
name: build static docs
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.13"]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Build docs
run: |
make docs-build
touch docs/.nojekyll
echo "FLUVIO_PYTHON_CLIENT_VERSION=$(
venv/bin/python -c 'import pathlib, tomllib, sys; print(tomllib.loads(pathlib.Path("pyproject.toml").read_text())["project"]["version"])'
)" >> "$GITHUB_ENV"
- uses: actions/upload-artifact@v4
with:
name: docs
path: docs
publish_docs_to_pages:
needs: [build_docs]
name: push static docs
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
permissions:
contents: write # 'write' access to repository contents
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- uses: actions/download-artifact@v4
with:
name: docs
path: docs-latest
- name: "Git Fetch & Checkout"
run: |
git config --local user.email "team@fluvio.io"
git config --local user.name "Fluvio Authors"
git fetch --all
git checkout -b docs --track origin/docs
git merge -X theirs origin/main -m "Merge remote-tracking branch 'origin/main into docs" --allow-unrelated-histories
- name: Commit files
run: |
git add --force docs
git commit -m "Updated Fluvio Python client docs" -a || true
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: docs