project-rig / rig_c_sa

Python C module for the Rig simulated annealing placer C kernel
GNU General Public License v2.0
0 stars 1 forks source link

Wheel inventing: Automatic compilation and deployment of binaries on multiple platforms. #3

Closed mossblaser closed 8 years ago

mossblaser commented 8 years ago

Introduction

This branch aims to solve the hellish nightmare of testing and compiling C Python extensions against many different platforms, especially ones which cost $$$. Since various free CI systems provide the ability to run tests against OS X and Windows we can use these services to perform the build step while also running some limited testing on several platforms.

Linux and Mac OS X

Travis CI offers Linux and OS X builds though the OS X service is currently in beta and rather rough-edged. In particular, different Python versions are not provided in the OS X environment so this commit uses pyenv to manually install them. To keep things simple this approach is also used for Linux builds.

Getting everything required to make the test suite work under OS X is a pain (the 'check' unit test library most notably). As a result, the test suite is only compiled and executed under Linux.

On both platforms we then check that the setup process isn't broken (i.e. we check that the C and CFFI code compiles and installs correctly). On OS X this is the only "test" we actually perform.

Finally if the test is being run against a tag (i.e. a release) we want to package everything up into a Python source distribution and pre-compiled "binary wheel" distributions and upload them to PyPI. Since the latter isn't allowed on Linux (yet...) only OS X does this. Note that the source distribution will be built several times but only the first upload will succeed so this doesn't matter.

Windows

AppVeyor provide a pretty nice CI for Windows under similar terms to GitHub (and with a similar level of polish). Since the test suite requires C99 and (ideally) Valgrind, we can't use this on Windows. Instead we just perform the totally comprehensive "compile and see if it imports" test. Finally if the tests are being run against a tag (i.e. a release) we build and upload "binary wheel" distributions to PyPI. AppVeyor builds packages for both 32bit and 64 bit windows.