Debian Codegraph @

script/cibuild

raw symbols SCIP
1 #!/usr/bin/env bash
2 set -e
3
4 # Strip out CI environment variables which cause tests to fail.
5 unset $(env | grep -E '^GIT(HUB)?_' | grep -v '^GIT_DEFAULT_HASH=' | sed -e 's/=.*$//')
6
7 UNAME=$(uname -s)
8 X=""
9 if [[ $UNAME == MINGW* || $UNAME == MSYS* || $UNAME == CYGWIN* ]]; then
10 X=".exe"
11 WINDOWS=1
12 fi
13
14 # Build git-lfs-transfer from scutiger.
15 cargo install --root t/scutiger scutiger-lfs
16
17 # Set GOPATH if it isn't already set.
18 eval "$(go env | grep GOPATH)"
19 go install golang.org/x/tools/cmd/goimports@latest
20
21 GOIMPORTS="$GOPATH/bin/goimports"
22
23 make GOIMPORTS="$GOIMPORTS" && make GOIMPORTS="$GOIMPORTS" test
24
25 # re-run test to ensure GIT_TRACE output doesn't leak into the git package
26 GIT_TRACE=1 make GOIMPORTS="$GOIMPORTS" PKGS=git test
27
28 pushd t >/dev/null
29 PROVE="prove"
30 PROVE_EXTRA_ARGS="-j9"
31 VERBOSE_LOGS=1 make X="$X" clean
32 VERBOSE_LOGS=1 make X="$X" PROVE="$PROVE" PROVE_EXTRA_ARGS="$PROVE_EXTRA_ARGS"
33 popd >/dev/null
34
35 echo "Looking for trailing whitespace..."
36 if git grep -lE '[[:space:]]+$' | \
37 grep -vE '(^vendor/|\.git/(objects/|index)|\.(bat|ico|bmp)$)'
38 then
39 exit 1
40 fi
41
42 echo "Formatting files..."
43 make GOIMPORTS="$GOIMPORTS" fmt
44
45 echo "Looking for files that are not formatted correctly..."
46 git status -s
47 [ -z "$(git status --porcelain)" ]