Skip to content

Commit 314572c

Browse files
committed
chore: revamp CI dist build
1 parent f92701a commit 314572c

3 files changed

Lines changed: 147 additions & 126 deletions

File tree

.github/workflows/dist.yml

Lines changed: 0 additions & 115 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
sudo make install-headers PREFIX=${{ env.LIBROCKSDB_PATH }}
6161
6262
test-linux:
63-
name: Test on Python ${{ matrix.python-version}} with librocksdb-${{ matrix.rocksdb-version }}
63+
name: Test (Python ${{ matrix.python-version }} with librocksdb-${{ matrix.rocksdb-version }})
6464
needs: librocksdb
6565
runs-on: ubuntu-latest
6666
env:
@@ -107,11 +107,14 @@ jobs:
107107
uvx pytest
108108
109109
test-macos:
110-
name: Test on Python ${{ matrix.python-version}} with librocksdb from homebrew
111-
runs-on: macos-latest
110+
name: Test (Python ${{ matrix.python-version }} with macOS ${{ matrix.os.arch }})
111+
runs-on: ${{ matrix.os.runner }}
112112
strategy:
113113
fail-fast: false
114114
matrix:
115+
os:
116+
- { arch: 'Intel', runner: 'macos-13' }
117+
- { arch: 'Arm', runner: 'macos-latest' }
115118
python-version: ['3.10', '3.11', '3.12', '3.13']
116119

117120
steps:
@@ -137,28 +140,28 @@ jobs:
137140
uvx pytest
138141
139142
test-debian:
140-
name: Test on Python ${{ matrix.python-version}} with Debian ${{ matrix.debian-dist }} librocksdb
141-
runs-on: ubuntu-latest
143+
name: Test (Python ${{ matrix.python-version }} with Debian ${{ matrix.debian-dist }} ${{ matrix.os.arch }} librocksdb)
144+
runs-on: ${{ matrix.os.runner }}
142145
container: debian:${{ matrix.debian-dist }}-slim
143146
strategy:
144147
fail-fast: false
145148
matrix:
149+
os:
150+
- { arch: 'x64', runner: 'ubuntu-latest' }
151+
- { arch: 'arm', runner: 'ubuntu-24.04-arm' }
146152
python-version: ['3.10', '3.11', '3.12', '3.13']
147153
debian-dist: [bullseye, bookworm]
148154
steps:
149155
- uses: actions/checkout@v4
150-
- uses: actions/setup-python@v5
151-
with:
152-
python-version: ${{ matrix.python-version }}
156+
- run: apt update
157+
- run: apt install -y nodejs
153158
- uses: astral-sh/setup-uv@v5
154159
with:
155160
python-version: ${{ matrix.python-version }}
156161
enable-cache: false
157162

158163
- name: Install libraries
159-
run: |
160-
apt update
161-
apt install -y build-essential librocksdb-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
164+
run: apt install -y build-essential librocksdb-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
162165

163166
- name: Build python-rocksdb
164167
run: |

