Convert to out-of-tree builds

pull/1/head
Thomas Orozco 10 years ago
parent 84475c399b
commit 178f46aa01
  1. 2
      .travis.yml
  2. 2
      CMakeLists.txt
  3. 9
      Dockerfile
  4. 31
      ci/run_build.sh
  5. 9
      ddist.sh
  6. 5
      test/test.py

@ -11,7 +11,7 @@ deploy:
api_key: api_key:
secure: Yk90ANpSPv1iJy8QDXCPwfaSmEr/WIJ3bzhQ6X8JvZjfrwTosbh0HrUzQyeac3nyvNwj7YJRssolOFc21IBKPpCFTZqYxSkuLPU6ysG4HGHgN6YJhOMm4mG4KKJ6741q3DJendhZpalBhCEi+NcZK/PCSD97Vl4OqRjBUged0fs= secure: Yk90ANpSPv1iJy8QDXCPwfaSmEr/WIJ3bzhQ6X8JvZjfrwTosbh0HrUzQyeac3nyvNwj7YJRssolOFc21IBKPpCFTZqYxSkuLPU6ysG4HGHgN6YJhOMm4mG4KKJ6741q3DJendhZpalBhCEi+NcZK/PCSD97Vl4OqRjBUged0fs=
file: file:
- "./tini" - "./dist/tini"
on: on:
repo: krallin/tini repo: krallin/tini
tags: true tags: true

@ -5,7 +5,7 @@ project (tini)
set (tini_VERSION_MAJOR 0) set (tini_VERSION_MAJOR 0)
set (tini_VERSION_MINOR 3) set (tini_VERSION_MINOR 3)
set (tini_VERSION_PATCH 2) set (tini_VERSION_PATCH 2)
execute_process (COMMAND git log -n 1 --date=local --pretty=format:"%h" OUTPUT_VARIABLE tini_VERSION_GIT) execute_process (COMMAND git log -n 1 --date=local --pretty=format:"%h" WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" OUTPUT_VARIABLE tini_VERSION_GIT)
# Flags # Flags
add_definitions (-D_FORTIFY_SOURCE=2) add_definitions (-D_FORTIFY_SOURCE=2)

@ -1,12 +1,5 @@
FROM ubuntu FROM ubuntu
RUN apt-get update \ RUN apt-get update \
&& apt-get install --no-install-recommends --yes build-essential git gdb valgrind cmake clang \ && apt-get install --no-install-recommends --yes build-essential git gdb valgrind cmake rpm \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
ADD . /tini
WORKDIR /tini
RUN ./ci/run_build.sh
ENTRYPOINT ["/tini/tini"]

@ -1,22 +1,31 @@
#!/bin/bash #!/bin/bash
# Should be run from the root dir (!) # Should be run from the root dir, or SOURCE_DIR should be set.
set -o errexit set -o errexit
set -o nounset set -o nounset
: ${SOURCE_DIR:="."}
: ${DIST_DIR:="${SOURCE_DIR}/dist"}
: ${BUILD_DIR:="/tmp/build"}
# Build # Build
cmake . cmake -B"${BUILD_DIR}" -H"${SOURCE_DIR}"
pushd "${BUILD_DIR}"
make clean make clean
make make
# Smoke tests (actual tests need Docker to run; they don't run within the CI environment) popd
# Success # Smoke tests (actual tests need Docker to run; they don't run within the CI environment)
for tini in ./tini; do tini="${BUILD_DIR}/tini"
echo "Testing $tini with: true" echo "Testing $tini with: true"
$tini -vvvv true $tini -vvvv true
echo "Testing $tini with: false" echo "Testing $tini with: false"
if $tini -vvvv false; then if $tini -vvvv false; then
exit 1 exit 1
fi fi
done
# Place files
mkdir -p "${DIST_DIR}"
cp "${BUILD_DIR}"/tini "${DIST_DIR}"

@ -6,11 +6,10 @@ REL_HERE=$(dirname "${BASH_SOURCE}")
HERE=$(cd "${REL_HERE}"; pwd) HERE=$(cd "${REL_HERE}"; pwd)
IMG="tini" IMG="tini"
NAME="${IMG}-dist" SRC="/tini"
# Create the build image
docker build -t "${IMG}" . docker build -t "${IMG}" .
# Copy the generated README # Run the build
docker run -it --entrypoint="/bin/true" --name="${NAME}" "${IMG}" docker run --rm --volume="${HERE}:${SRC}" -e BUILD_DIR=/tmp/tini-build -e SOURCE_DIR="${SRC}" "${IMG}" "${SRC}/ci/run_build.sh"
docker cp "${NAME}:/tini/README.md" "${HERE}"
docker rm "${NAME}"

@ -61,11 +61,12 @@ if __name__ == "__main__":
root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
for entrypoint in ["/tini/tini"]: for entrypoint in ["/tini/dist/tini"]:
base_cmd = [ base_cmd = [
"docker", "docker",
"run", "run",
"--rm", "--rm",
"--volume={0}:/tini".format(root),
"--name={0}".format(name), "--name={0}".format(name),
"--entrypoint={0}".format(entrypoint), "--entrypoint={0}".format(entrypoint),
img, img,
@ -92,4 +93,4 @@ if __name__ == "__main__":
Command(base_cmd + ["-h"], fail_cmd).run(retcode=0) Command(base_cmd + ["-h"], fail_cmd).run(retcode=0)
# Valgrind test # Valgrind test
Command(base_cmd + ["--", "valgrind", "--leak-check=full", "--error-exitcode=1", "/tini/tini", "-v", "--", "ls"], fail_cmd).run() Command(base_cmd + ["--", "valgrind", "--leak-check=full", "--error-exitcode=1", entrypoint, "-v", "--", "ls"], fail_cmd).run()

Loading…
Cancel
Save