Repository navigation
280 lines (245 loc) · 11.8 KB
/
Copy pathbuild-ladybug.yml
File metadata and controls
280 lines (245 loc) · 11.8 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
271
272
273
274
275
276
277
278
279
280
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on: https://github.com/LadybugDB/ladybug/blob/v0.19.1/.github/workflows/python-wheel-workflow.yml
# and the Linux compat leg of https://github.com/LadybugDB/ladybug/blob/v0.19.1/.github/workflows/precompiled-bin-workflow.yml
name: Build ladybug wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/ladybug.yaml not released yet'
required: false
default: ''
pull_request:
branches: [main]
paths:
- '.github/workflows/build-ladybug.yml'
- 'docs/packages/ladybug.yaml'
- 'patches/ladybug/**'
push:
branches: [main]
paths:
- '.github/workflows/build-ladybug.yml'
- 'docs/packages/ladybug.yaml'
- 'patches/ladybug/**'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
env:
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
package: ladybug
version: ${{ inputs.version }}
package_python_sdist:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Package ladybug ${{ matrix.version }} sdist
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
env:
LADYBUG_VERSION: ${{ matrix.version }}
steps:
- name: Checkout ladybug v${{ env.LADYBUG_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: LadybugDB/ladybug
ref: v${{ env.LADYBUG_VERSION }}
persist-credentials: false
- name: Update submodules
run: git submodule update --init --recursive tools/python_api
- name: Checkout python-wheels
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: python-wheels
persist-credentials: false
- name: Apply Python binding patches
run: git apply --exclude='tools/python_api/test/*' --include='tools/python_api/*' python-wheels/patches/ladybug/${{ env.LADYBUG_VERSION }}/*.patch
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
python-version: '3.12'
activate-environment: true
enable-cache: false
- name: Package Python sdist
working-directory: scripts/pip-package
run: |
uv pip install setuptools
python package_tar.py
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ladybug-${{ env.LADYBUG_VERSION }}-sdist
path: scripts/pip-package/*.tar.gz
if-no-files-found: error
build_precompiled_bin:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build liblbug ${{ matrix.version }} manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 1440
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
env:
LADYBUG_VERSION: ${{ matrix.version }}
steps:
- name: Checkout ladybug v${{ env.LADYBUG_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: LadybugDB/ladybug
ref: v${{ env.LADYBUG_VERSION }}
persist-credentials: false
- name: Checkout python-wheels
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: python-wheels
persist-credentials: false
- name: Apply patches
run: git apply --exclude='tools/python_api/*' python-wheels/patches/ladybug/${{ env.LADYBUG_VERSION }}/*.patch
# Rocky 10's openssl-devel is OpenSSL 3 and its default GCC 14 replaces gcc-toolset-13.
- name: Build
run: |
docker run --rm -v "$(pwd):/work" -w /work "${MANYLINUX_RISCV64_IMAGE}" bash -c '
set -euxo pipefail
dnf install -y ninja-build openssl-devel
make GEN=Ninja
make install
mkdir precompiled-liblbug
cp install/include/lbug.h install/include/lbug.hpp precompiled-liblbug/
cp -L install/lib*/liblbug.a precompiled-liblbug/
'
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ladybug-${{ env.LADYBUG_VERSION }}-liblbug-static
path: precompiled-liblbug/
if-no-files-found: error
build_wheels:
needs: [setup, package_python_sdist, build_precompiled_bin]
if: needs.setup.outputs.versions != '[]'
name: Build ladybug ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 720
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
python: ["cp312", "cp313", "cp314", "cp314t"]
env:
LADYBUG_VERSION: ${{ matrix.version }}
steps:
- name: Checkout ladybug v${{ env.LADYBUG_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: LadybugDB/ladybug
ref: v${{ env.LADYBUG_VERSION }}
persist-credentials: false
- name: Update submodules
run: git submodule update --init --depth 1 dataset tools/python_api
- name: Checkout python-wheels
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: python-wheels
persist-credentials: false
- name: Apply test patches
run: git apply --include='tools/python_api/test/*' python-wheels/patches/ladybug/${{ env.LADYBUG_VERSION }}/*.patch
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ladybug-${{ env.LADYBUG_VERSION }}-sdist
path: scripts/pip-package/
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ladybug-${{ env.LADYBUG_VERSION }}-liblbug-static
path: precompiled-liblbug/
- name: Prepare wheel source tree
run: |
mkdir -p scripts/pip-package/cibw-source
tar -xzf scripts/pip-package/ladybug-${{ env.LADYBUG_VERSION }}.tar.gz -C scripts/pip-package/cibw-source
# The wheel statically links the vendored third_party libraries but upstream ships only ladybug's own LICENSE.
- name: Add the vendored libraries' licences
working-directory: scripts/pip-package/cibw-source/sdist
run: |
for f in ladybug-source/third_party/*/LICENSE*; do
cp "$f" "LICENSE.$(basename "$(dirname "$f")")"
done
ls LICENSE*
- name: Build wheels
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
with:
package-dir: scripts/pip-package/cibw-source/sdist
output-dir: wheelhouse/
only: ${{ matrix.python }}-manylinux_riscv64
env:
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
CIBW_BEFORE_ALL_LINUX: dnf install -y openssl-devel pkg-config
CIBW_ENVIRONMENT_LINUX: >-
LBUG_API_PRECOMPILED_LIB_PATH=/project/precompiled-liblbug/liblbug.a
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
CIBW_REPAIR_WHEEL_COMMAND_LINUX: auditwheel repair --exclude libssl.so.3 --exclude libcrypto.so.3 -w {dest_dir} {wheel}
# Not PIP_ONLY_BINARY: torch-geometric is pure Python.
CIBW_TEST_ENVIRONMENT: LBUG_PYTHON_BACKEND=pybind PIP_PREFER_BINARY=1
CIBW_TEST_SOURCES: dataset tools/python_api/test
# Upstream's [dev] test deps; pyarrow 25 is the only riscv64 build, and cp314t has no
# pandas/polars, so it takes the pytz that test_datatype.py imports and pandas brings in.
CIBW_TEST_REQUIRES: >-
pytest pytest-asyncio~=1.0 networkx~=3.0 numpy~=2.0 pyarrow torch torch-geometric>=2.5.0
${{ matrix.python != 'cp314t' && 'pandas~=2.2 polars~=1.30' || 'pytz' }}
# test_fsm.py fails the same way with upstream's own x86_64 0.19.1 wheel. The deselected
# test_json.py tests INSTALL the json extension from upstream's server, which has no riscv64 build.
# test_multi_writer_no_anomalies (4 writers + 2 readers on one Database with
# enable_multi_writes, 15s) aborted once on 0.20.3 cp314t: glibc's assertion in
# pthread_mutex_lock on TaskScheduler::taskSchedulerMtx, a plain std::mutex, so its memory
# was clobbered by something else rather than mis-ordered (gotcha 285). It is not
# free-threading: Connection::query drops the GIL on every interpreter and _lbug declares
# no Py_mod_gil, so cp314t runs with the GIL back on (gotcha 127). The same test tree
# passed on 0.20.4 cp314t and every other leg, and 32 runs of upstream's x86_64 wheel
# passed, as expected for a rare race. Upstream tests only CPython 3.12 on x86_64 and keeps
# fixing races like this one (#766, #840, #934), so we deselect the test rather than debug it.
CIBW_TEST_COMMAND: >-
python -m pytest -vv tools/python_api/test
--ignore=tools/python_api/test/test_fsm.py
--deselect=tools/python_api/test/test_mvcc_bank.py::test_multi_writer_no_anomalies
--deselect=tools/python_api/test/test_json.py::test_to_json_string_param_roundtrip
--deselect=tools/python_api/test/test_json.py::test_to_json_python_param_with_mixed_nested_list
--deselect=tools/python_api/test/test_json.py::test_get_as_df_json_extract
--deselect=tools/python_api/test/test_json.py::test_get_as_df_json_list
${{ matrix.python == 'cp314t' && '--ignore=tools/python_api/test/test_arrow.py --ignore=tools/python_api/test/test_arrow_memory_backed_table.py --ignore=tools/python_api/test/test_df.py --ignore=tools/python_api/test/test_networkx.py --ignore=tools/python_api/test/test_scan_pandas.py --ignore=tools/python_api/test/test_scan_pandas_pyarrow.py --ignore=tools/python_api/test/test_scan_polars.py --ignore=tools/python_api/test/test_udf.py -k "not test_get_as_df_json"' || '' }}
- name: Check the extension module and licences made it into the wheel
run: |
python3 - wheelhouse/*.whl <<'EOF'
import sys, zipfile
for whl in sys.argv[1:]:
names = zipfile.ZipFile(whl).namelist()
assert any(n.startswith("ladybug/_lbug.") and n.endswith(".so") for n in names), f"no compiled extension in {whl}"
licences = {n.rsplit("/", 1)[1] for n in names if ".dist-info/licenses/" in n} - {""}
assert {"LICENSE", "LICENSE.zstd", "LICENSE.re2", "LICENSE.pybind11"} <= licences, licences
print(whl, sorted(licences))
EOF
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ladybug-${{ env.LADYBUG_VERSION }}-${{ matrix.python }}-manylinux_riscv64
path: wheelhouse/*.whl
if-no-files-found: error
publish:
name: Publish ladybug ${{ matrix.version }}
needs: [setup, build_wheels]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
secrets:
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
with:
artifact-pattern: ladybug-${{ matrix.version }}-*-manylinux_riscv64