Skip to content

Commit 97eb8f6

Browse files
initialise with pylibbpf name
Signed-off-by: varun-r-mallya <[email protected]>
1 parent f5eb8e1 commit 97eb8f6

File tree

14 files changed

+412
-267
lines changed

14 files changed

+412
-267
lines changed

.appveyor.yml

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

.github/workflows/conda.yml

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

.github/workflows/pip.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,46 @@ on:
66
push:
77
branches:
88
- master
9+
- main
910

1011
jobs:
1112
build:
1213
strategy:
1314
fail-fast: false
1415
matrix:
15-
platform: [windows-latest, macos-13, ubuntu-latest]
16-
python-version: ["3.7", "3.11"]
17-
16+
platform: [ubuntu-latest]
17+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
18+
1819
runs-on: ${{ matrix.platform }}
19-
20+
2021
steps:
2122
- uses: actions/checkout@v4
2223
with:
2324
submodules: true
24-
25+
2526
- uses: actions/setup-python@v5
2627
with:
2728
python-version: ${{ matrix.python-version }}
28-
29+
30+
- name: Install system dependencies
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install -y \
34+
libbpf-dev \
35+
linux-headers-generic \
36+
build-essential \
37+
cmake \
38+
ninja-build
39+
2940
- name: Add requirements
30-
run: python -m pip install --upgrade wheel setuptools
31-
41+
run: python -m pip install --upgrade pip wheel setuptools
42+
3243
- name: Build and install
3344
run: pip install --verbose .[test]
34-
45+
46+
- name: Test import
47+
run: python -c "import pylibbpf; print('Import successful')"
48+
3549
- name: Test
36-
run: python -m pytest
50+
run: python -m pytest -v
51+

.github/workflows/wheels.yml

Lines changed: 55 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: Wheels
2-
32
on:
43
workflow_dispatch:
54
pull_request:
65
push:
76
branches:
87
- master
8+
- main
99
release:
1010
types:
1111
- published
@@ -18,64 +18,93 @@ jobs:
1818
- uses: actions/checkout@v4
1919
with:
2020
submodules: true
21-
21+
2222
- name: Build SDist
2323
run: pipx run build --sdist
24-
24+
2525
- name: Check metadata
2626
run: pipx run twine check dist/*
27-
27+
2828
- uses: actions/upload-artifact@v4
2929
with:
3030
name: cibw-sdist
3131
path: dist/*.tar.gz
3232

33-
3433
build_wheels:
35-
name: Wheels on ${{ matrix.os }}
36-
runs-on: ${{ matrix.os }}
34+
name: Build wheels on Linux
35+
runs-on: ubuntu-latest
3736
strategy:
3837
fail-fast: false
3938
matrix:
40-
os: [ubuntu-latest, windows-latest, macos-13]
41-
39+
# Build for both x86_64 and aarch64
40+
arch: [x86_64, aarch64]
41+
4242
steps:
4343
- uses: actions/checkout@v4
4444
with:
4545
submodules: true
46-
47-
- uses: pypa/[email protected]
46+
47+
# Set up QEMU for aarch64 emulation
48+
- name: Set up QEMU
49+
if: matrix.arch == 'aarch64'
50+
uses: docker/setup-qemu-action@v3
51+
with:
52+
platforms: arm64
53+
54+
- name: Build wheels
55+
uses: pypa/[email protected]
4856
env:
49-
CIBW_ARCHS_MACOS: auto universal2
50-
57+
# Only build for Linux
58+
CIBW_PLATFORM: linux
59+
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
60+
61+
# Python versions to build for
62+
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*"
63+
CIBW_SKIP: "*-musllinux*" # Skip musl builds, focus on glibc
64+
65+
# Install system dependencies before building
66+
CIBW_BEFORE_ALL_LINUX: >
67+
yum install -y epel-release &&
68+
yum install -y libbpf-devel kernel-headers ||
69+
(apt-get update && apt-get install -y libbpf-dev linux-headers-generic)
70+
71+
# Test the built wheels
72+
CIBW_TEST_COMMAND: "python -c 'import pylibbpf; print(f\"pylibbpf {pylibbpf.__version__} imported successfully\")'"
73+
74+
# Skip testing on emulated architectures (too slow)
75+
CIBW_TEST_SKIP: "*-linux_aarch64"
76+
5177
- name: Verify clean directory
5278
run: git diff --exit-code
5379
shell: bash
54-
80+
5581
- name: Upload wheels
5682
uses: actions/upload-artifact@v4
5783
with:
58-
name: cibw-wheels-${{ matrix.os }}
84+
name: cibw-wheels-linux-${{ matrix.arch }}
5985
path: wheelhouse/*.whl
6086

61-
6287
upload_all:
63-
name: Upload if release
88+
name: Upload to PyPI if release
6489
needs: [build_wheels, build_sdist]
6590
runs-on: ubuntu-latest
6691
if: github.event_name == 'release' && github.event.action == 'published'
67-
92+
permissions:
93+
# IMPORTANT: this permission is mandatory for trusted publishing
94+
id-token: write
95+
environment:
96+
name: pypi
97+
# url: https://pypi.org/project/pylibbpf/${{ github.event.release.name }}
98+
6899
steps:
69-
- uses: actions/setup-python@v5
70-
with:
71-
python-version: "3.x"
72-
73-
- uses: actions/download-artifact@v4
100+
- name: Download all artifacts
101+
uses: actions/download-artifact@v4
74102
with:
75103
pattern: cibw-*
76104
path: dist
77105
merge-multiple: true
78-
79-
- uses: pypa/gh-action-pypi-publish@release/v1
106+
107+
- name: Publish to PyPI
108+
uses: pypa/gh-action-pypi-publish@release/v1
80109
with:
81-
password: ${{ secrets.pypi_password }}
110+
packages-dir: dist/

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ _generate/
66
*.py[cod]
77
*.egg-info
88
*env*
9+
build/
10+
*venv/
11+
.idea/

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
cmake_minimum_required(VERSION 3.4...3.18)
2-
project(cmake_example)
1+
cmake_minimum_required(VERSION 4.0)
2+
project(pylibbpf)
33

44
add_subdirectory(pybind11)
5-
pybind11_add_module(cmake_example src/main.cpp)
5+
pybind11_add_module(pylibbpf src/main.cpp)
66

77
# EXAMPLE_VERSION_INFO is defined by setup.py and passed into the C++ code as a
88
# define (VERSION_INFO) here.
9-
target_compile_definitions(cmake_example
9+
target_compile_definitions(pylibbpf
1010
PRIVATE VERSION_INFO=${EXAMPLE_VERSION_INFO})

0 commit comments

Comments
 (0)