summaryrefslogtreecommitdiffstats
path: root/maintainers
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2016-06-27 21:29:12 +0000
committerMatthew Bauer <mjbauer95@gmail.com>2016-07-12 21:34:58 +0000
commitf76e5ab0cf0aa28e437a6b1c4aef4a85d2901b73 (patch)
tree691d09c10489a797eaa1fa1f878d757d72858117 /maintainers
parentdde259dfb5a0787b28e260da7575079bbabad6c3 (diff)
travis: split build into matrix of 3
This adds a 3rd matrix to be built by Travis. The new matrix "checks" the NixPkgs evaluation so the other 2 can save their resources for building. Hopefully, this will lead to less "out of space" errors that seem to be happening with Travis. Also adds folding.
Diffstat (limited to 'maintainers')
-rwxr-xr-xmaintainers/scripts/travis-nox-review-pr.sh109
1 files changed, 61 insertions, 48 deletions
diff --git a/maintainers/scripts/travis-nox-review-pr.sh b/maintainers/scripts/travis-nox-review-pr.sh
index 092fc0cd9d07..025b27528e94 100755
--- a/maintainers/scripts/travis-nox-review-pr.sh
+++ b/maintainers/scripts/travis-nox-review-pr.sh
@@ -1,58 +1,71 @@
#! /usr/bin/env bash
set -e
+# This should make Curl silent
+# but download-from-binary-cache doesn't respect
export NIX_CURL_FLAGS=-sS
-if [[ $1 == nix ]]; then
- echo "=== Installing Nix..."
- # Install Nix
- bash <(curl -sS https://nixos.org/nix/install)
+if [ -d $HOME/.nix-profile ]; then
source $HOME/.nix-profile/etc/profile.d/nix.sh
+fi
- # Make sure we can use hydra's binary cache
- sudo mkdir /etc/nix
- sudo sh -c 'echo "build-max-jobs = 4" > /etc/nix/nix.conf'
+while test -n "$1"; do
- # Verify evaluation
- echo "=== Verifying that nixpkgs evaluates..."
- nix-env -f. -qa --json >/dev/null
-elif [[ $1 == nox ]]; then
- source $HOME/.nix-profile/etc/profile.d/nix.sh
- echo "=== Installing nox..."
- nix-build -A nox '<nixpkgs>' --show-trace
-elif [[ $1 == build ]]; then
- source $HOME/.nix-profile/etc/profile.d/nix.sh
+ # tell Travis to use folding
+ echo -en "travis_fold:start:$1\r"
+
+ case $1 in
+
+ install)
+ echo "=== Installing Nix..."
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then
- echo "Skipping NixOS things on darwin"
- else
- # Nix builds in /tmp and we need exec support
- sudo mount -o remount,exec /run
- sudo mount -o remount,exec /run/user
- sudo mount
-
- echo "=== Checking NixOS options"
- nix-build nixos/release.nix -A options --show-trace
-
- echo "=== Checking tarball creation"
- nix-build pkgs/top-level/release.nix -A tarball --show-trace
- fi
-
- if [[ $TRAVIS_PULL_REQUEST == false ]]; then
- echo "=== Not a pull request"
- else
- echo "=== Checking PR"
-
- if ! nix-shell -p nox --run "nox-review pr ${TRAVIS_PULL_REQUEST}"; then
- if sudo dmesg | egrep 'Out of memory|Killed process' > /tmp/oom-log; then
- echo "=== The build failed due to running out of memory:"
- cat /tmp/oom-log
- echo "=== Please disregard the result of this Travis build."
+ curl -sS https://nixos.org/nix/install | sh
+
+ # Make sure we can use hydra's binary cache
+ sudo mkdir /etc/nix
+ echo "build-max-jobs = 4" | sudo tee /etc/nix/nix.conf > /dev/null
+
+ # Make sure we can execute within /tmp in Linux
+ if [ "$TRAVIS_OS_NAME" == "linux" ]; then
+ sudo mount -o remount,exec /run
+ sudo mount -o remount,exec /run/user
+ sudo mount > /dev/null
fi
- exit 1
- fi
- fi
-else
- echo "$0: Unknown option $1" >&2
- false
-fi
+ ;;
+
+ verify)
+ echo "=== Verifying that nixpkgs evaluates..."
+
+ nix-env --file $TRAVIS_BUILD_DIR --query --available --json > /dev/null
+ ;;
+
+ check)
+ echo "=== Checking NixOS options"
+
+ nix-build $TRAVIS_BUILD_DIR/nixos/release.nix --attr options --show-trace
+ ;;
+
+ tarball)
+ echo "=== Checking tarball creation"
+
+ nix-build $TRAVIS_BUILD_DIR/pkgs/top-level/release.nix --attr tarball --show-trace
+ ;;
+
+ pr)
+ if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
+ echo "=== No pull request found"
+ else
+ echo "=== Building pull request #$TRAVIS_PULL_REQUEST"
+
+ nix-shell --packages nox git --run "nox-review pr $TRAVIS_PULL_REQUEST" -I nixpkgs=$TRAVIS_BUILD_DIR
+ fi
+ ;;
+
+ *)
+ echo "Skipping unknown option $1"
+ ;;
+ esac
+
+ echo -en "travis_fold:end:$1\r"
+ shift
+done