@@ -93,10 +93,10 @@ jobs:
9393 build-python-wheels :
9494 name : Build Python wheels
9595 runs-on : ${{ matrix.os }}
96- # needs: [ test-go, test-python ]
96+ # needs: [test-go, test-python]
9797 strategy :
9898 matrix :
99- os : [ ubuntu-latest, macos-latest, windows-latest ]
99+ os : [ubuntu-latest, macos-latest, windows-latest]
100100
101101 steps :
102102 - name : Checkout code
@@ -115,52 +115,38 @@ jobs:
115115 - name : Install cibuildwheel
116116 run : pip install cibuildwheel==2.18.1
117117
118- # Pre-build the Go shared library BEFORE running cibuildwheel
119- - name : Pre-build Go library (Linux)
120- if : runner.os == 'Linux'
121- run : |
122- # Build for Linux
123- CGO_ENABLED=1 go build -buildmode=c-shared -o python/spl_toolkit/libspl_toolkit.so ./pkg/bindings
124- ls -la python/spl_toolkit/
125- file python/spl_toolkit/*.so
126-
127- - name : Pre-build Go library (macOS)
128- if : runner.os == 'macOS'
129- run : |
130- # Build for both architectures on macOS
131- # x86_64
132- CGO_ENABLED=1 GOARCH=amd64 go build -buildmode=c-shared -o python/spl_toolkit/libspl_toolkit_amd64.dylib ./pkg/bindings
133- # arm64
134- CGO_ENABLED=1 GOARCH=arm64 go build -buildmode=c-shared -o python/spl_toolkit/libspl_toolkit_arm64.dylib ./pkg/bindings
135- # Create universal binary
136- lipo -create python/spl_toolkit/libspl_toolkit_amd64.dylib python/spl_toolkit/libspl_toolkit_arm64.dylib -output python/spl_toolkit/libspl_toolkit.dylib
137- rm python/spl_toolkit/libspl_toolkit_amd64.dylib python/spl_toolkit/libspl_toolkit_arm64.dylib
138- ls -la python/spl_toolkit/
139- file python/spl_toolkit/*.dylib
140-
141- - name : Pre-build Go library (Windows)
142- if : runner.os == 'Windows'
143- run : |
144- # Build for Windows
145- $env:CGO_ENABLED = "1"
146- go build -buildmode=c-shared -o python/spl_toolkit/libspl_toolkit.dll ./pkg/bindings
147- dir python\spl_toolkit\
148-
149- # Now run cibuildwheel with the pre-built libraries
150118 - name : Build Linux wheels
151119 if : runner.os == 'Linux'
152120 env :
153121 CIBW_BUILD : " cp38-* cp39-* cp310-* cp311-* cp312-*"
154122 CIBW_SKIP : " *musllinux* *i686* *win32*"
155123 CIBW_BUILD_VERBOSITY : 3
156- # Don't need to install Go since library is pre-built
124+ # Install Go in the manylinux container without using yum
125+ CIBW_BEFORE_ALL_LINUX : |
126+ # Download and install Go directly using curl (which is pre-installed)
127+ curl -L https://go.dev/dl/go1.24.6.linux-amd64.tar.gz -o /tmp/go.tar.gz
128+ tar -C /opt -xzf /tmp/go.tar.gz
129+ export PATH=/opt/go/bin:$PATH
130+ go version
131+ # Verify gcc is available (should be pre-installed in manylinux images)
132+ gcc --version
133+ # Build the shared library before building each wheel
157134 CIBW_BEFORE_BUILD_LINUX : |
158- # Library is already built, just verify it exists
159- ls -la {project}/python/spl_toolkit/*.so
135+ export PATH=/opt/go/bin:$PATH
136+ export CGO_ENABLED=1
137+ export CIBUILDWHEEL=1
138+ cd {project}
139+ # Build the Go shared library - note the path matches your setup.py
140+ go build -buildmode=c-shared -o python/spl_toolkit/libspl_toolkit.so ./pkg/bindings
141+ # Verify the library was created
142+ ls -la python/spl_toolkit/*.so
143+ file python/spl_toolkit/*.so
160144 CIBW_ENVIRONMENT_LINUX : |
145+ PATH=/opt/go/bin:$PATH
146+ CGO_ENABLED=1
161147 CIBUILDWHEEL=1
162148 LD_LIBRARY_PATH={project}/python/spl_toolkit:$LD_LIBRARY_PATH
163- # Use newer manylinux image
149+ # Use manylinux_2_28 for newer base image (AlmaLinux 8 based)
164150 CIBW_MANYLINUX_X86_64_IMAGE : manylinux_2_28
165151 CIBW_MANYLINUX_AARCH64_IMAGE : manylinux_2_28
166152 # Repair wheels to include the shared library
@@ -177,15 +163,26 @@ jobs:
177163 if : runner.os == 'macOS'
178164 env :
179165 CIBW_BUILD : " cp38-* cp39-* cp310-* cp311-* cp312-*"
180- CIBW_SKIP : " *musllinux*"
166+ CIBW_SKIP : " *musllinux* *_universal2* "
181167 CIBW_BUILD_VERBOSITY : 3
182- CIBW_ARCHS_MACOS : " universal2 " # Since we built a universal binary
183- # Don't need to build, library is pre-built
168+ CIBW_ARCHS_MACOS : " x86_64 arm64 "
169+ # Build the shared library before building each wheel
184170 CIBW_BEFORE_BUILD_MACOS : |
185- # Library is already built, just verify it exists
186- ls -la {project}/python/spl_toolkit/*.dylib
187- file {project}/python/spl_toolkit/*.dylib
171+ export CGO_ENABLED=1
172+ export CIBUILDWHEEL=1
173+ cd {project}
174+ # Build the Go shared library for the current architecture
175+ if [[ "$ARCHFLAGS" == *"arm64"* ]]; then
176+ export GOARCH=arm64
177+ else
178+ export GOARCH=amd64
179+ fi
180+ go build -buildmode=c-shared -o python/spl_toolkit/libspl_toolkit.dylib ./pkg/bindings
181+ # Verify the library was created
182+ ls -la python/spl_toolkit/*.dylib
183+ file python/spl_toolkit/*.dylib
188184 CIBW_ENVIRONMENT_MACOS : |
185+ CGO_ENABLED=1
189186 CIBUILDWHEEL=1
190187 DYLD_LIBRARY_PATH={project}/python/spl_toolkit:$DYLD_LIBRARY_PATH
191188 # Use delocate to fix macOS wheels
@@ -204,11 +201,15 @@ jobs:
204201 CIBW_BUILD : " cp38-* cp39-* cp310-* cp311-* cp312-*"
205202 CIBW_SKIP : " *musllinux* *win32*"
206203 CIBW_BUILD_VERBOSITY : 3
207- # Don't need to build, library is pre-built
204+ # Build the shared library before building each wheel
208205 CIBW_BEFORE_BUILD_WINDOWS : |
209- # Library is already built, just verify it exists
210- dir {project}\python\spl_toolkit\*.dll
206+ cd {project}
207+ set CGO_ENABLED=1
208+ set CIBUILDWHEEL=1
209+ go build -buildmode=c-shared -o python\spl_toolkit\libspl_toolkit.dll .\pkg\bindings
210+ dir python\spl_toolkit\*.dll
211211 CIBW_ENVIRONMENT_WINDOWS : |
212+ CGO_ENABLED=1
212213 CIBUILDWHEEL=1
213214 PATH={project}\python\spl_toolkit;%PATH%
214215 # Test that the wheel works
@@ -227,7 +228,7 @@ jobs:
227228 build :
228229 name : Build Artifacts
229230 runs-on : ${{ matrix.os }}
230- # needs: [test-go, test-python]
231+ # needs: [test-go, test-python]
231232 strategy :
232233 matrix :
233234 os : [ubuntu-latest, macos-latest, windows-latest]
@@ -305,9 +306,9 @@ jobs:
305306 docker :
306307 name : Build and Push Docker Image
307308 runs-on : ubuntu-latest
308- # needs: [test-go, test-python]
309+ # needs: [test-go, test-python]
309310 if : github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
310-
311+
311312 steps :
312313 - name : Checkout code
313314 uses : actions/checkout@v4
0 commit comments