git-lfs/script/cibuild
brian m. carlson c328208062
Switch CI to use GitHub Actions
Currently, we have three different CI systems that handle our CI: Travis
for Linux, CircleCI for macOS, and AppVeyor for Windows.  This results
in widely varying performance across systems and the need to maintain
code that works differently across different CI systems.

In addition, we'd like to use GitHub Actions to automate the release
process, so it makes sense to use it for CI as well.  Switch over by
adding a CI workflow that runs our existing jobs.  Ensure that we filter
out the environment variables that GitHub Actions provides, since they
will cause tests that run "git lfs env" to fail.

Add a script for those jobs where we build a custom Git and install the
appropriate dependencies.  In the cibuild script, hoist the Windows
handling to the top, set a specific environment variable for us to
remember that we're on Windows, and then disable locking, which fails on
Windows and causes the testsuite to abort.  These same environment
variables were set for AppVeyor and are also needed on Windows
development systems.
2019-09-09 14:30:55 +00:00

39 lines
1.0 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)?_' | 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
GOIMPORTS="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..."
! git grep -lE '[[:space:]]+$' | \
grep -vE '(^vendor/|\.git/(objects/|index)|\.bat$)'