1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
#!/bin/bash -ex
#
# setup up and run a docker build.
# this is used by travis.
#
# run the build and regression in a newly created container.
# pass the compiler from the travis matrix through CC, CXX.
# we need the default charmap to be UTF-8 for test_encoding_utf8, explicit set it here through LC_ALL.
# travis has got the code to test in the pwd.
ver=${1}
versuffix=${ver:+_$1}
script=${2:-./build_and_test}
docker run \
--rm \
--mount type=bind,source="$(pwd)",target=/app \
--env CC=$CC \
--env CXX=$CXX \
--env LC_ALL=C.UTF-8 \
--mount type=bind,source=/etc/passwd,target=/etc/passwd,readonly \
--mount type=bind,source=/etc/group,target=/etc/group,readonly \
--user "$(id -u):$(id -g)" \
--cap-add SYS_PTRACE \
tsteven4/gpsbabel_build_environment${versuffix} \
bash -c "if [ -n ${ver} ]; then if [ -e /opt/${ver}.env ]; then . /opt/${ver}.env; fi; fi; ${script}"
|