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.

173 lines
7.0 KiB

  1. # Generate .travis.yml automatically
  2. # Configuration for Linux
  3. configs_linux = [
  4. # OS, compiler, build type
  5. ("debian-9", "gcc", "DefaultDebug"),
  6. ("debian-9", "gcc", "DefaultRelease"),
  7. ("ubuntu-18.04", "gcc", "DefaultDebugTravis"),
  8. ("ubuntu-18.04", "gcc", "DefaultReleaseTravis"),
  9. ("ubuntu-18.04", "gcc", "DefaultDebug"),
  10. ("ubuntu-18.04", "gcc", "DefaultRelease"),
  11. ]
  12. # Configurations for Mac
  13. configs_mac = [
  14. # OS, compiler, build type
  15. # ("osx", "clang", "DefaultDebug"),
  16. # ("osx", "clang", "DefaultRelease"),
  17. ]
  18. # Stages in travis
  19. stages = [
  20. ("Build (1st run)", "Build1"),
  21. ("Build (2nd run)", "Build2"),
  22. ("Build (3rd run)", "Build3"),
  23. ("Build (4th run)", "BuildLast"),
  24. ("Test all", "TestAll"),
  25. ]
  26. if __name__ == "__main__":
  27. allow_failures = []
  28. s = ""
  29. # Initial config
  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 += "sudo: required\n"
  38. s += "dist: trusty\n"
  39. s += "language: cpp\n"
  40. s += "\n"
  41. s += "git:\n"
  42. s += " depth: false\n"
  43. s += "\n"
  44. s += "# Enable caching\n"
  45. s += "cache:\n"
  46. s += " timeout: 1000\n"
  47. s += " directories:\n"
  48. s += " - build\n"
  49. s += " - travis/mtime_cache\n"
  50. s += "\n"
  51. s += "# Enable docker support\n"
  52. s += "services:\n"
  53. s += "- docker\n"
  54. s += "\n"
  55. s += "notifications:\n"
  56. s += " email:\n"
  57. s += " on_failure: always\n"
  58. s += " on_success: change\n"
  59. s += " recipients:\n"
  60. s += ' - secure: "VWnsiQkt1xjgRo1hfNiNQqvLSr0fshFmLV7jJlUixhCr094mgD0U2bNKdUfebm28Byg9UyDYPbOFDC0sx7KydKiL1q7FKKXkyZH0k04wUu8XiNw+fYkDpmPnQs7G2n8oJ/GFJnr1Wp/1KI3qX5LX3xot4cJfx1I5iFC2O+p+ng6v/oSX+pewlMv4i7KL16ftHHHMo80N694v3g4B2NByn4GU2/bjVQcqlBp/TiVaUa5Nqu9DxZi/n9CJqGEaRHOblWyMO3EyTZsn45BNSWeQ3DtnMwZ73rlIr9CaEgCeuArc6RGghUAVqRI5ao+N5apekIaILwTgL6AJn+Lw/+NRPa8xclgd0rKqUQJMJCDZKjKz2lmIs3bxfELOizxJ3FJQ5R95FAxeAZ6rb/j40YqVVTw2IMBDnEE0J5ZmpUYNUtPti/Adf6GD9Fb2y8sLo0XDJzkI8OxYhfgjSy5KYmRj8O5MXcP2MAE8LQauNO3MaFnL9VMVOTZePJrPozQUgM021uyahf960+QNI06Uqlmg+PwWkSdllQlxHHplOgW7zClFhtSUpnJxcsUBzgg4kVg80gXUwAQkaDi7A9Wh2bs+TvMlmHzBwg+2SaAfWDgjeJIeOaipDkF1uSGzC+EHAiiKYMLd4Aahoi8SuelJUucoyJyLAq00WdUFQIh/izVhM4Y="\n'
  61. s += "\n"
  62. s += "#\n"
  63. s += "# Configurations\n"
  64. s += "#\n"
  65. s += "jobs:\n"
  66. s += " include:\n"
  67. # Start with prebuilding carl for docker
  68. s += "\n"
  69. s += " ###\n"
  70. s += " # Stage: Build Carl\n"
  71. s += " ###\n"
  72. s += "\n"
  73. for config in configs_linux:
  74. linux = config[0]
  75. compiler = config[1]
  76. build_type = config[2]
  77. if "Travis" in build_type:
  78. s += " # {} - {}\n".format(linux, build_type)
  79. buildConfig = ""
  80. buildConfig += " - stage: Build Carl\n"
  81. buildConfig += " os: linux\n"
  82. buildConfig += " compiler: {}\n".format(compiler)
  83. buildConfig += " env: CONFIG={} LINUX={} COMPILER={}\n".format(build_type, linux, compiler)
  84. buildConfig += " install:\n"
  85. buildConfig += " - travis/install_linux.sh\n"
  86. buildConfig += " before_script:\n"
  87. buildConfig += ' - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode\n'
  88. buildConfig += " script:\n"
  89. buildConfig += " - travis/build_carl.sh\n"
  90. # Upload to DockerHub
  91. buildConfig += " after_success:\n"
  92. buildConfig += " - travis/deploy_carl.sh\n"
  93. s += buildConfig
  94. # Generate all configurations
  95. for stage in stages:
  96. s += "\n"
  97. s += " ###\n"
  98. s += " # Stage: {}\n".format(stage[0])
  99. s += " ###\n"
  100. s += "\n"
  101. # Mac OS X
  102. for config in configs_mac:
  103. osx = config[0]
  104. compiler = config[1]
  105. build_type = config[2]
  106. s += " # {} - {}\n".format(osx, build_type)
  107. buildConfig = ""
  108. buildConfig += " - stage: {}\n".format(stage[0])
  109. buildConfig += " os: osx\n"
  110. buildConfig += " osx_image: xcode9.1\n"
  111. buildConfig += " compiler: {}\n".format(compiler)
  112. buildConfig += " env: CONFIG={} COMPILER={} STL=libc++\n".format(build_type, compiler)
  113. buildConfig += " install:\n"
  114. if stage[1] == "Build1":
  115. buildConfig += " - rm -rf build\n"
  116. buildConfig += " - travis/install_osx.sh\n"
  117. buildConfig += " before_script:\n"
  118. buildConfig += ' - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode\n'
  119. buildConfig += " script:\n"
  120. buildConfig += " - travis/build.sh {}\n".format(stage[1])
  121. buildConfig += " after_failure:\n"
  122. buildConfig += " - find build -iname '*err*.log' -type f -print -exec cat {} \;\n"
  123. s += buildConfig
  124. # Linux via Docker
  125. for config in configs_linux:
  126. allow_fail = ""
  127. linux = config[0]
  128. compiler = config[1]
  129. build_type = config[2]
  130. s += " # {} - {}\n".format(linux, build_type)
  131. buildConfig = ""
  132. buildConfig += " - stage: {}\n".format(stage[0])
  133. allow_fail += " - stage: {}\n".format(stage[0])
  134. buildConfig += " os: linux\n"
  135. allow_fail += " os: linux\n"
  136. buildConfig += " compiler: {}\n".format(compiler)
  137. buildConfig += " env: CONFIG={} LINUX={} COMPILER={}\n".format(build_type, linux, compiler)
  138. allow_fail += " env: CONFIG={} LINUX={} COMPILER={}\n".format(build_type, linux, compiler)
  139. buildConfig += " install:\n"
  140. if stage[1] == "Build1":
  141. buildConfig += " - rm -rf build\n"
  142. buildConfig += " - travis/install_linux.sh\n"
  143. buildConfig += " before_script:\n"
  144. buildConfig += ' - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode\n'
  145. buildConfig += " script:\n"
  146. buildConfig += " - travis/build.sh {}\n".format(stage[1])
  147. buildConfig += " before_cache:\n"
  148. buildConfig += " - docker cp storm:/opt/storm/. .\n"
  149. buildConfig += " after_failure:\n"
  150. buildConfig += " - find build -iname '*err*.log' -type f -print -exec cat {} \;\n"
  151. # Upload to DockerHub
  152. if stage[1] == "TestAll" and "Travis" in build_type:
  153. buildConfig += " after_success:\n"
  154. buildConfig += " - travis/deploy_storm.sh\n"
  155. s += buildConfig
  156. if "Travis" in build_type and "Release" in build_type:
  157. allow_failures.append(allow_fail)
  158. if len(allow_failures) > 0:
  159. s += " allow_failures:\n"
  160. for fail in allow_failures:
  161. s += fail
  162. print(s)