mirror of https://github.com/krallin/tini.git
Convert to out-of-tree builds
This commit is contained in:
parent
84475c399b
commit
178f46aa01
|
@ -11,7 +11,7 @@ deploy:
|
|||
api_key:
|
||||
secure: Yk90ANpSPv1iJy8QDXCPwfaSmEr/WIJ3bzhQ6X8JvZjfrwTosbh0HrUzQyeac3nyvNwj7YJRssolOFc21IBKPpCFTZqYxSkuLPU6ysG4HGHgN6YJhOMm4mG4KKJ6741q3DJendhZpalBhCEi+NcZK/PCSD97Vl4OqRjBUged0fs=
|
||||
file:
|
||||
- "./tini"
|
||||
- "./dist/tini"
|
||||
on:
|
||||
repo: krallin/tini
|
||||
tags: true
|
||||
|
|
|
@ -5,7 +5,7 @@ project (tini)
|
|||
set (tini_VERSION_MAJOR 0)
|
||||
set (tini_VERSION_MINOR 3)
|
||||
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
|
||||
add_definitions (-D_FORTIFY_SOURCE=2)
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
FROM ubuntu
|
||||
|
||||
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/*
|
||||
|
||||
ADD . /tini
|
||||
WORKDIR /tini
|
||||
|
||||
RUN ./ci/run_build.sh
|
||||
|
||||
ENTRYPOINT ["/tini/tini"]
|
||||
|
|
|
@ -1,22 +1,31 @@
|
|||
#!/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 nounset
|
||||
|
||||
: ${SOURCE_DIR:="."}
|
||||
: ${DIST_DIR:="${SOURCE_DIR}/dist"}
|
||||
: ${BUILD_DIR:="/tmp/build"}
|
||||
|
||||
# Build
|
||||
cmake .
|
||||
cmake -B"${BUILD_DIR}" -H"${SOURCE_DIR}"
|
||||
|
||||
pushd "${BUILD_DIR}"
|
||||
make clean
|
||||
make
|
||||
|
||||
popd
|
||||
|
||||
# Smoke tests (actual tests need Docker to run; they don't run within the CI environment)
|
||||
tini="${BUILD_DIR}/tini"
|
||||
echo "Testing $tini with: true"
|
||||
$tini -vvvv true
|
||||
|
||||
# Success
|
||||
for tini in ./tini; do
|
||||
echo "Testing $tini with: true"
|
||||
$tini -vvvv true
|
||||
echo "Testing $tini with: false"
|
||||
if $tini -vvvv false; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Testing $tini with: false"
|
||||
if $tini -vvvv false; then
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
# Place files
|
||||
mkdir -p "${DIST_DIR}"
|
||||
cp "${BUILD_DIR}"/tini "${DIST_DIR}"
|
||||
|
|
9
ddist.sh
9
ddist.sh
|
@ -6,11 +6,10 @@ REL_HERE=$(dirname "${BASH_SOURCE}")
|
|||
HERE=$(cd "${REL_HERE}"; pwd)
|
||||
|
||||
IMG="tini"
|
||||
NAME="${IMG}-dist"
|
||||
SRC="/tini"
|
||||
|
||||
# Create the build image
|
||||
docker build -t "${IMG}" .
|
||||
|
||||
# Copy the generated README
|
||||
docker run -it --entrypoint="/bin/true" --name="${NAME}" "${IMG}"
|
||||
docker cp "${NAME}:/tini/README.md" "${HERE}"
|
||||
docker rm "${NAME}"
|
||||
# Run the build
|
||||
docker run --rm --volume="${HERE}:${SRC}" -e BUILD_DIR=/tmp/tini-build -e SOURCE_DIR="${SRC}" "${IMG}" "${SRC}/ci/run_build.sh"
|
||||
|
|
|
@ -61,11 +61,12 @@ if __name__ == "__main__":
|
|||
|
||||
root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
||||
|
||||
for entrypoint in ["/tini/tini"]:
|
||||
for entrypoint in ["/tini/dist/tini"]:
|
||||
base_cmd = [
|
||||
"docker",
|
||||
"run",
|
||||
"--rm",
|
||||
"--volume={0}:/tini".format(root),
|
||||
"--name={0}".format(name),
|
||||
"--entrypoint={0}".format(entrypoint),
|
||||
img,
|
||||
|
@ -92,4 +93,4 @@ if __name__ == "__main__":
|
|||
Command(base_cmd + ["-h"], fail_cmd).run(retcode=0)
|
||||
|
||||
# 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…
Reference in New Issue