Skip to content

Commit 5dd11fc

Browse files
committed
Merge branch 'dd/ci-musl-libc' into pu
A new CI job to build and run test suite on linux with musl libc has been added. * 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
2 parents 4daddcd + e0f8690 commit 5dd11fc

File tree

7 files changed

+111
-46
lines changed

7 files changed

+111
-46
lines changed

.travis.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ matrix:
3232
services:
3333
- docker
3434
before_install:
35-
script: ci/run-linux32-docker.sh
35+
script: ci/run-docker.sh
36+
- env: jobname=linux-musl
37+
os: linux
38+
compiler:
39+
addons:
40+
services:
41+
- docker
42+
before_install:
43+
script: ci/run-docker.sh
3644
- env: jobname=StaticAnalysis
3745
os: linux
3846
compiler:

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,14 +489,14 @@ jobs:
489489
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
490490
491491
res=0
492-
sudo AGENT_OS="$AGENT_OS" BUILD_BUILDNUMBER="$BUILD_BUILDNUMBER" BUILD_REPOSITORY_URI="$BUILD_REPOSITORY_URI" BUILD_SOURCEBRANCH="$BUILD_SOURCEBRANCH" BUILD_SOURCEVERSION="$BUILD_SOURCEVERSION" SYSTEM_PHASENAME="$SYSTEM_PHASENAME" SYSTEM_TASKDEFINITIONSURI="$SYSTEM_TASKDEFINITIONSURI" SYSTEM_TEAMPROJECT="$SYSTEM_TEAMPROJECT" CC=$CC MAKEFLAGS="$MAKEFLAGS" bash -lxc ci/run-linux32-docker.sh || res=1
492+
sudo AGENT_OS="$AGENT_OS" BUILD_BUILDNUMBER="$BUILD_BUILDNUMBER" BUILD_REPOSITORY_URI="$BUILD_REPOSITORY_URI" BUILD_SOURCEBRANCH="$BUILD_SOURCEBRANCH" BUILD_SOURCEVERSION="$BUILD_SOURCEVERSION" SYSTEM_PHASENAME="$SYSTEM_PHASENAME" SYSTEM_TASKDEFINITIONSURI="$SYSTEM_TASKDEFINITIONSURI" SYSTEM_TEAMPROJECT="$SYSTEM_TEAMPROJECT" CC=$CC MAKEFLAGS="$MAKEFLAGS" jobname=Linux32 bash -lxc ci/run-docker.sh || res=1
493493
494494
sudo chmod a+r t/out/TEST-*.xml
495495
test ! -d t/failed-test-artifacts || sudo chmod a+r t/failed-test-artifacts
496496
497497
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || res=1
498498
exit $res
499-
displayName: 'ci/run-linux32-docker.sh'
499+
displayName: 'jobname=Linux32 ci/run-docker.sh'
500500
env:
501501
GITFILESHAREPWD: $(gitfileshare.pwd)
502502
- task: PublishTestResults@2

ci/install-docker-dependencies.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
#
3+
# Install dependencies required to build and test Git inside container
4+
#
5+
6+
case "$jobname" in
7+
Linux32)
8+
linux32 --32bit i386 sh -c '
9+
apt update >/dev/null &&
10+
apt install -y build-essential libcurl4-openssl-dev \
11+
libssl-dev libexpat-dev gettext python >/dev/null
12+
'
13+
;;
14+
linux-musl)
15+
apk add --update build-base curl-dev openssl-dev expat-dev gettext \
16+
pcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null
17+
;;
18+
esac

ci/lib.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,14 @@ osx-clang|osx-gcc)
198198
GIT_TEST_GETTEXT_POISON)
199199
export GIT_TEST_GETTEXT_POISON=true
200200
;;
201+
Linux32)
202+
CC=gcc
203+
;;
204+
linux-musl)
205+
CC=gcc
206+
MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python3 USE_LIBPCRE2=Yes"
207+
MAKEFLAGS="$MAKEFLAGS NO_REGEX=Yes ICONV_OMITS_BOM=Yes"
208+
;;
201209
esac
202210

203211
MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}"

