| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | set -e |
| 3 | |
| 4 | # Strip out CI environment variables which cause tests to fail. |
| 5 | unset $(envscip-shell system . . env. | grepscip-shell system . . grep. -E '^GIT(HUB)?_' | grepscip-shell system . . grep. -v '^GIT_DEFAULT_HASH=' | sedscip-shell system . . sed. -e 's/=.*$//') |
| 6 | |
| 7 | UNAME=$(unamescip-shell system . . 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 | cargoscip-shell system . . cargo. install --root t/scutiger scutiger-lfs |
| 16 | |
| 17 | # Set GOPATH if it isn't already set. |
| 18 | eval "$(goscip-shell system . . go. env | grepscip-shell system . . grep. GOPATH)" |
| 19 | goscip-shell system . . go. install golang.org/x/tools/cmd/goimports@latest |
| 20 | |
| 21 | GOIMPORTS="$GOPATH/bin/goimports" |
| 22 | |
| 23 | makescip-shell system . . make. GOIMPORTS="$GOIMPORTS" && makescip-shell system . . 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 makescip-shell system . . make. GOIMPORTS="$GOIMPORTS" PKGS=git test |
| 27 | |
| 28 | pushd t >/dev/nullscip-shell filesystem . . `/dev/null`. |
| 29 | PROVE="prove" |
| 30 | PROVE_EXTRA_ARGS="-j9" |
| 31 | VERBOSE_LOGS=1 makescip-shell system . . make. X="$X" clean |
| 32 | VERBOSE_LOGS=1 makescip-shell system . . make. X="$X" PROVE="$PROVE" PROVE_EXTRA_ARGS="$PROVE_EXTRA_ARGS" |
| 33 | popd >/dev/nullscip-shell filesystem . . `/dev/null`. |
| 34 | |
| 35 | echoscip-shell system . . echo. "Looking for trailing whitespace..." |
| 36 | if gitscip-shell system . . git. grep -lE '[[:space:]]+$' | \ |
| 37 | grep -vE '(^vendor/|\.git/(objects/|index)|\.(bat|ico|bmp)$)' |
| 38 | then |
| 39 | exit 1 |
| 40 | fi |
| 41 | |
| 42 | echoscip-shell system . . echo. "Formatting files..." |
| 43 | makescip-shell system . . make. GOIMPORTS="$GOIMPORTS" fmt |
| 44 | |
| 45 | echoscip-shell system . . echo. "Looking for files that are not formatted correctly..." |
| 46 | gitscip-shell system . . git. status -s |
| 47 | [scip-shell system . . `[`. -z "$(gitscip-shell system . . git. status --porcelain)" ] |