summary refs log tree commit diff
path: root/maintainers/scripts/travis-nox-review-pr.sh
blob: 13df5087fad5c51680459cb35647da46ef125fab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#! /usr/bin/env bash
set -e

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 manual --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"
            fi
            ;;

        *)
            echo "Skipping unknown option $1"
            ;;
    esac

    echo -en "travis_fold:end:$1\r"
    shift
done