ci/run-linux32-build.sh renamed to ci/run-docker-build.sh

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
11
#!/bin/sh
22
#
3-
# Build and test Git in a 32-bit environment
3+
# Build and test Git inside container
44
#
55
# Usage:
6-
# run-linux32-build.sh <host-user-id>
6+
# run-docker-build.sh <host-user-id>
77
#
88

99
set -ex
1010

1111
if test $# -ne 1 || test -z "$1"
1212
then
13-
echo >&2 "usage: run-linux32-build.sh <host-user-id>"
13+
echo >&2 "usage: run-docker-build.sh <host-user-id>"
1414
exit 1
1515
fi
1616

17-
# Update packages to the latest available versions
18-
linux32 --32bit i386 sh -c '
19-
apt update >/dev/null &&
20-
apt install -y build-essential libcurl4-openssl-dev libssl-dev \
21-
libexpat-dev gettext python >/dev/null
22-
'
17+
case "$jobname" in
18+
Linux32)
19+
switch_cmd="linux32 --32bit i386"
20+
;;
21+
linux-musl)
22+
switch_cmd=
23+
useradd () { adduser -D "$@"; }
24+
;;
25+
*)
26+
exit 1
27+
;;
28+
esac
29+
30+
"${0%/*}/install-docker-dependencies.sh"
2331

2432
# If this script runs inside a docker container, then all commands are
2533
# usually executed as root. Consequently, the host user might not be
@@ -51,10 +59,17 @@ else
5159
fi
5260

5361
# Build and test
54-
linux32 --32bit i386 su -m -l $CI_USER -c '
62+
command $switch_cmd su -m -l $CI_USER -c "
5563
set -ex
64+
export DEVELOPER='$DEVELOPER'
65+
export DEFAULT_TEST_TARGET='$DEFAULT_TEST_TARGET'
66+
export GIT_PROVE_OPTS='$GIT_PROVE_OPTS'
67+
export GIT_TEST_OPTS='$GIT_TEST_OPTS'
68+
export GIT_TEST_CLONE_2GB='$GIT_TEST_CLONE_2GB'
69+
export MAKEFLAGS='$MAKEFLAGS'
70+
export cache_dir='$cache_dir'
5671
cd /usr/src/git
57-
test -n "$cache_dir" && ln -s "$cache_dir/.prove" t/.prove
72+
test -n '$cache_dir' && ln -s '$cache_dir/.prove' t/.prove
5873
make
5974
make test
60-
'
75+
"

ci/run-docker.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
#
3+
# Download and run Docker image to build and test Git
4+
#
5+
6+
. ${0%/*}/lib.sh
7+
8+
case "$jobname" in
9+
Linux32)
10+
CI_CONTAINER="daald/ubuntu32:xenial"
11+
;;
12+
linux-musl)
13+
CI_CONTAINER=alpine
14+
;;
15+
*)
16+
exit 1
17+
;;
18+
esac
19+
20+
docker pull "$CI_CONTAINER"
21+
22+
# Use the following command to debug the docker build locally:
23+
# <host-user-id> must be 0 if podman is used as drop-in replacement for docker
24+
# $ docker run -itv "${PWD}:/usr/src/git" --entrypoint /bin/sh "$CI_CONTAINER"
25+
# root@container:/# export jobname=<jobname>
26+
# root@container:/# /usr/src/git/ci/run-docker-build.sh <host-user-id>
27+
28+
container_cache_dir=/tmp/travis-cache
29+
30+
docker run \
31+
--interactive \
32+
--env DEVELOPER \
33+
--env DEFAULT_TEST_TARGET \
34+
--env GIT_PROVE_OPTS \
35+
--env GIT_TEST_OPTS \
36+
--env GIT_TEST_CLONE_2GB \
37+
--env MAKEFLAGS \
38+
--env jobname \
39+
--env cache_dir="$container_cache_dir" \
40+
--volume "${PWD}:/usr/src/git" \
41+
--volume "$cache_dir:$container_cache_dir" \
42+
"$CI_CONTAINER" \
43+
/usr/src/git/ci/run-docker-build.sh $(id -u $USER)
44+
45+
check_unignored_build_artifacts
46+
47+
save_good_tree

ci/run-linux32-docker.sh

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)