diff options
Diffstat (limited to 'third_party/git/ci')
-rwxr-xr-x | third_party/git/ci/config/allow-ref.sample | 27 | ||||
-rwxr-xr-x | third_party/git/ci/install-dependencies.sh | 28 | ||||
-rwxr-xr-x | third_party/git/ci/install-docker-dependencies.sh | 18 | ||||
-rwxr-xr-x | third_party/git/ci/lib.sh | 53 | ||||
-rwxr-xr-x | third_party/git/ci/print-test-failures.sh | 7 | ||||
-rwxr-xr-x | third_party/git/ci/run-build-and-tests.sh | 8 | ||||
-rwxr-xr-x | third_party/git/ci/run-docker-build.sh (renamed from third_party/git/ci/run-linux32-build.sh) | 39 | ||||
-rwxr-xr-x | third_party/git/ci/run-docker.sh | 47 | ||||
-rwxr-xr-x | third_party/git/ci/run-linux32-docker.sh | 31 | ||||
-rwxr-xr-x | third_party/git/ci/run-static-analysis.sh | 3 | ||||
-rwxr-xr-x | third_party/git/ci/test-documentation.sh | 3 |
11 files changed, 211 insertions, 53 deletions
diff --git a/third_party/git/ci/config/allow-ref.sample b/third_party/git/ci/config/allow-ref.sample new file mode 100755 index 000000000000..af0e076f8a32 --- /dev/null +++ b/third_party/git/ci/config/allow-ref.sample @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Sample script for enabling/disabling GitHub Actions CI runs on +# particular refs. By default, CI is run for all branches pushed to +# GitHub. You can override this by dropping the ".sample" from the script, +# editing it, committing, and pushing the result to the "ci-config" branch of +# your repository: +# +# git checkout -b ci-config +# cp allow-ref.sample allow-ref +# $EDITOR allow-ref +# git add allow-ref +# git commit -am "implement my ci preferences" +# git push +# +# This script will then be run when any refs are pushed to that repository. It +# gets the fully qualified refname as the first argument, and should exit with +# success only for refs for which you want to run CI. + +case "$1" in +# allow one-off tests by pushing to "for-ci" or "for-ci/mybranch" +refs/heads/for-ci*) true ;; +# always build your integration branch +refs/heads/my-integration-branch) true ;; +# don't build any other branches or tags +*) false ;; +esac diff --git a/third_party/git/ci/install-dependencies.sh b/third_party/git/ci/install-dependencies.sh index 8cc72503cb76..0229a77f7d28 100755 --- a/third_party/git/ci/install-dependencies.sh +++ b/third_party/git/ci/install-dependencies.sh @@ -7,12 +7,16 @@ P4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION +UBUNTU_COMMON_PKGS="make libssl-dev libcurl4-openssl-dev libexpat-dev + tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl + libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl" case "$jobname" in linux-clang|linux-gcc) sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" sudo apt-get -q update - sudo apt-get -q -y install language-pack-is libsvn-perl apache2 + sudo apt-get -q -y install language-pack-is libsvn-perl apache2 \ + $UBUNTU_COMMON_PKGS case "$jobname" in linux-gcc) sudo apt-get -q -y install gcc-8 @@ -40,23 +44,37 @@ osx-clang|osx-gcc) test -z "$BREW_INSTALL_PACKAGES" || brew install $BREW_INSTALL_PACKAGES brew link --force gettext + brew cask install --no-quarantine perforce || { + # Update the definitions and try again + cask_repo="$(brew --repository)"/Library/Taps/homebrew/homebrew-cask && + git -C "$cask_repo" pull --no-stat && + brew cask install --no-quarantine perforce + } || brew install caskroom/cask/perforce case "$jobname" in osx-gcc) - brew link gcc@8 + brew install gcc@9 + # Just in case the image is updated to contain gcc@9 + # pre-installed but not linked. + brew link gcc@9 ;; esac ;; StaticAnalysis) sudo apt-get -q update - sudo apt-get -q -y install coccinelle + sudo apt-get -q -y install coccinelle libcurl4-openssl-dev libssl-dev \ + libexpat-dev gettext make ;; Documentation) sudo apt-get -q update - sudo apt-get -q -y install asciidoc xmlto + sudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make test -n "$ALREADY_HAVE_ASCIIDOCTOR" || - gem install --version 1.5.8 asciidoctor + sudo gem install --version 1.5.8 asciidoctor + ;; +linux-gcc-4.8|GETTEXT_POISON) + sudo apt-get -q update + sudo apt-get -q -y install $UBUNTU_COMMON_PKGS ;; esac diff --git a/third_party/git/ci/install-docker-dependencies.sh b/third_party/git/ci/install-docker-dependencies.sh new file mode 100755 index 000000000000..26a6689766d7 --- /dev/null +++ b/third_party/git/ci/install-docker-dependencies.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# +# Install dependencies required to build and test Git inside container +# + +case "$jobname" in +Linux32) + linux32 --32bit i386 sh -c ' + apt update >/dev/null && + apt install -y build-essential libcurl4-openssl-dev \ + libssl-dev libexpat-dev gettext python >/dev/null + ' + ;; +linux-musl) + apk add --update build-base curl-dev openssl-dev expat-dev gettext \ + pcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null + ;; +esac diff --git a/third_party/git/ci/lib.sh b/third_party/git/ci/lib.sh index 44db2d5cbb22..38c0eac351e7 100755 --- a/third_party/git/ci/lib.sh +++ b/third_party/git/ci/lib.sh @@ -34,6 +34,11 @@ save_good_tree () { # successfully before (e.g. because the branch got rebased, changing only # the commit messages). skip_good_tree () { + if test "$TRAVIS_DEBUG_MODE" = true || test true = "$GITHUB_ACTIONS" + then + return + fi + if ! good_tree_info="$(grep "^$(git rev-parse $CI_COMMIT^{tree}) " "$good_trees_file")" then # Haven't seen this tree yet, or no cached good trees file yet. @@ -74,6 +79,9 @@ check_unignored_build_artifacts () } } +# GitHub Action doesn't set TERM, which is required by tput +export TERM=${TERM:-dumb} + # Clear MAKEFLAGS that may come from the outside world. export MAKEFLAGS= @@ -126,14 +134,33 @@ then echo "$SYSTEM_TASKDEFINITIONSURI$SYSTEM_TEAMPROJECT/_build/results?buildId=$1" } - BREW_INSTALL_PACKAGES=gcc@8 export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save" export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml" MAKEFLAGS="$MAKEFLAGS --jobs=10" test windows_nt != "$CI_OS_NAME" || GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS" +elif test true = "$GITHUB_ACTIONS" +then + CI_TYPE=github-actions + CI_BRANCH="$GITHUB_REF" + CI_COMMIT="$GITHUB_SHA" + CI_OS_NAME="$(echo "$RUNNER_OS" | tr A-Z a-z)" + test macos != "$CI_OS_NAME" || CI_OS_NAME=osx + CI_REPO_SLUG="$GITHUB_REPOSITORY" + CI_JOB_ID="$GITHUB_RUN_ID" + CC="${CC:-gcc}" + DONT_SKIP_TAGS=t + + cache_dir="$HOME/none" + + export GIT_PROVE_OPTS="--timer --jobs 10" + export GIT_TEST_OPTS="--verbose-log -x" + MAKEFLAGS="$MAKEFLAGS --jobs=10" + test windows != "$CI_OS_NAME" || + GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS" else echo "Could not identify CI type" >&2 + env >&2 exit 1 fi @@ -141,6 +168,7 @@ good_trees_file="$cache_dir/good-trees" mkdir -p "$cache_dir" +test -n "${DONT_SKIP_TAGS-}" || skip_branch_tip_with_tag skip_good_tree @@ -151,16 +179,20 @@ fi export DEVELOPER=1 export DEFAULT_TEST_TARGET=prove -export GIT_TEST_CLONE_2GB=YesPlease +export GIT_TEST_CLONE_2GB=true +export SKIP_DASHED_BUILT_INS=YesPlease case "$jobname" in linux-clang|linux-gcc) if [ "$jobname" = linux-gcc ] then export CC=gcc-8 + MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python3" + else + MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python2" fi - export GIT_TEST_HTTPD=YesPlease + export GIT_TEST_HTTPD=true # The Linux build installs the defined dependency versions below. # The OS X build installs much more recent versions, whichever @@ -177,7 +209,10 @@ linux-clang|linux-gcc) osx-clang|osx-gcc) if [ "$jobname" = osx-gcc ] then - export CC=gcc-8 + export CC=gcc-9 + MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python3)" + else + MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python2)" fi # t9810 occasionally fails on Travis CI OS X @@ -185,9 +220,17 @@ osx-clang|osx-gcc) # Travis CI OS X export GIT_SKIP_TESTS="t9810 t9816" ;; -GIT_TEST_GETTEXT_POISON) +GETTEXT_POISON) export GIT_TEST_GETTEXT_POISON=true ;; +Linux32) + CC=gcc + ;; +linux-musl) + CC=gcc + MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python3 USE_LIBPCRE2=Yes" + MAKEFLAGS="$MAKEFLAGS NO_REGEX=Yes ICONV_OMITS_BOM=Yes" + ;; esac MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" diff --git a/third_party/git/ci/print-test-failures.sh b/third_party/git/ci/print-test-failures.sh index e688a26f0d61..92a983a265c2 100755 --- a/third_party/git/ci/print-test-failures.sh +++ b/third_party/git/ci/print-test-failures.sh @@ -46,6 +46,13 @@ do mv "$trash_dir" failed-test-artifacts continue ;; + github-actions) + mkdir -p failed-test-artifacts + echo "::set-env name=FAILED_TEST_ARTIFACTS::t/failed-test-artifacts" + cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/ + tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir" + continue + ;; *) echo "Unhandled CI type: $CI_TYPE" >&2 exit 1 diff --git a/third_party/git/ci/run-build-and-tests.sh b/third_party/git/ci/run-build-and-tests.sh index ff0ef7f08e75..6c27b886b8f0 100755 --- a/third_party/git/ci/run-build-and-tests.sh +++ b/third_party/git/ci/run-build-and-tests.sh @@ -19,7 +19,15 @@ linux-gcc) export GIT_TEST_OE_SIZE=10 export GIT_TEST_OE_DELTA_SIZE=5 export GIT_TEST_COMMIT_GRAPH=1 + export GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1 export GIT_TEST_MULTI_PACK_INDEX=1 + export GIT_TEST_ADD_I_USE_BUILTIN=1 + make test + ;; +linux-clang) + export GIT_TEST_DEFAULT_HASH=sha1 + make test + export GIT_TEST_DEFAULT_HASH=sha256 make test ;; linux-gcc-4.8) diff --git a/third_party/git/ci/run-linux32-build.sh b/third_party/git/ci/run-docker-build.sh index e3a193adbce3..8d47a5fda3b1 100755 --- a/third_party/git/ci/run-linux32-build.sh +++ b/third_party/git/ci/run-docker-build.sh @@ -1,25 +1,33 @@ #!/bin/sh # -# Build and test Git in a 32-bit environment +# Build and test Git inside container # # Usage: -# run-linux32-build.sh <host-user-id> +# run-docker-build.sh <host-user-id> # set -ex if test $# -ne 1 || test -z "$1" then - echo >&2 "usage: run-linux32-build.sh <host-user-id>" + echo >&2 "usage: run-docker-build.sh <host-user-id>" exit 1 fi -# Update packages to the latest available versions -linux32 --32bit i386 sh -c ' - apt update >/dev/null && - apt install -y build-essential libcurl4-openssl-dev libssl-dev \ - libexpat-dev gettext python >/dev/null -' +case "$jobname" in +Linux32) + switch_cmd="linux32 --32bit i386" + ;; +linux-musl) + switch_cmd= + useradd () { adduser -D "$@"; } + ;; +*) + exit 1 + ;; +esac + +"${0%/*}/install-docker-dependencies.sh" # If this script runs inside a docker container, then all commands are # usually executed as root. Consequently, the host user might not be @@ -51,10 +59,17 @@ else fi # Build and test -linux32 --32bit i386 su -m -l $CI_USER -c ' +command $switch_cmd su -m -l $CI_USER -c " set -ex + export DEVELOPER='$DEVELOPER' + export DEFAULT_TEST_TARGET='$DEFAULT_TEST_TARGET' + export GIT_PROVE_OPTS='$GIT_PROVE_OPTS' + export GIT_TEST_OPTS='$GIT_TEST_OPTS' + export GIT_TEST_CLONE_2GB='$GIT_TEST_CLONE_2GB' + export MAKEFLAGS='$MAKEFLAGS' + export cache_dir='$cache_dir' cd /usr/src/git - test -n "$cache_dir" && ln -s "$cache_dir/.prove" t/.prove + test -n '$cache_dir' && ln -s '$cache_dir/.prove' t/.prove make make test -' +" diff --git a/third_party/git/ci/run-docker.sh b/third_party/git/ci/run-docker.sh new file mode 100755 index 000000000000..37fa372052dd --- /dev/null +++ b/third_party/git/ci/run-docker.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# +# Download and run Docker image to build and test Git +# + +. ${0%/*}/lib.sh + +case "$jobname" in +Linux32) + CI_CONTAINER="daald/ubuntu32:xenial" + ;; +linux-musl) + CI_CONTAINER=alpine + ;; +*) + exit 1 + ;; +esac + +docker pull "$CI_CONTAINER" + +# Use the following command to debug the docker build locally: +# <host-user-id> must be 0 if podman is used as drop-in replacement for docker +# $ docker run -itv "${PWD}:/usr/src/git" --entrypoint /bin/sh "$CI_CONTAINER" +# root@container:/# export jobname=<jobname> +# root@container:/# /usr/src/git/ci/run-docker-build.sh <host-user-id> + +container_cache_dir=/tmp/travis-cache + +docker run \ + --interactive \ + --env DEVELOPER \ + --env DEFAULT_TEST_TARGET \ + --env GIT_PROVE_OPTS \ + --env GIT_TEST_OPTS \ + --env GIT_TEST_CLONE_2GB \ + --env MAKEFLAGS \ + --env jobname \ + --env cache_dir="$container_cache_dir" \ + --volume "${PWD}:/usr/src/git" \ + --volume "$cache_dir:$container_cache_dir" \ + "$CI_CONTAINER" \ + /usr/src/git/ci/run-docker-build.sh $(id -u $USER) + +check_unignored_build_artifacts + +save_good_tree diff --git a/third_party/git/ci/run-linux32-docker.sh b/third_party/git/ci/run-linux32-docker.sh deleted file mode 100755 index 751acfcf8a8c..000000000000 --- a/third_party/git/ci/run-linux32-docker.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# -# Download and run Docker image to build and test 32-bit Git -# - -. ${0%/*}/lib.sh - -docker pull daald/ubuntu32:xenial - -# Use the following command to debug the docker build locally: -# $ docker run -itv "${PWD}:/usr/src/git" --entrypoint /bin/bash daald/ubuntu32:xenial -# root@container:/# /usr/src/git/ci/run-linux32-build.sh <host-user-id> - -container_cache_dir=/tmp/travis-cache - -docker run \ - --interactive \ - --env DEVELOPER \ - --env DEFAULT_TEST_TARGET \ - --env GIT_PROVE_OPTS \ - --env GIT_TEST_OPTS \ - --env GIT_TEST_CLONE_2GB \ - --env cache_dir="$container_cache_dir" \ - --volume "${PWD}:/usr/src/git" \ - --volume "$cache_dir:$container_cache_dir" \ - daald/ubuntu32:xenial \ - /usr/src/git/ci/run-linux32-build.sh $(id -u $USER) - -check_unignored_build_artifacts - -save_good_tree diff --git a/third_party/git/ci/run-static-analysis.sh b/third_party/git/ci/run-static-analysis.sh index a19aa7ebbc09..65bcebda41a0 100755 --- a/third_party/git/ci/run-static-analysis.sh +++ b/third_party/git/ci/run-static-analysis.sh @@ -26,4 +26,7 @@ then exit 1 fi +make hdr-check || +exit 1 + save_good_tree diff --git a/third_party/git/ci/test-documentation.sh b/third_party/git/ci/test-documentation.sh index d49089832de0..de41888430a2 100755 --- a/third_party/git/ci/test-documentation.sh +++ b/third_party/git/ci/test-documentation.sh @@ -7,7 +7,10 @@ filter_log () { sed -e '/^GIT_VERSION = /d' \ + -e "/constant Gem::ConfigMap is deprecated/d" \ -e '/^ \* new asciidoc flags$/d' \ + -e '/stripped namespace before processing/d' \ + -e '/Attributed.*IDs for element/d' \ "$1" } |