ocaml-ci-scripts
ocaml-ci-scripts copied to clipboard
Whitelist PPA for faster builds
According to http://docs.travis-ci.com/user/apt/ we can ask for the opam PPA and packages to be whitelisted, which would allow building with sudo: false
, which is apparently much faster.
This is related to #32. To be honest I have not yet encountered both issues, so I'm not sure what to do.
Any new repositories created today require a sudo: required
line. Existing repositories are slowing being included in this scheme, starting from the most recently created and working backwards. Eventually, everything will need to be updated.
ha ok, thanks for the explanation. We still need sudo to install the depexts though, so I'll merge #32 first.
I've asked to have both avsm/ppa and opam added to the whitelist, so both are now available and we can now run travis without sudo.
@bluddy thanks! unfortunately by default we don't know which packages to whitelist in the .travis.yml
file, as this is detected at runtime using opam depext
. Not sure if we can solve this properly.
Ah ok. I hadn't bothered to look up opam depext
before. You also can't install anything with apt - everything has to be done through travis' new API in the yaml file - so there's no way it'll work unless travis comes up with a more dynamic API.
would something like this work? I haven't worked out the bash 100% (variable scoping), but it allows dpkg
to test if a package is installed. if not, then it tries to run the sudo apt
commands needed. still need to figure out how to get multiple, potentially conflicting, packages installed
this way, you could use the sudo: false
infra if you take the time to list the packages in travis
pkgs=
for pkg in ocaml ocaml-base ocaml-native-compilers ocaml-compiler-libs\
ocaml-interp ocaml-base-nox ocaml-nox camlp4 camlp4-extra
do
if ! dpkg -l $pkg | grep -Eq 'ii *'$pkg' *'$(full_version $pkg $OCAML_VERSION)
then
pkgs="$(full_apt_version $pkg $OCAML_VERSION) $pkgs"
fi
done
for pkg in jq opam
do
if ! dpkg -l $pkg; then
pkgs="$pkg $pkgs"
fi
done
if [ ! -z $pkgs ]; then
sudo add-apt-repository --yes ppa:${ppa}
sudo apt-get update -qq
sudo apt-get install -y $pkgs
fi