summary refs log tree commit diff
path: root/maintainers
diff options
context:
space:
mode:
authorWout Mertens <Wout.Mertens@gmail.com>2014-10-15 11:03:30 +0200
committerWout Mertens <Wout.Mertens@gmail.com>2014-10-15 11:05:12 +0200
commit0083284ad86734071f88764bdf732478a3c492f4 (patch)
tree9d610cc25656e7210b1279fe5e54a2651b9fc6d9 /maintainers
parentf59403382291c2ad8a7f77d6a6c520700ef74c7d (diff)
downloadnixpkgs-0083284ad86734071f88764bdf732478a3c492f4.tar
nixpkgs-0083284ad86734071f88764bdf732478a3c492f4.tar.gz
nixpkgs-0083284ad86734071f88764bdf732478a3c492f4.tar.bz2
nixpkgs-0083284ad86734071f88764bdf732478a3c492f4.tar.lz
nixpkgs-0083284ad86734071f88764bdf732478a3c492f4.tar.xz
nixpkgs-0083284ad86734071f88764bdf732478a3c492f4.tar.zst
nixpkgs-0083284ad86734071f88764bdf732478a3c492f4.zip
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.
Diffstat (limited to 'maintainers')
-rwxr-xr-xmaintainers/scripts/travis-nox-review-pr.sh50
1 files changed, 27 insertions, 23 deletions
diff --git a/maintainers/scripts/travis-nox-review-pr.sh b/maintainers/scripts/travis-nox-review-pr.sh
index 927cdfa375f..ece66093e22 100755
--- a/maintainers/scripts/travis-nox-review-pr.sh
+++ b/maintainers/scripts/travis-nox-review-pr.sh
@@ -3,33 +3,37 @@ set -e
 
 export NIX_CURL_FLAGS=-sS
 
-# 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
+if [[ $1 == nix ]]; then
+    # Install Nix
+    bash <(curl -sS https://nixos.org/nix/install) >/dev/null 2>&1
+    source $HOME/.nix-profile/etc/profile.d/nix.sh
 
-# Make sure we can use hydra's binary cache
-sudo mkdir /etc/nix
-sudo tee /etc/nix/nix.conf <<EOF >/dev/null
+    # Make sure we can use hydra's binary cache
+    sudo mkdir /etc/nix
+    sudo tee /etc/nix/nix.conf <<EOF >/dev/null
 binary-caches = http://cache.nixos.org http://hydra.nixos.org
 trusted-binary-caches = http://hydra.nixos.org
 build-max-jobs = 4
 EOF
 
-echo "=== Checking evaluation, including meta"
-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
+    # Verify evaluation
+    nix-env -f. -qa --json >/dev/null
+elif [[ $1 == nox && $TRAVIS_PULL_REQUEST != false ]]; then
+    git clone -q https://github.com/madjar/nox
+    pip --quiet install -e nox
+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
+        # 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
-
-echo "=== Installing nox"
-git clone -q https://github.com/madjar/nox
-pip --quiet install -e nox
-
-echo "=== Reviewing PR"
-# The current HEAD is the PR merged into origin/master, so we compare
-# against origin/master
-nox-review wip --against origin/master