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.

114 lines
3.7 KiB

  1. # Configuration for Linux
  2. configs_linux = [
  3. # OS, compiler
  4. ("ubuntu-16.10", "gcc", "-6"),
  5. ("debian-9", "gcc", "-6"),
  6. ]
  7. # Configurations for Mac
  8. configs_mac = [
  9. # OS, compiler
  10. ("osx", "clang", "-4.0"),
  11. ]
  12. # Build types
  13. build_types = [
  14. "DefaultDebug",
  15. "DefaultRelease",
  16. ]
  17. # Stages in travis
  18. stages = [
  19. ("Build (1st run)", "Build1"),
  20. ("Build (2nd run)", "Build2"),
  21. ("Build (3rd run)", "Build3"),
  22. ("Build (4th run)", "Build4"),
  23. ("Test all", "TestAll"),
  24. ]
  25. if __name__ == "__main__":
  26. s = ""
  27. # Initial config
  28. s += "# This file was inspired from https://github.com/google/fruit\n"
  29. s += "\n"
  30. s += "#\n"
  31. s += "# General config\n"
  32. s += "#\n"
  33. s += "branches:\n"
  34. s += " only:\n"
  35. s += " - master\n"
  36. s += "dist: trusty\n"
  37. s += "language: cpp\n"
  38. s += "\n"
  39. s += "# Enable caching\n"
  40. s += "cache:\n"
  41. s += " timeout: 600\n"
  42. s += " directories:\n"
  43. s += " - build\n"
  44. s += " - travis/mtime_cache\n"
  45. s += "\n"
  46. s += "# Enable docker support\n"
  47. s += "services:\n"
  48. s += "- docker\n"
  49. s += "sudo: required\n"
  50. s += "\n"
  51. s += "#\n"
  52. s += "# Configurations\n"
  53. s += "#\n"
  54. s += "jobs:\n"
  55. s += " include:\n"
  56. # Generate all configurations
  57. for stage in stages:
  58. s += "\n"
  59. s += " ###\n"
  60. s += " # Stage: {}\n".format(stage[0])
  61. s += " ###\n"
  62. s += "\n"
  63. # Mac OS X
  64. for config in configs_mac:
  65. osx = config[0]
  66. compiler = "{}{}".format(config[1], config[2])
  67. s += " # {}\n".format(osx)
  68. buildConfig = ""
  69. for build in build_types:
  70. buildConfig += " - stage: {}\n".format(stage[0])
  71. buildConfig += " os: osx\n"
  72. buildConfig += " compiler: {}\n".format(config[1])
  73. buildConfig += " env: CONFIG={} COMPILER={} STL=libc++\n".format(build, compiler)
  74. buildConfig += " install:\n"
  75. if stage[1] == "Build1":
  76. buildConfig += " - rm -rf build\n"
  77. buildConfig += " - travis/install_osx.sh\n"
  78. buildConfig += " script:\n"
  79. buildConfig += " - travis/build.sh {}\n".format(stage[1])
  80. buildConfig += " after_failure:\n"
  81. buildConfig += " - find build -iname '*err*.log' -type f -print -exec cat {} \;\n"
  82. s += buildConfig
  83. # Linux via Docker
  84. for config in configs_linux:
  85. linux = config[0]
  86. compiler = "{}{}".format(config[1], config[2])
  87. s += " # {}\n".format(linux)
  88. buildConfig = ""
  89. for build in build_types:
  90. buildConfig += " - stage: {}\n".format(stage[0])
  91. buildConfig += " os: linux\n"
  92. buildConfig += " compiler: {}\n".format(config[1])
  93. buildConfig += " env: CONFIG={} LINUX={} COMPILER={}\n".format(build, linux, compiler)
  94. buildConfig += " install:\n"
  95. if stage[1] == "Build1":
  96. buildConfig += " - rm -rf build\n"
  97. buildConfig += " - travis/install_linux.sh\n"
  98. buildConfig += " script:\n"
  99. buildConfig += " - travis/build.sh {}\n".format(stage[1])
  100. buildConfig += " before_cache:\n"
  101. buildConfig += " - docker cp storm:/storm/. .\n"
  102. buildConfig += " after_failure:\n"
  103. buildConfig += " - find build -iname '*err*.log' -type f -print -exec cat {} \;\n"
  104. s += buildConfig
  105. print(s)