This is more or less a direct translation of the Travis CI config. Most likely, some details will need to change...