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.

175 lines
7.1 KiB

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