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.

136 lines
5.4 KiB

  1. # Configuration for Linux
  2. configs_linux = [
  3. # OS, compiler
  4. ("ubuntu-16.10", "gcc", ""),
  5. #("debian-9", "gcc", ""),
  6. ]
  7. # Configurations for Mac
  8. configs_mac = [
  9. # OS, compiler
  10. ("osx", "clang", ""),
  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)", "BuildLast"),
  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 += "sudo: required\n"
  38. s += "dist: trusty\n"
  39. s += "language: cpp\n"
  40. s += "\n"
  41. s += "# Enable caching\n"
  42. s += "cache:\n"
  43. s += " timeout: 1000\n"
  44. s += " directories:\n"
  45. s += " - build\n"
  46. s += " - travis/mtime_cache\n"
  47. s += "\n"
  48. s += "# Enable docker support\n"
  49. s += "services:\n"
  50. s += "- docker\n"
  51. s += "\n"
  52. s += "notifications:\n"
  53. s += " email:\n"
  54. s += " on_failure: always\n"
  55. s += " on_success: change\n"
  56. s += " recipients:\n"
  57. s += ' secure: "Q9CW/PtyWkZwExDrfFFb9n1STGYsRfI6awv1bZHcGwfrDvhpXoMCuF8CwviIfilm7fFJJEoKizTtdRpY0HrOnY/8KY111xrtcFYosxdndv7xbESodIxQOUoIEFCO0mCNHwWYisoi3dAA7H3Yn661EsxluwHjzX5vY0xSbw0n229hlsFz092HwGLSU33zHl7eXpQk+BOFmBTRGlOq9obtDZ17zbHz1oXFZntHK/JDUIYP0b0uq8NvE2jM6CIVdcuSwmIkOhZJoO2L3Py3rBbPci+L2PSK4Smv2UjCPF8KusnOaFIyDB3LcNM9Jqq5ssJMrK/KaO6BiuYrOZXYWZ7KEg3Y/naC8HjOH1dzty+P7oW46sb9F03pTsufqD4R7wcK+9wROTztO6aJPDG/IPH7EWgrBTxqlOkVRwi2eYuQouZpZUW6EMClKbMHMIxCH2S8aOk/r1w2cNwmPEcunnP0nl413x/ByHr4fTPFykPj8pQxIsllYjpdWBRQfDOauKWGzk6LcrFW0qpWP+/aJ2vYu/IoZQMG5lMHbp6Y1Lg09pYm7Q983v3b7D+JvXhOXMyGq91HyPahA2wwKoG1GA4uoZ2I95/IFYNiKkelDd3WTBoFLNF9YFoEJNdCywm1fO2WY4WkyEFBuQcgDA+YpFMJJMxjTbivYk9jvHk2gji//2w="\n'
  58. s += "\n"
  59. s += "#\n"
  60. s += "# Configurations\n"
  61. s += "#\n"
  62. s += "jobs:\n"
  63. s += " include:\n"
  64. # Generate all configurations
  65. for stage in stages:
  66. s += "\n"
  67. s += " ###\n"
  68. s += " # Stage: {}\n".format(stage[0])
  69. s += " ###\n"
  70. s += "\n"
  71. # Mac OS X
  72. for config in configs_mac:
  73. osx = config[0]
  74. compiler = "{}{}".format(config[1], config[2])
  75. s += " # {}\n".format(osx)
  76. buildConfig = ""
  77. for build in build_types:
  78. buildConfig += " - stage: {}\n".format(stage[0])
  79. buildConfig += " os: osx\n"
  80. buildConfig += " osx_image: xcode9.1\n"
  81. buildConfig += " compiler: {}\n".format(config[1])
  82. buildConfig += " env: CONFIG={} COMPILER={} STL=libc++\n".format(build, compiler)
  83. buildConfig += " install:\n"
  84. if stage[1] == "Build1":
  85. buildConfig += " - rm -rf build\n"
  86. buildConfig += " - travis/install_osx.sh\n"
  87. buildConfig += " script:\n"
  88. buildConfig += " - travis/build.sh {}\n".format(stage[1])
  89. buildConfig += " after_failure:\n"
  90. buildConfig += " - find build -iname '*err*.log' -type f -print -exec cat {} \;\n"
  91. s += buildConfig
  92. # Linux via Docker
  93. for config in configs_linux:
  94. linux = config[0]
  95. compiler = "{}{}".format(config[1], config[2])
  96. s += " # {}\n".format(linux)
  97. buildConfig = ""
  98. for build in build_types:
  99. buildConfig += " - stage: {}\n".format(stage[0])
  100. buildConfig += " os: linux\n"
  101. buildConfig += " compiler: {}\n".format(config[1])
  102. buildConfig += " env: CONFIG={} LINUX={} COMPILER={}\n".format(build, linux, compiler)
  103. buildConfig += " install:\n"
  104. if stage[1] == "Build1":
  105. buildConfig += " - rm -rf build\n"
  106. buildConfig += " - travis/install_linux.sh\n"
  107. buildConfig += " script:\n"
  108. buildConfig += " - travis/build.sh {}\n".format(stage[1])
  109. buildConfig += " before_cache:\n"
  110. buildConfig += " - docker cp storm:/storm/. .\n"
  111. buildConfig += " after_failure:\n"
  112. buildConfig += " - find build -iname '*err*.log' -type f -print -exec cat {} \;\n"
  113. # Upload to dockerhub
  114. if stage[1] == "TestAll":
  115. buildConfig += " after_success:\n"
  116. buildConfig += ' - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";\n'
  117. if "Debug" in build:
  118. buildConfig += " - docker commit storm mvolk/storm-debug:travis;\n"
  119. buildConfig += " - docker push mvolk/storm-debug:travis;\n"
  120. elif "Release" in build:
  121. buildConfig += " - docker commit storm mvolk/storm:travis;\n"
  122. buildConfig += " - docker push mvolk/storm:travis;\n"
  123. else:
  124. assert False
  125. s += buildConfig
  126. print(s)