3d0efde544
While we don't currently have access to a version of Git that supports SHA-256, one will soon be available, and we'll need to support those versions. To make sure our test suite works properly, we'll need to run a test with SHA-256, so let's allow passing the GIT_DEFAULT_HASH environment variable into our CI job script.
56 lines
1.5 KiB
Bash
Executable File
56 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
# Strip out CI environment variables which cause tests to fail.
|
|
unset $(env | grep -E '^GIT(HUB)?_' | grep -v '^GIT_DEFAULT_HASH=' | sed -e 's/=.*$//')
|
|
|
|
UNAME=$(uname -s)
|
|
X=""
|
|
if [[ $UNAME == MINGW* || $UNAME == MSYS* || $UNAME == CYGWIN* ]]; then
|
|
X=".exe"
|
|
WINDOWS=1
|
|
export GIT_LFS_NO_TEST_COUNT=1
|
|
export GIT_LFS_LOCK_ACQUIRE_DISABLED=1
|
|
fi
|
|
|
|
# Set GOPATH if it isn't already set.
|
|
eval "$(go env | grep GOPATH)"
|
|
go get golang.org/x/tools/cmd/goimports
|
|
|
|
GOIMPORTS="$GOPATH/bin/goimports"
|
|
|
|
make GOIMPORTS="$GOIMPORTS" && make GOIMPORTS="$GOIMPORTS" test
|
|
|
|
# re-run test to ensure GIT_TRACE output doesn't leak into the git package
|
|
GIT_TRACE=1 make GOIMPORTS="$GOIMPORTS" PKGS=git test
|
|
|
|
pushd t >/dev/null
|
|
PROVE="prove"
|
|
PROVE_EXTRA_ARGS="-j9"
|
|
if [ "$WINDOWS" ]; then
|
|
export PATH="/c/Strawberry/perl/bin:.:$PATH"
|
|
PROVE="prove.bat"
|
|
PROVE_EXTRA_ARGS="$PROVE_EXTRA_ARGS --exec bash"
|
|
fi
|
|
|
|
VERBOSE_LOGS=1 make X="$X" clean
|
|
VERBOSE_LOGS=1 make X="$X" PROVE="$PROVE" PROVE_EXTRA_ARGS="$PROVE_EXTRA_ARGS"
|
|
popd >/dev/null
|
|
|
|
echo "Looking for trailing whitespace..."
|
|
if git grep -lE '[[:space:]]+$' | \
|
|
grep -vE '(^vendor/|\.git/(objects/|index)|\.bat$)'
|
|
then
|
|
exit 1
|
|
fi
|
|
|
|
echo "Formatting files..."
|
|
# Building and installing goimports and goversioninfo will have modified go.mod
|
|
# and go.sum, so reset the branch before formatting.
|
|
git reset --hard
|
|
make GOIMPORTS="$GOIMPORTS" fmt
|
|
|
|
echo "Looking for files that are not formatted correctly..."
|
|
git status -s
|
|
[ -z "$(git status --porcelain)" ]
|