summaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-04-08 05:16:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-04-08 05:16:30 (GMT)
commit54711243407791b188bf338e105cdc6d81ee4402 (patch)
tree25afcee788a5f7ce0151c98a18d91a5ac0aab142 /ci
parentd1068592ab343a2fd6cb46e6d7304d65d7cf3b90 (diff)
parente0f8690dee7ec9373657eb2ecef9c8d88d0ece08 (diff)
downloadgit-54711243407791b188bf338e105cdc6d81ee4402.zip
git-54711243407791b188bf338e105cdc6d81ee4402.tar.gz
git-54711243407791b188bf338e105cdc6d81ee4402.tar.bz2
Merge branch 'dd/ci-musl-libc' into HEAD
* dd/ci-musl-libc: travis: build and test on Linux with musl libc and busybox ci/linux32: libify install-dependencies step ci: refactor docker runner script ci/linux32: parameterise command to switch arch ci/lib-docker: preserve required environment variables ci: make MAKEFLAGS available inside the Docker container in the Linux32 job
Diffstat (limited to 'ci')
-rwxr-xr-xci/install-docker-dependencies.sh18
-rwxr-xr-xci/lib.sh8
-rwxr-xr-xci/run-docker-build.sh (renamed from ci/run-linux32-build.sh)39
-rwxr-xr-xci/run-docker.sh47
-rwxr-xr-xci/run-linux32-docker.sh31
5 files changed, 100 insertions, 43 deletions
diff --git a/ci/install-docker-dependencies.sh b/ci/install-docker-dependencies.sh
new file mode 100755
index 0000000..26a6689
--- /dev/null
+++ b/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/ci/lib.sh b/ci/lib.sh
index c3a8cd2..87cd29b 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -198,6 +198,14 @@ osx-clang|osx-gcc)
GIT_TEST_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/ci/run-linux32-build.sh b/ci/run-docker-build.sh
index e3a193a..8d47a5f 100755
--- a/ci/run-linux32-build.sh
+++ b/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/ci/run-docker.sh b/ci/run-docker.sh
new file mode 100755
index 0000000..37fa372
--- /dev/null
+++ b/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/ci/run-linux32-docker.sh b/ci/run-linux32-docker.sh
deleted file mode 100755
index 751acfc..0000000
--- a/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