about summary refs log tree commit diff
path: root/maintainers
diff options
context:
space:
mode:
authorRok Garbas <rok@garbas.si>2016-07-15 17:47:45 +0200
committerGitHub <noreply@github.com>2016-07-15 17:47:45 +0200
commitcde541236a076519ed83fd3b7ba1231779b84f93 (patch)
tree69d5834cb0fd2df132db232bcfcc9a014d32f622 /maintainers
parent411bd972ab3e108e505e46274cac5b1995a5f331 (diff)
parent7c37ac0edd999b2eb34fc91c2f91050e390ccaa2 (diff)
Merge pull request #16563 from matthewbauer/travis-new
travis: split build into matrix of 3
Diffstat (limited to 'maintainers')
-rwxr-xr-xmaintainers/scripts/travis-nox-review-pr.sh119
1 files changed, 65 insertions, 54 deletions
diff --git a/maintainers/scripts/travis-nox-review-pr.sh b/maintainers/scripts/travis-nox-review-pr.sh
index 092fc0cd9d07c..386868301a254 100755
--- a/maintainers/scripts/travis-nox-review-pr.sh
+++ b/maintainers/scripts/travis-nox-review-pr.sh
@@ -1,58 +1,69 @@
 #! /usr/bin/env bash
 set -e
 
-export NIX_CURL_FLAGS=-sS
-
-if [[ $1 == nix ]]; then
-    echo "=== Installing Nix..."
-    # Install Nix
-    bash <(curl -sS https://nixos.org/nix/install)
-    source $HOME/.nix-profile/etc/profile.d/nix.sh
-
-    # 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'
-
-    # 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
-
-    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."
+while test -n "$1"; do
+
+    # tell Travis to use folding
+    echo -en "travis_fold:start:$1\r"
+
+    case $1 in
+
+        nixpkgs-verify)
+            echo "=== Verifying that nixpkgs evaluates..."
+
+            nix-env --file $TRAVIS_BUILD_DIR --query --available --json > /dev/null
+            ;;
+
+        nixos-options)
+            echo "=== Checking NixOS options"
+
+            nix-build $TRAVIS_BUILD_DIR/nixos/release.nix --attr options --show-trace
+            ;;
+
+        nixos-manual)
+            echo "=== Checking NixOS manuals"
+
+            nix-build $TRAVIS_BUILD_DIR/nixos/release.nix --attr manual --show-trace
+            ;;
+
+        nixpkgs-manual)
+            echo "=== Checking nixpkgs manuals"
+
+            nix-build $TRAVIS_BUILD_DIR/pkgs/top-level/release.nix --attr manpages --show-trace
+            ;;
+
+        nixpkgs-tarball)
+            echo "=== Checking nixpkgs tarball creation"
+
+            nix-build $TRAVIS_BUILD_DIR/pkgs/top-level/release.nix --attr tarball --show-trace
+            ;;
+
+        nixpkgs-lint)
+            echo "=== Checking nixpkgs lint"
+
+            nix-shell --packages nixpkgs-lint --run "nixpkgs-lint -f $TRAVIS_BUILD_DIR"
+            ;;
+
+        pr)
+            if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
+                echo "=== No pull request found"
+            else
+                echo "=== Building pull request #$TRAVIS_PULL_REQUEST"
+
+                token=""
+                if [ -n "$GITHUB_TOKEN" ]; then
+                    token="--token $GITHUB_TOKEN"
+                fi
+
+                nix-shell --packages nox git --run "nox-review pr --slug $TRAVIS_REPO_SLUG $token $TRAVIS_PULL_REQUEST" -I nixpkgs=$TRAVIS_BUILD_DIR
             fi
-            exit 1
-        fi
-    fi
-else
-    echo "$0: Unknown option $1" >&2
-    false
-fi
+            ;;
+
+        *)
+            echo "Skipping unknown option $1"
+            ;;
+    esac
+
+    echo -en "travis_fold:end:$1\r"
+    shift
+done