Travis: chop build in install and build phases

This allows us to see how long install takes.
Also, build from hydra binaries as much as possible.
This commit is contained in:
Wout Mertens 2014-10-15 11:03:30 +02:00
parent f594033822
commit 0083284ad8
2 changed files with 30 additions and 24 deletions

View File

@ -1,3 +1,5 @@
language: python
python: "3.4"
script: ./maintainers/scripts/travis-nox-review-pr.sh
before_install: ./maintainers/scripts/travis-nox-review-pr.sh nix
install: ./maintainers/scripts/travis-nox-review-pr.sh nox
script: ./maintainers/scripts/travis-nox-review-pr.sh build

View File

@ -3,8 +3,8 @@ set -e
export NIX_CURL_FLAGS=-sS
if [[ $1 == nix ]]; then
# Install Nix
echo "=== Installing Nix..."
bash <(curl -sS https://nixos.org/nix/install) >/dev/null 2>&1
source $HOME/.nix-profile/etc/profile.d/nix.sh
@ -16,20 +16,24 @@ trusted-binary-caches = http://hydra.nixos.org
build-max-jobs = 4
EOF
echo "=== Checking evaluation, including meta"
# Verify evaluation
nix-env -f. -qa --json >/dev/null
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
echo "===> Not a pull request, checking evaluation"
nix-build pkgs/top-level/release.nix -A tarball
exit 0
fi
echo "=== Installing nox"
elif [[ $1 == nox && $TRAVIS_PULL_REQUEST != false ]]; then
git clone -q https://github.com/madjar/nox
pip --quiet install -e nox
echo "=== Reviewing PR"
elif [[ $1 == build ]]; then
if [[ $TRAVIS_PULL_REQUEST == false ]]; then
echo "===> Not a pull request, checking evaluation"
nix-build pkgs/top-level/release.nix -A tarball
else
# The current HEAD is the PR merged into origin/master, so we compare
# against origin/master
nox-review wip --against origin/master
# However, since we want to optimize build time, we compare against
# the last commit Hydra compiled
built_rev=$(ls -l $HOME/.nix-defexpr/channels/nixpkgs | sed 's/.*\.\(.*\)\/nixpkgs/\1/')
nox-review wip --against $built_rev
fi
else
echo "$0: Unknown option $1" >&2
false
fi