Skip to content

chore: revamp CI dist build #5

chore: revamp CI dist build

chore: revamp CI dist build #5

Workflow file for this run

# yamllint disable rule:line-length
name: Build distribution
on: # yamllint disable-line rule:truthy
workflow_dispatch:
push:
branches:
- master
- main
- dev
- release*
tags:
- v*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sdist:
runs-on: ubuntu-latest
name: Build sdists
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- uses: astral-sh/setup-uv@v5
- name: Make sdist
run: uv build --sdist
- run: ls dist
- uses: actions/upload-artifact@v4
name: Upload build artifacts
with:
name: sdist
path: dist/rocksdb*
manylinux:
needs: [sdist]
name: Build wheels
runs-on: ${{ matrix.manylinux.runner }}
container: quay.io/pypa/${{ matrix.manylinux.name }}
# env:
# LIBROCKSDB_PATH: /opt/rocksdb-${{ matrix.rocksdb_ver }}
strategy:
matrix:
# rocksdb_ver: ['8.11.fb']
python:
- { version: "cp312-cp312" }
# - { version: "cp311-cp311" }
manylinux:
- { name: "manylinux_2_28_x86_64", runner: "ubuntu-latest" }
- { name: "manylinux_2_28_aarch64", runner: "ubuntu-24.04-arm" }
- { name: "manylinux_2_34_x86_64", runner: "ubuntu-latest" }
- { name: "manylinux_2_34_aarch64", runner: "ubuntu-24.04-arm" }
steps:
- uses: actions/download-artifact@v4
with:
name: sdist
- name: Install libraries
run: yum install -y rocksdb rocksdb-devel snappy snappy-devel zlib zlib-devel bzip2 bzip2-devel lz4-devel libzstd-devel
- run: mkdir tmpwheelhouse
- name: Build the wheel
run: uv build --python=/opt/python/${{ matrix.python.version }}/bin/python --wheel rocksdb*.tar.gz -o tmpwheelhouse/
- run: auditwheel repair --plat ${{ matrix.manylinux.name }} tmpwheelhouse/rocksdb*.whl -w wheelhouse/
- uses: actions/upload-artifact@v4
with:
name: "rocksdb-v0.0.0-${{ matrix.manylinux.name }}-${{ matrix.python.version }}"
path: wheelhouse/
# - name: Install cibuildwheel
# run: |
# python3 -m pip install cibuildwheel==1.7.1
# - name: Build wheels
# run: |
# python3 -m cibuildwheel --output-dir dist
# env:
# CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
# CIBW_BUILD: 'cp31*'
# CIBW_SKIP: '*-manylinux_i686'
# # Install python package and test-deps.
# CIBW_TEST_REQUIRES: '.[test] pytest'
# # Use `--pyargs` to interpret parameter as module to import, not as a
# # path, and do not use `python3 -m pytest`. This way we prevent
# # importing the module from the current directory instead of the
# # installed package, and failing when it cannot find the shared
# # library.
# CIBW_TEST_COMMAND: 'pytest --pyargs rocksdb'
# # Avoid re-building the C library in every iteration by testing for
# # the build directory.
# CIBW_BEFORE_BUILD: >
# yum install -y snappy snappy-devel zlib zlib-devel bzip2 bzip2-devel lz4-devel libzstd-devel &&
# test -d ${{ env.LIBROCKSDB_PATH }} || (
# git clone https://github.com/facebook/rocksdb --depth 1
# --branch ${{ matrix.rocksdb_ver }} ${{ env.LIBROCKSDB_PATH }} &&
# cd ${{ env.LIBROCKSDB_PATH }} &&
# CXXFLAGS='-flto -Os -s' PORTABLE=1 make shared_lib -j 4
# ) &&
# pushd ${{ env.LIBROCKSDB_PATH }} &&
# make install-shared &&
# ldconfig &&
# popd
# - uses: actions/upload-artifact@v4
# name: Upload build artifacts
# with:
# path: 'dist/*.whl'
# publish:
# name: Upload packages
# needs: [manylinux, sdist]
# runs-on: 'ubuntu-latest'
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# steps:
# - uses: actions/download-artifact@v4
# name: 'Download artifacts'
# with:
# name: 'artifact'
# path: 'dist'
#
# - uses: pypa/gh-action-pypi-publish@master
# name: 'Publish built packages'
# with:
# user: '__token__'
# password: '${{ secrets.PYPI_API_TOKEN }}'