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
name: Release
# Triggered by pushing a version tag: git tag v0.2.1 && git push --tags
on:
push:
tags:
- "v*"
workflow_dispatch:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
# ── Build wheels for all supported platforms ─────────────────────────────
build-wheels:
name: Wheel — ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64 — quay.io/pypa/manylinux_2_28_x86_64 (AlmaLinux 8).
# librocksdb-sys needs libclang for bindgen; see before-script-linux below.
- name: linux-x86_64
os: ubuntu-latest
target: x86_64
manylinux: "2_28"
qemu: false
maturin-container: ""
python-version: ""
# Linux aarch64 — native ARM64 runner; no QEMU needed.
# maturin-action auto-selects quay.io/pypa/manylinux_2_28_aarch64 container.
- name: linux-aarch64
os: ubuntu-22.04-arm
target: aarch64
manylinux: "2_28"
qemu: false
maturin-container: ""
python-version: ""
# macOS universal2 — fat wheel for Intel + Apple Silicon.
# actions/setup-python pins Python 3.12 to avoid PyO3 0.22's ≤3.13 check;
# PYO3_USE_ABI3_FORWARD_COMPATIBILITY is a fallback for the cross-compile part.
- name: macos-universal
os: macos-latest
target: universal2-apple-darwin
manylinux: ""
qemu: false
maturin-container: ""
python-version: "3.12"
# Windows x86_64.
- name: windows-x86_64
os: windows-latest
target: x86_64
manylinux: ""
qemu: false
maturin-container: ""
python-version: ""
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# Required for linux-aarch64: registers QEMU binfmt handlers so Docker can
# run the native aarch64 manylinux container on an x86_64 host.
- uses: docker/setup-qemu-action@v3
if: matrix.qemu
with:
platforms: aarch64
# Pin Python on macOS to avoid PyO3 0.22's Python ≤ 3.13 version check.
- uses: actions/setup-python@v5
if: matrix.python-version != ''
with:
python-version: ${{ matrix.python-version }}
- name: Build wheel
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --features python
manylinux: ${{ matrix.manylinux }}
container: ${{ matrix.maturin-container }}
# librocksdb-sys uses bindgen which requires libclang.
# On AlmaLinux 8 (manylinux_2_28), clang installs libclang.so into a
# versioned subdirectory (/usr/lib64/llvmN/lib/) that bindgen won't scan.
# We install clang+clang-devel then symlink the library into /usr/lib64/
# so bindgen finds it. before-script-linux is ignored on macOS/Windows.
before-script-linux: |
yum install -y clang clang-devel
LIBCLANG=$(find /usr/lib64 /usr/lib -name 'libclang.so*' -type f 2>/dev/null | sort | head -1)
if [ -n "$LIBCLANG" ]; then
ln -sf "$LIBCLANG" /usr/lib64/libclang.so
fi
env:
# Suppress PyO3 max-version check on Windows (no Docker, env is forwarded).
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
# RocksDB 8.10.0 uses C++17 aligned-allocation operators only available on
# macOS 10.13+. librocksdb-sys defaults to 10.12, which breaks the x86_64
# slice of the universal2 cross-compile. Ignored on Linux/Windows.
MACOSX_DEPLOYMENT_TARGET: "10.13"
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.name }}
path: dist/*.whl
# ── Build source distribution (sdist) ────────────────────────────────────
# Users on unsupported platforms can install from source with:
# pip install minigdb --no-binary minigdb
# They need: Rust toolchain + cmake + C++ compiler.
build-sdist:
name: Source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist artifact
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
# ── Publish to PyPI ───────────────────────────────────────────────────────
# Uses OIDC trusted publishing — no API token secret required.
publish:
name: Publish to PyPI
needs:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # required for OIDC trusted publishing
steps:
- name: Download all wheel artifacts
uses: actions/download-artifact@v4
with:
pattern: "wheels-*"
merge-multiple: true
path: dist
- name: Download sdist artifact
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
with:
command: upload
args: --non-interactive --skip-existing dist/**
# ── Create GitHub Release ─────────────────────────────────────────────────
github-release:
name: GitHub Release
needs:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write # required to create releases
steps:
- name: Download all wheel artifacts
uses: actions/download-artifact@v4
with:
pattern: "wheels-*"
merge-multiple: true
path: dist
- name: Download sdist artifact
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/**
generate_release_notes: true