2017-01-08 14:45:28 -04:00
|
|
|
#! /bin/bash
|
|
|
|
|
2017-05-26 10:28:37 -03:00
|
|
|
if [[ $@ =~ .*px4fmu.* ]]; then
|
|
|
|
# nuttx-px4fmu-v{1,2,3,4,5}
|
2017-07-28 02:23:25 -03:00
|
|
|
PX4_DOCKER_REPO="px4io/px4-dev-nuttx:2017-07-27"
|
2017-05-26 10:28:37 -03:00
|
|
|
elif [[ $@ =~ .*rpi.* ]] || [[ $@ =~ .*bebop.* ]]; then
|
|
|
|
# posix_rpi_cross, posix_bebop_default
|
2017-07-28 02:23:25 -03:00
|
|
|
PX4_DOCKER_REPO="px4io/px4-dev-raspi:2017-07-27"
|
2017-05-26 10:28:37 -03:00
|
|
|
elif [[ $@ =~ .*eagle.* ]] || [[ $@ =~ .*excelsior.* ]]; then
|
|
|
|
# eagle, excelsior
|
2017-07-28 11:06:01 -03:00
|
|
|
PX4_DOCKER_REPO="lorenzmeier/px4-dev-snapdragon:2017-07-28"
|
2017-05-26 10:28:37 -03:00
|
|
|
elif [[ $@ =~ .*clang.* ]] || [[ $@ =~ .*scan-build.* ]]; then
|
|
|
|
# clang tools
|
2017-07-28 02:23:25 -03:00
|
|
|
PX4_DOCKER_REPO="px4io/px4-dev-clang:2017-07-27"
|
2017-06-01 09:47:33 -03:00
|
|
|
elif [[ $@ =~ .*cppcheck.* ]]; then
|
|
|
|
# need Ubuntu 17.04 for cppcheck cmake support
|
|
|
|
# TODO: remove this once px4io/px4-dev-base updates
|
|
|
|
PX4_DOCKER_REPO=px4io/px4-dev-base:ubuntu17.04
|
2017-05-26 10:28:37 -03:00
|
|
|
elif [[ $@ =~ .*tests* ]]; then
|
|
|
|
# run all tests with simulation
|
2017-07-28 02:23:25 -03:00
|
|
|
PX4_DOCKER_REPO="px4io/px4-dev-simulation:2017-07-27"
|
2017-05-26 10:28:37 -03:00
|
|
|
fi
|
|
|
|
|
|
|
|
# otherwise default to nuttx
|
2017-01-14 10:38:28 -04:00
|
|
|
if [ -z "$PX4_DOCKER_REPO" ]; then
|
2017-07-28 02:23:25 -03:00
|
|
|
PX4_DOCKER_REPO="px4io/px4-dev-nuttx:2017-07-27"
|
2017-01-14 10:38:28 -04:00
|
|
|
fi
|
|
|
|
|
2017-05-26 10:28:37 -03:00
|
|
|
# docker hygiene
|
|
|
|
|
|
|
|
#Delete all stopped containers (including data-only containers)
|
|
|
|
#docker rm $(docker ps -a -q)
|
|
|
|
|
|
|
|
#Delete all 'untagged/dangling' (<none>) images
|
|
|
|
#docker rmi $(docker images -q -f dangling=true)
|
|
|
|
|
|
|
|
echo "PX4_DOCKER_REPO: $PX4_DOCKER_REPO";
|
|
|
|
|
2017-01-08 14:45:28 -04:00
|
|
|
PWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
|
|
SRC_DIR=$PWD/../
|
|
|
|
|
|
|
|
CCACHE_DIR=${HOME}/.ccache
|
2017-05-26 10:28:37 -03:00
|
|
|
mkdir -p "${CCACHE_DIR}"
|
2017-01-08 14:45:28 -04:00
|
|
|
|
2017-01-14 10:38:28 -04:00
|
|
|
X11_TMP=/tmp/.X11-unix
|
|
|
|
|
2017-05-26 10:28:37 -03:00
|
|
|
docker run -it --rm -w "${SRC_DIR}" \
|
|
|
|
-e AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}" \
|
|
|
|
-e AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" \
|
|
|
|
-e BRANCH_NAME="${BRANCH_NAME}" \
|
|
|
|
-e CCACHE_DIR="${CCACHE_DIR}" \
|
|
|
|
-e CI="${CI}" \
|
2017-06-01 09:47:33 -03:00
|
|
|
-e CODECOV_TOKEN="${CODECOV_TOKEN}" \
|
2017-04-23 19:10:17 -03:00
|
|
|
-e COVERALLS_REPO_TOKEN="${COVERALLS_REPO_TOKEN}" \
|
2017-05-26 10:28:37 -03:00
|
|
|
-e DISPLAY="${DISPLAY}" \
|
|
|
|
-e LOCAL_USER_ID="$(id -u)" \
|
|
|
|
-e TRAVIS_BRANCH="${TRAVIS_BRANCH}" \
|
|
|
|
-e TRAVIS_BUILD_ID="${TRAVIS_BUILD_ID}" \
|
2017-01-14 10:38:28 -04:00
|
|
|
-v ${CCACHE_DIR}:${CCACHE_DIR}:rw \
|
|
|
|
-v ${SRC_DIR}:${SRC_DIR}:rw \
|
|
|
|
-v ${X11_TMP}:${X11_TMP}:ro \
|
|
|
|
${PX4_DOCKER_REPO} /bin/bash -c "$@"
|