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.

106 lines
3.5 KiB

8 years ago
  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 dependencies", "BuildDep"),
  20. ("Build library (1st run)", "BuildLib1"),
  21. ("Build library (2nd run)", "BuildLib"),
  22. ("Build all", "BuildAll"),
  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. # Linux via Docker
  64. for config in configs_linux:
  65. linux = config[0]
  66. compiler = "{}{}".format(config[1], config[2])
  67. s += " # {}\n".format(linux)
  68. buildConfig = ""
  69. for build in build_types:
  70. buildConfig += " - stage: {}\n".format(stage[0])
  71. buildConfig += " os: linux\n"
  72. buildConfig += " compiler: {}\n".format(config[1])
  73. buildConfig += " env: BUILD={} COMPILER={} LINUX={}\n".format(build, compiler, linux)
  74. buildConfig += " install: export OS=linux; export COMPILER='{}'; export LINUX='{}';\n".format(compiler, linux)
  75. buildConfig += " travis/install_linux.sh\n"
  76. buildConfig += " script: export OS=linux; export COMPILER='{}'; export LINUX='{}';\n".format(compiler, linux)
  77. buildConfig += " travis/postsubmit.sh {} {}\n".format(build, stage[1])
  78. buildConfig += " before_cache:\n"
  79. buildConfig += " docker cp storm:/storm/. .\n"
  80. s += buildConfig
  81. # Mac OS X
  82. for config in configs_mac:
  83. osx = config[0]
  84. compiler = "{}{}".format(config[1], config[2])
  85. s += " # {}\n".format(osx)
  86. buildConfig = ""
  87. for build in build_types:
  88. buildConfig += " - stage: {}\n".format(stage[0])
  89. buildConfig += " os: osx\n"
  90. buildConfig += " compiler: {}\n".format(config[1])
  91. buildConfig += " env: BUILD={} COMPILER={} STL=libc++\n".format(build, compiler)
  92. buildConfig += " install: export OS=osx; export COMPILER='{}'; export STL='libc++';\n".format(compiler)
  93. buildConfig += " travis/install_osx.sh\n"
  94. buildConfig += " script: export OS=osx; export COMPILER='{}'; export STL='libc++';\n".format(compiler)
  95. buildConfig += " travis/postsubmit.sh {} {}\n".format(build, stage[1])
  96. s += buildConfig
  97. print(s)