GalSim-developers / GalSim

The modular galaxy image simulation toolkit. Documentation:
http://galsim-developers.github.io/GalSim/
Other
227 stars 107 forks source link

Adds GitHub action to create manylinux and mac os wheels #1127

Closed EiffL closed 3 years ago

EiffL commented 3 years ago

This PR should resolve #1056 , it adds a GitHub action for builiding wheels using the excellent cibuildwheel project.

When triggered (by default set to trigger upon new release), the action generates manylinux and mac os wheels for python 3.6 to python 3.9. This should cover all use cases, although I don't know what's the deal with the Apple Silicon and I don't really want to know ^^' my understanding is that the current wheels should work under emulation on new macs but could add option to compile natively....

We could add automatic upload to pypi if you want @rmjarvis, it's easy enough, but it's currently setup for manual upload. The way it works is the following:

And done! I've tested it on the test pypi: https://test.pypi.org/project/GalSim/#files and you can try to install it from any machine like so:

$ pip install -i https://test.pypi.org/simple/ GalSim

To demonstrate it works on colab: https://colab.research.google.com/drive/10a20mCGadYLiuBVI7_Mwn5DdOUiIh8FF?usp=sharing

Finally, no need for conda anymore \o/

EiffL commented 3 years ago

I've made some changes based on your suggestions, essentially:

I think this should now work as expected. Maybe it won't trigger on simple tags... not sure... but you can always trigger it manually from the action menu.

EiffL commented 3 years ago

I experimented a bit more, 2 observations:

rmjarvis commented 3 years ago

Great. Let's try it out. I'll probably eventually automate the twine call too, but probably better to keep that step manual at first.

rmjarvis commented 3 years ago

Hm. I made a release and published it, but it didn't seem to trigger the action. :( Well, I'll do the manual trigger for now.

rmjarvis commented 3 years ago

Maybe because I used an existing tag? Rather than have the release itself make the tag? Not sure. I set the target to releases/2.3, and I did it after merging this PR, so it should have been there.

Next time I need to make a release tag, I'll do it via the Release page rather than making the tag by hand first, and see if that triggers it. No big deal of course if it doesn't work, since you made it so I can trigger it manually, but I'm just confused why it's not working as expected.

EiffL commented 3 years ago

Hum.... yeah also confused... let me try to create a release of an existing tag on my fork, see if it triggers

EiffL commented 3 years ago

annnnd yes, confirmed. releasing an existing tag doesn't trigger the action :-| oh well...

rmjarvis commented 3 years ago

That's fine. That's a perfectly reasonable workflow to use the Release page to generate both the tag and the wheels. The last check will be when I upload it to pypi to make sure everything installs properly with pip. But the action is still running. Will check that later.

rmjarvis commented 3 years ago

Success! I uploaded them all to pypi, and AFAICT it all seems to be working. I spot checked a few systems, including both Mac and Linux, using a few different flavors of python, and they all downloaded the whl and installed super fast. Yay!

Thanks again François!

EiffL commented 3 years ago

Fantastic!!! Thanks Mike!

rmandelb commented 3 years ago

I'm late to this party, but wanted to say thank you - this looks great!