xmlsec / python-xmlsec

Python bindings for the XML Security Library.
MIT License
93 stars 97 forks source link

Add workflow to build wheels using cibuildwheel #294

Closed jonathangreen closed 6 months ago

jonathangreen commented 6 months ago

This PR adds a new workflow so that wheel builds are done like lxml using cibuildwheel, creating statically linked wheels for the platforms supported by cibuildwheel. See the lxml workflows/wheels.yml here.

This build a static wheel for each platform, runs the test suite using this wheel, and then uploads the wheel as a build artifact.

This should let us push wheels for all platforms out to PyPi. Right now the workflow just attaches the built wheels to the build as an artifact, since I don't have any access to PyPi for this repo. cibuildwheel has some guidance in their docs as to how to upload the built wheels to PyPi and could be added to the workflow as a follow up.

In order to successfully build static wheels for all the platforms these PR will need to be merged before this one:

jonathangreen commented 6 months ago

Now that https://github.com/xmlsec/python-xmlsec/pull/292 is merged, I pulled that new commit into this PR, so the wheel builds are working and tests are passing for linux targets. MacOS targets won't work until https://github.com/xmlsec/python-xmlsec/pull/293 goes in. You can see the wheels built by this PR in the workflow run.

jonathangreen commented 6 months ago

@mxamin not sure if you have any interest in this one, but I rebased it to the latest commits as well. Now that #291, #292 and #293 are all merged in, the ci build wheel workflow should complete successfully and upload all the built wheels as artifacts.

mxamin commented 6 months ago

@jonathangreen Yes, of course I'm interested :) I still need to do some more tests. Meanwhile what's the blocker to get the wheels for windows platforms? Currently our main tool to create windows wheels is Appveyor which I wasn't able to make it work.

jonathangreen commented 6 months ago

The main blocker for windows wheels is that I don't know anything about Python builds on Windows, or really doing builds on windows in general 😆

cibuildwheel supports it, and GH actions has windows workers so I'm fairly sure its is quite doable to build the windows wheels are part of this workflow.

jonathangreen commented 6 months ago

@mxamin I made a small PR here to add the windows wheel builds back into this action with the few details I know about the windows builds: https://github.com/xmlsec/python-xmlsec/pull/308

I figured it was useful to keep the windows bit separate, since those jobs are failing. Let me know though if you want me to merge https://github.com/xmlsec/python-xmlsec/pull/308 into this one.

mxamin commented 6 months ago

@jonathangreen Do you know why "cp37-manylinux_aarch64" build is failing?

jonathangreen commented 6 months ago

It was passing when I originally made the PR. When I have a chance later today I'll take a look and see whats going on there.

jonathangreen commented 6 months ago

It looks like upstream lxml stopped publishing wheels for cp37-manylinux_aarch64, which was causing the job to fail, because we couldn't install lxml via a wheel during the build process.

Here is where lxml excluded these wheels:

I updated the workflow, so we exclude the same wheel builds that lxml does, which should get everything building again.