Merge pull request #4 from mosquito/backport/binaries

Backport/binaries
This commit is contained in:
iFA 2021-08-26 10:37:46 +02:00 committed by GitHub
commit e32fc600da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 181 additions and 0 deletions

127
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,127 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: build
on:
push:
branches:
- 'release/**'
release:
types:
- created
jobs:
wheel:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# MacOS
- python: '3.6'
os: macos-latest
- python: '3.7'
os: macos-latest
- python: '3.8'
os: macos-latest
- python: '3.9'
os: macos-latest
# Windows
# - python: '3.6'
# os: windows-latest
#- python: '3.7'
# os: windows-latest
#- python: '3.8'
# os: windows-latest
#- python: '3.9'
# os: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Cache .a files
uses: actions/cache@v2
with:
key: ${{ runner.os }}
path: |
src/rocksdb/libsnappy.a
src/rocksdb/liblz4.a
src/rocksdb/libbz2.a
src/rocksdb/libzstd.a
src/rocksdb/libz.a
src/rocksdb/librocksdb.a
- name: Setup python${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: "${{ matrix.python }}"
- name: Make static library files
run: make
- name: Install requires
run: python -m pip install cython twine wheel
- name: Build wheel for python "${{ matrix.python }}"
run: python setup.py bdist_wheel
- name: Publishing to pypi
run: twine upload --skip-existing --disable-progress-bar dist/*.whl
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
linux-wheels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Cache .a files
uses: actions/cache@v2
with:
key: ${{ runner.os }}
path: |
src/rocksdb/libsnappy.a
src/rocksdb/liblz4.a
src/rocksdb/libbz2.a
src/rocksdb/libzstd.a
src/rocksdb/libz.a
src/rocksdb/librocksdb.a
- name: Make static library files
uses: docker://quay.io/pypa/manylinux2014_x86_64
with:
args: /usr/bin/make
- name: Install requires
run: python -m pip install cython twine wheel
- name: Building manylinux2014 wheels
uses: docker://quay.io/pypa/manylinux2014_x86_64
with:
args: /bin/bash scripts/make-wheels.sh
- name: Setup python${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install requires
run: python -m pip install twine
- name: Publishing to pypi
run: twine upload --skip-existing --disable-progress-bar dist/*.whl
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "src/rocksdb"]
path = src/rocksdb
url = https://github.com/facebook/rocksdb.git

View file

@ -1,3 +1,4 @@
include README.rst
include rocksdb/cpp/*.hpp include rocksdb/cpp/*.hpp
recursive-include rocksdb *.pxd recursive-include rocksdb *.pxd
recursive-include rocksdb *.pyx recursive-include rocksdb *.pyx

44
Makefile Normal file
View file

@ -0,0 +1,44 @@
all: src/rocksdb/librocksdb.a
JOBS=8
src/rocksdb/librocksdb.a:
make \
-e EXTRA_CXXFLAGS="-fPIC" \
-e EXTRA_CFLAGS="-fPIC" \
-C src/rocksdb \
-j $(JOBS) \
libsnappy.a \
liblz4.a \
libbz2.a \
libzstd.a \
libz.a
(cd src/rocksdb && mkdir -p build && cd build && cmake \
-DWITH_SNAPPY=1 \
-DWITH_LZ4=1 \
-DWITH_ZLIB=1 \
-DWITH_ZSTD=1 \
-DWITH_GFLAGS=0 \
-DROCKSDB_BUILD_SHARED=0 \
-DWITH_TOOLS=0 \
-DWITH_BENCHMARK_TOOLS=0 \
-DWITH_CORE_TOOLS=0 \
-DWITH_JEMALLOC=0 \
-DCMAKE_BUILD_TYPE=Release \
-DSnappy_INCLUDE_DIRS=../snappy-1.1.8/ \
-DSnappy_LIBRARIES=../snappy-1.1.8/build \
-Dlz4_INCLUDE_DIRS=../lz4-1.9.3/lib \
-Dlz4_LIBRARIES=../lz4-1.9.3/lib \
-Dzstd_INCLUDE_DIRS=../zstd-1.4.9/lib \
-Dzstd_LIBRARIES=../zstd-1.4.9/lib \
-DZLIB_INCLUDE_DIR=../zlib-1.2.11 \
-DZLIB_LIBRARY=./zlib-1.2.11 \
-DCMAKE_CXX_FLAGS="-fPIC -I../snappy-1.1.8/build -I../zstd-1.4.9/lib/dictBuilder" \
.. && make -j $(JOBS))
cp src/rocksdb/build/librocksdb.a src/rocksdb/librocksdb.a
clean:
rm -rf src/rocksdb/build
make -C src/rocksdb clean

View file

@ -2,6 +2,12 @@ Installing
========== ==========
.. highlight:: bash .. highlight:: bash
With conda
**********
.. code-block:: bash
conda install -c conda-forge python-rocksdb
With distro package and pypi With distro package and pypi
**************************** ****************************