Skip to content

Commit

Permalink
Add test-linux sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ra1028 committed Jan 21, 2019
1 parent 30bac9d commit a1342c7
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ lib-lint:

pod-release:
bundle exec pod trunk push

test-linux:
sh scripts/test-linux.sh
34 changes: 34 additions & 0 deletions scripts/test-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# !/bin/bash

set -e

if [[ `uname` == "Darwin" ]]; then
if [[ -z `which docker-machine 2>/dev/null` || -z `which virtualbox 2>/dev/null` ]] ; then
echo "Install docker-machine and virtualbox ahead."
exit -1
fi

if [[ ! $(docker info 2>/dev/null) ]]; then
echo "Is Docker running?"
exit -1
fi

DOCKER_HOST_NAME=com.ryo.DifferenceKit.test
WORKING_DIR=$(pwd)

echo "Starting to running tests on Linux by Docker..."
docker-machine create --driver virtualbox $DOCKER_HOST_NAME || true
docker run -v $WORKING_DIR:$WORKING_DIR -w $WORKING_DIR -it --privileged swift:latest bash -c "$0" || true
docker-machine stop $DOCKER_HOST_NAME || true
docker-machine rm -f $DOCKER_HOST_NAME || true
echo "Finish"

elif [[ `uname` == "Linux" ]]; then
swift build
swift test

else
echo "Unsupported OS (`uname`)"
exit -1

fi

0 comments on commit a1342c7

Please sign in to comment.