Skip to content

Commit a7ab4d9

Browse files
committed
Merge branch 'dd/ci-musl-libc' into pu
* 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 ef6bd16 + e0f8690 commit a7ab4d9

File tree

6 files changed

+106
-45
lines changed

6 files changed

+106
-45
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:

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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ GIT_TEST_GETTEXT_POISON)
220220
Linux32)
221221
CC=gcc
222222
;;
223+
linux-musl)
224+
CC=gcc
225+
MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python3 USE_LIBPCRE2=Yes"
226+
MAKEFLAGS="$MAKEFLAGS NO_REGEX=Yes ICONV_OMITS_BOM=Yes"
227+
;;
223228
esac
224229

225230
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 & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)