reorganise travis yaml file and add before_install tasks