Forward-ports parts of the 0.3.2 travis config on top of the 0.2.9 merge. Part of 24629, also fixes 27090.