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.

115 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 += " - stable\n"
  37. s += "dist: trusty\n"
  38. s += "language: cpp\n"
  39. s += "\n"
  40. s += "# Enable caching\n"
  41. s += "cache:\n"
  42. s += " timeout: 1000\n"
  43. s += " directories:\n"
  44. s += " - build\n"
  45. s += " - travis/mtime_cache\n"
  46. s += "\n"
  47. s += "# Enable docker support\n"
  48. s += "services:\n"
  49. s += "- docker\n"
  50. s += "sudo: required\n"
  51. s += "\n"
  52. s += "#\n"
  53. s += "# Configurations\n"
  54. s += "#\n"
  55. s += "jobs:\n"
  56. s += " include:\n"
  57. # Generate all configurations
  58. for stage in stages:
  59. s += "\n"
  60. s += " ###\n"
  61. s += " # Stage: {}\n".format(stage[0])
  62. s += " ###\n"
  63. s += "\n"
  64. # Mac OS X
  65. for config in configs_mac:
  66. osx = config[0]
  67. compiler = "{}{}".format(config[1], config[2])
  68. s += " # {}\n".format(osx)
  69. buildConfig = ""
  70. for build in build_types:
  71. buildConfig += " - stage: {}\n".format(stage[0])
  72. buildConfig += " os: osx\n"
  73. buildConfig += " compiler: {}\n".format(config[1])
  74. buildConfig += " env: CONFIG={} COMPILER={} STL=libc++\n".format(build, compiler)
  75. buildConfig += " install:\n"
  76. if stage[1] == "Build1":
  77. buildConfig += " - rm -rf build\n"
  78. buildConfig += " - travis/install_osx.sh\n"
  79. buildConfig += " script:\n"
  80. buildConfig += " - travis/build.sh {}\n".format(stage[1])
  81. buildConfig += " after_failure:\n"
  82. buildConfig += " - find build -iname '*err*.log' -type f -print -exec cat {} \;\n"
  83. s += buildConfig
  84. # Linux via Docker
  85. for config in configs_linux:
  86. linux = config[0]
  87. compiler = "{}{}".format(config[1], config[2])
  88. s += " # {}\n".format(linux)
  89. buildConfig = ""
  90. for build in build_types:
  91. buildConfig += " - stage: {}\n".format(stage[0])
  92. buildConfig += " os: linux\n"
  93. buildConfig += " compiler: {}\n".format(config[1])
  94. buildConfig += " env: CONFIG={} LINUX={} COMPILER={}\n".format(build, linux, compiler)
  95. buildConfig += " install:\n"
  96. if stage[1] == "Build1":
  97. buildConfig += " - rm -rf build\n"
  98. buildConfig += " - travis/install_linux.sh\n"
  99. buildConfig += " script:\n"
  100. buildConfig += " - travis/build.sh {}\n".format(stage[1])
  101. buildConfig += " before_cache:\n"
  102. buildConfig += " - docker cp storm:/storm/. .\n"
  103. buildConfig += " after_failure:\n"
  104. buildConfig += " - find build -iname '*err*.log' -type f -print -exec cat {} \;\n"
  105. s += buildConfig
  106. print(s)