11name : Pip
22
33on :
4- workflow_dispatch :
5- pull_request :
64 push :
7- branches :
8- - master
9- - main
5+ branches : [main, master]
6+ pull_request :
7+ branches : [main, master]
8+ workflow_dispatch :
109
1110jobs :
12- build :
11+ test :
12+ name : Test on Python ${{ matrix.python-version }}
13+ runs-on : ubuntu-latest
1314 strategy :
1415 fail-fast : false
1516 matrix :
16- platform : [ubuntu-latest]
17- python-version : ["3.12", "3.13"]
18-
19- runs-on : ${{ matrix.platform }}
17+ python-version : ['3.12', '3.13']
2018
2119 steps :
22- - uses : actions/checkout@v5
20+ - name : Checkout code
21+ uses : actions/checkout@v5
2322 with :
24- submodules : true
23+ submodules : recursive
2524
26- - uses : actions/setup-python@v6
25+ - name : Verify submodules
26+ run : |
27+ echo "Checking submodule status:"
28+ git submodule status
29+ echo "Checking libbpf directory:"
30+ ls -la libbpf/
31+ echo "Checking libbpf/src:"
32+ ls -la libbpf/src/ || echo "libbpf/src not found!"
33+
34+ - name : Set up Python ${{ matrix.python-version }}
35+ uses : actions/setup-python@v5
2736 with :
2837 python-version : ${{ matrix.python-version }}
2938
@@ -33,19 +42,72 @@ jobs:
3342 sudo apt-get install -y \
3443 libbpf-dev \
3544 libelf-dev \
36- linux-headers-generic \
45+ zlib1g-dev \
3746 build-essential \
47+ clang \
3848 cmake \
39- ninja-build
49+ ninja-build \
50+ pkg-config \
51+ git \
52+ make
4053
41- - name : Add requirements
42- run : python -m pip install --upgrade pip wheel setuptools
54+ - name : Install Python build dependencies
55+ run : |
56+ python -m pip install --upgrade pip
57+ pip install --upgrade "setuptools>=77.0.0" wheel
58+ pip install cmake ninja pybind11
4359
44- - name : Build and install
45- run : pip install --verbose .[test]
60+ - name : Check build requirements
61+ run : |
62+ echo "Python version:"
63+ python --version
64+ echo "CMake version:"
65+ cmake --version
66+ echo "Ninja version:"
67+ ninja --version
68+ echo "Setuptools version:"
69+ python -c "import setuptools; print(setuptools.__version__)"
4670
47- - name : Test import
48- run : python -I -c "import pylibbpf; print('Import successful')"
71+ - name : Build and install pylibbpf (verbose)
72+ run : |
73+ pip install -v -e . 2>&1 | tee build.log
74+ continue-on-error : false
4975
50- - name : Test
51- run : python -I -m pytest -v
76+ - name : Check build output
77+ run : |
78+ echo "Build directory contents:"
79+ find build -type f -name "*.so" 2>/dev/null || echo "No .so files found in build/"
80+ echo ""
81+ echo "Looking for pylibbpf extension:"
82+ find . -name "pylibbpf*.so" -o -name "pylibbpf*.pyd"
83+ echo ""
84+ echo "Site-packages contents:"
85+ python -c "import site; print(site.getsitepackages())"
86+ ls -la $(python -c "import site; print(site.getsitepackages()[0])")/pylibbpf/ || echo "pylibbpf not in site-packages"
87+
88+ - name : Try importing extension directly
89+ run : |
90+ python -c "
91+ import sys
92+ print('Python path:', sys.path)
93+ try:
94+ from pylibbpf import pylibbpf
95+ print('Successfully imported pylibbpf.pylibbpf')
96+ print('pylibbpf.pylibbpf members:', dir(pylibbpf))
97+ except ImportError as e:
98+ print(f'Failed to import pylibbpf.pylibbpf: {e}')
99+ "
100+
101+ - name : Verify extension loaded
102+ run : |
103+ python -c "import pylibbpf; print('Members:', dir(pylibbpf)); assert hasattr(pylibbpf, 'BpfObject'), 'BpfObject not found!'; print('✓ OK')"
104+
105+ - name : Install test dependencies
106+ if : success()
107+ run : |
108+ pip install pytest pytest-cov
109+
110+ - name : Run tests
111+ if : success()
112+ run : |
113+ python -I -m pytest -v -s --cov=pylibbpf --cov-report=term-missing
0 commit comments