You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.1 KiB

8 years ago
  1. #!/bin/bash -x
  2. # Inspired by https://github.com/google/fruit
  3. : ${N_JOBS:=2}
  4. : ${TIMEOUT_MAC:=1800}
  5. : ${TIMEOUT_LINUX:=2000}
  6. if [ "$STL" != "" ]
  7. then
  8. STLARG="-stdlib=$STL"
  9. fi
  10. EXITCODE=42
  11. case $OS in
  12. linux)
  13. # Execute docker image on Linux
  14. # Stop previous session
  15. docker rm -f storm &>/dev/null
  16. # Run container
  17. set -e
  18. docker run -d -it --name storm --privileged mvolk/storm-basesystem:$LINUX
  19. # Copy local content into container
  20. docker exec storm mkdir storm
  21. docker cp . storm:/storm
  22. set +e
  23. # Execute main process
  24. timeout $TIMEOUT_LINUX docker exec storm bash -c "
  25. export COMPILER=$COMPILER;
  26. export N_JOBS=$N_JOBS;
  27. export STLARG=$STLARG;
  28. export OS=$OS;
  29. cd storm;
  30. travis/build-helper.sh $1 $2"
  31. EXITCODE=$?
  32. ;;
  33. osx)
  34. # Mac OSX
  35. export COMPILER
  36. export N_JOBS
  37. export STLARG
  38. export OS
  39. gtimeout $TIMEOUT_MAC travis/build-helper.sh "$1" "$2"
  40. EXITCODE=$?
  41. ;;
  42. *)
  43. # Unknown OS
  44. echo "Unsupported OS: $OS"
  45. exit 1
  46. esac
  47. if [[ $EXITCODE == 124 ]] && [[ "$2" == Build* ]] && [[ "$2" != "Build4" ]]
  48. then
  49. exit 0
  50. else
  51. exit $EXITCODE
  52. fi