.github/workflows/wheels.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# yamllint disable rule:line-length
2+
name: Build distribution
3+
4+
on: # yamllint disable-line rule:truthy
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- master
9+
- main
10+
- dev
11+
- release*
12+
tags:
13+
- v*
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
sdist:
21+
runs-on: ubuntu-latest
22+
name: Build sdists
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.13"
28+
- uses: astral-sh/setup-uv@v5
29+
30+
- name: Make sdist
31+
run: uv build --sdist
32+
- run: ls dist
33+
34+
- uses: actions/upload-artifact@v4
35+
name: Upload build artifacts
36+
with:
37+
name: sdist
38+
path: dist/rocksdb*
39+
40+
manylinux:
41+
needs: [sdist]
42+
name: Build wheels
43+
runs-on: ${{ matrix.manylinux.runner }}
44+
container: quay.io/pypa/${{ matrix.manylinux.name }}
45+
# env:
46+
# LIBROCKSDB_PATH: /opt/rocksdb-${{ matrix.rocksdb_ver }}
47+
strategy:
48+
matrix:
49+
# rocksdb_ver: ['8.11.fb']
50+
python:
51+
- { version: "cp312-cp312" }
52+
# - { version: "cp311-cp311" }
53+
manylinux:
54+
- { name: "manylinux_2_28_x86_64", runner: "ubuntu-latest" }
55+
- { name: "manylinux_2_28_aarch64", runner: "ubuntu-24.04-arm" }
56+
- { name: "manylinux_2_34_x86_64", runner: "ubuntu-latest" }
57+
- { name: "manylinux_2_34_aarch64", runner: "ubuntu-24.04-arm" }
58+
59+
steps:
60+
- uses: actions/download-artifact@v4
61+
with:
62+
name: sdist
63+
64+
- name: Install libraries
65+
run: yum install -y rocksdb rocksdb-devel snappy snappy-devel zlib zlib-devel bzip2 bzip2-devel lz4-devel libzstd-devel
66+
67+
- run: mkdir tmpwheelhouse
68+
69+
- name: Build the wheel
70+
run: uv build --python=/opt/python/${{ matrix.python.version }}/bin/python --wheel rocksdb*.tar.gz -o tmpwheelhouse/
71+
72+
- run: auditwheel repair --plat ${{ matrix.manylinux.name }} tmpwheelhouse/rocksdb*.whl -w wheelhouse/
73+
74+
- uses: actions/upload-artifact@v4
75+
with:
76+
name: "rocksdb-v0.0.0-${{ matrix.manylinux.name }}-${{ matrix.python.version }}"
77+
path: wheelhouse/
78+
79+
# - name: Install cibuildwheel
80+
# run: |
81+
# python3 -m pip install cibuildwheel==1.7.1
82+
83+
# - name: Build wheels
84+
# run: |
85+
# python3 -m cibuildwheel --output-dir dist
86+
# env:
87+
# CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
88+
# CIBW_BUILD: 'cp31*'
89+
# CIBW_SKIP: '*-manylinux_i686'
90+
# # Install python package and test-deps.
91+
# CIBW_TEST_REQUIRES: '.[test] pytest'
92+
# # Use `--pyargs` to interpret parameter as module to import, not as a
93+
# # path, and do not use `python3 -m pytest`. This way we prevent
94+
# # importing the module from the current directory instead of the
95+
# # installed package, and failing when it cannot find the shared
96+
# # library.
97+
# CIBW_TEST_COMMAND: 'pytest --pyargs rocksdb'
98+
# # Avoid re-building the C library in every iteration by testing for
99+
# # the build directory.
100+
# CIBW_BEFORE_BUILD: >
101+
# yum install -y snappy snappy-devel zlib zlib-devel bzip2 bzip2-devel lz4-devel libzstd-devel &&
102+
# test -d ${{ env.LIBROCKSDB_PATH }} || (
103+
# git clone https://github.com/facebook/rocksdb --depth 1
104+
# --branch ${{ matrix.rocksdb_ver }} ${{ env.LIBROCKSDB_PATH }} &&
105+
# cd ${{ env.LIBROCKSDB_PATH }} &&
106+
# CXXFLAGS='-flto -Os -s' PORTABLE=1 make shared_lib -j 4
107+
# ) &&
108+
# pushd ${{ env.LIBROCKSDB_PATH }} &&
109+
# make install-shared &&
110+
# ldconfig &&
111+
# popd
112+
# - uses: actions/upload-artifact@v4
113+
# name: Upload build artifacts
114+
# with:
115+
# path: 'dist/*.whl'
116+
117+
# publish:
118+
# name: Upload packages
119+
# needs: [manylinux, sdist]
120+
# runs-on: 'ubuntu-latest'
121+
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
122+
# steps:
123+
# - uses: actions/download-artifact@v4
124+
# name: 'Download artifacts'
125+
# with:
126+
# name: 'artifact'
127+
# path: 'dist'
128+
#
129+
# - uses: pypa/gh-action-pypi-publish@master
130+
# name: 'Publish built packages'
131+
# with:
132+
# user: '__token__'
133+
# password: '${{ secrets.PYPI_API_TOKEN }}'

0 commit comments

Comments
 (0)