diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41bb9d262..5aa6fc45d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,6 +93,30 @@ jobs: - name: Upload coverage reports to Codecov with GitHub Action uses: codecov/codecov-action@v2 + build_wheels: + name: Build wheels + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + name: Install Python + with: + python-version: "3.11" + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + with: + platforms: all + + - name: Build wheels + uses: pypa/cibuildwheel@v1.12.0 + # env: + # # configure cibuildwheel to build native archs ('auto'), and some + # # emulated ones + # CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x + containerbuild: strategy: matrix: diff --git a/.gitignore b/.gitignore index 506f49166..873ae18a4 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ logprep.log examples/k8s/charts *.so target +wheelhouse diff --git a/CHANGELOG.md b/CHANGELOG.md index e853807f8..955a9940c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ### Breaking ### Features ### Improvements + +* adds support for rust extension development +* adds prebuild wheels for architectures `x86_64 i686 aarch64` on `manylinux` and `musllinux` based linux platforms + ### Bugfix ## 13.1.2 diff --git a/logprep/framework/pipeline_manager.py b/logprep/framework/pipeline_manager.py index 7b374e78e..0c27d7348 100644 --- a/logprep/framework/pipeline_manager.py +++ b/logprep/framework/pipeline_manager.py @@ -2,7 +2,6 @@ # pylint: disable=logging-fstring-interpolation -import ctypes import logging import logging.handlers import multiprocessing @@ -21,8 +20,6 @@ from logprep.util.configuration import Configuration from logprep.util.logging import LogprepMPQueueListener, logqueue -libc = ctypes.CDLL("libc.so.6") - logger = logging.getLogger("Manager") @@ -48,7 +45,7 @@ def throttle(self, batch_size=1): self.wait_time, int(self.wait_time * self.consumed_percent / batch_size) ) # sleep times in microseconds - libc.usleep(sleep_time) + time.sleep(sleep_time / 1000) def put(self, obj, block=True, timeout=None, batch_size=1): """Put an obj into the queue.""" diff --git a/pyproject.toml b/pyproject.toml index 73b8d0f8c..aed049f10 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ requires = [ build-backend = "setuptools.build_meta" [tool.setuptools] -packages = ["logprep"] +package-dir = { "" = "logprep" } [tool.setuptools_scm] fallback_version = "unset" @@ -110,6 +110,7 @@ dev = [ "responses", "jinja2", "maturin", + "cibuildwheel", ] doc = [ @@ -145,3 +146,12 @@ extend-exclude = ''' [tool.isort] profile = "black" + +[tool.cibuildwheel] +build = "cp310-* cp311-* cp312-*" +skip = "*pp* *i686*musl*" + +[tool.cibuildwheel.linux] +archs = "x86_64 i686 aarch64" +before-build = "curl -sSf https://sh.rustup.rs | sh -s -- -y" +environment = 'PATH=$HOME/.cargo/bin:$PATH' diff --git a/rust/lib.rs b/rust/lib.rs index 1779a7d5f..de1024aff 100644 --- a/rust/lib.rs +++ b/rust/lib.rs @@ -1,4 +1,3 @@ -#[cfg(test)] mod tests; use pyo3::prelude::*;