Skip to content
Permalink
Browse files

Refactor of cloud game overlord and overworker (#70)

* Introduce Makefile and go vendor directory for faster build

* WIP: Refactor cloud-game codebase with spliting overlord and worker binary

* Fix all issues and have a running build

* Complete first version of refactor
  • Loading branch information...
sadlil authored and giongto35 committed Sep 11, 2019
1 parent 195dcd7 commit 8769e0cae38156ca071eb17f69ad8d483908af34
Showing with 11,493 additions and 55,930 deletions.
  1. +3 −1 .gitignore
  2. +111 −26 Makefile
  3. BIN { → assets/emulator}/libretro/cores/citra_libretro.so
  4. BIN { → assets/emulator}/libretro/cores/desmume_libretro.so
  5. BIN { → assets/emulator}/libretro/cores/mednafen_psx_hw_libretro.so
  6. BIN { → assets/emulator}/libretro/cores/mednafen_psx_libretro.so
  7. BIN { → assets/emulator}/libretro/cores/mednafen_snes_libretro.so
  8. BIN { → assets/emulator}/libretro/cores/mesen_libretro.so
  9. BIN { → assets/emulator}/libretro/cores/mess2015_libretro.so
  10. BIN { → assets/emulator}/libretro/cores/meteor_libretro.so
  11. BIN { → assets/emulator}/libretro/cores/mgba_libretro.so
  12. BIN { → assets/emulator}/libretro/cores/nestopia_libretro.so
  13. BIN { → assets/emulator}/libretro/cores/pcsx_rearmed_libretro.so
  14. BIN { → assets/emulator}/libretro/cores/prosystem_libretro.so
  15. BIN { → assets/emulator}/libretro/cores/snes9x2010_libretro.so
  16. BIN { → assets/emulator}/libretro/cores/snes9x_libretro.so
  17. BIN { → assets/emulator}/libretro/cores/yabasanshiro_libretro.so
  18. BIN { → assets}/games/Contra.nes
  19. BIN { → assets}/games/Pokemon - Fire Red Version (U) (V1.1).gba
  20. BIN { → assets}/games/Super Mario Bros.nes
  21. +0 −119 cmd/main.go
  22. +0 −515 cmd/main_test.go
  23. +43 −0 cmd/overlord/main.go
  24. +43 −0 cmd/overworker/main.go
  25. 0 {document → docs}/designdoc/README.md
  26. 0 {document → docs/designdoc}/implementation/README.md
  27. BIN {document → docs}/img/landing-page-front.png
  28. BIN {document → docs}/img/landing-page-gb.png
  29. BIN {document → docs}/img/landing-page-ps-hm.png
  30. BIN {document → docs}/img/landing-page-ps-x4.png
  31. BIN {document → docs}/img/landing-page.gif
  32. BIN {document → docs}/img/landing-page2.png
  33. BIN {document → docs}/img/overlord.png
  34. BIN {document → docs}/img/worker.png
  35. 0 {document → docs/userguide}/instruction/README.md
  36. +3 −3 go.mod
  37. +4 −2 go.sum
  38. 0 { → hack/configs}/prometheus.yml
  39. +16 −0 hack/scripts/install_tools.sh
  40. +10 −12 { → pkg}/config/config.go
  41. +1 −1 { → pkg}/cws/cws.go
  42. 0 { → pkg/emulator}/libretro/nanoarch/cfuncs.go
  43. 0 { → pkg/emulator}/libretro/nanoarch/libretro.h
  44. +2 −5 { → pkg/emulator}/libretro/nanoarch/naemulator.go
  45. +4 −3 { → pkg/emulator}/libretro/nanoarch/nanoarch.go
  46. 0 { → pkg/emulator}/libretro/nanoarch/savestates.go
  47. BIN { → pkg/emulator}/libretro/system/scph5500.bin
  48. BIN { → pkg/emulator}/libretro/system/scph5501.bin
  49. BIN { → pkg/emulator}/libretro/system/scph5502.bin
  50. +869 −0 pkg/emulator/nes/apu.go
  51. +33 −0 pkg/emulator/nes/cartridge.go
  52. +156 −0 pkg/emulator/nes/console.go
  53. +45 −0 pkg/emulator/nes/controller.go
  54. +975 −0 pkg/emulator/nes/cpu.go
  55. +57 −0 pkg/emulator/nes/filter.go
  56. +84 −0 pkg/emulator/nes/ines.go
  57. +36 −0 pkg/emulator/nes/mapper.go
  58. +205 −0 pkg/emulator/nes/mapper1.go
  59. +70 −0 pkg/emulator/nes/mapper2.go
  60. +85 −0 pkg/emulator/nes/mapper225.go
  61. +70 −0 pkg/emulator/nes/mapper3.go
  62. +234 −0 pkg/emulator/nes/mapper4.go
  63. +64 −0 pkg/emulator/nes/mapper7.go
  64. +134 −0 pkg/emulator/nes/memory.go
  65. +24 −0 pkg/emulator/nes/palette.go
  66. +740 −0 pkg/emulator/nes/ppu.go
  67. +1 −1 { → pkg}/emulator/type.go
  68. +1 −1 { → pkg/encoder}/h264encoder/encoder.go
  69. 0 { → pkg}/encoder/type.go
  70. +2 −2 { → pkg/encoder}/vpx-encoder/encoder.go
  71. 0 { → pkg/encoder}/vpx-encoder/msvc.h
  72. 0 { → pkg/encoder}/vpx-encoder/tools_common.c
  73. 0 { → pkg/encoder}/vpx-encoder/tools_common.h
  74. 0 { → pkg/encoder}/vpx-encoder/vpx_config.h
  75. +80 −0 pkg/monitoring/monitoring.go
  76. +1 −1 { → pkg}/overlord/browser.go
  77. +36 −0 pkg/overlord/config.go
  78. +7 −8 { → pkg}/overlord/handlers.go
  79. +68 −0 pkg/overlord/overlord.go
  80. +2 −2 { → pkg}/overlord/session.go
  81. +1 −1 { → pkg}/overlord/worker.go
  82. +2 −2 { → pkg}/util/gamelist/games.go
  83. +38 −0 pkg/util/logging/init.go
  84. 0 { → pkg}/util/netutil.go
  85. +26 −23 { → pkg}/util/util.go
  86. 0 { → pkg}/webrtc/util.go
  87. +3 −4 { → pkg}/webrtc/webrtc.go
  88. 0 { → pkg}/worker/cloud-storage/storage.go
  89. 0 { → pkg}/worker/cloud-storage/storage_test.go
  90. +37 −0 pkg/worker/config.go
  91. +4 −5 { → pkg}/worker/handlers.go
  92. +5 −5 { → pkg}/worker/overlord.go
  93. +91 −0 pkg/worker/overworker.go
  94. +5 −5 { → pkg}/worker/room/media.go
  95. +7 −7 { → pkg}/worker/room/room.go
  96. +1 −1 { → pkg}/worker/session.go
  97. +9 −0 tests/e2e/e2e_test.go
  98. +516 −0 tests/e2e/main_test.go
  99. +0 −42 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/asm-offsets.c
  100. +0 −39 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/asm-offsets.h
  101. +0 −67 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/dct.h
  102. +0 −281 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/mc-c.c
  103. +0 −31 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/mc.h
  104. +0 −79 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/pixel.h
  105. +0 −139 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/predict-c.c
  106. +0 −58 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/predict.h
  107. +0 −59 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/quant.h
  108. +0 −53 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/dct.h
  109. +0 −310 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/mc-c.c
  110. +0 −31 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/mc.h
  111. +0 −81 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/pixel.h
  112. +0 −108 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/predict-c.c
  113. +0 −70 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/predict.h
  114. +0 −53 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/quant.h
  115. +0 −176 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/bitstream.c
  116. +0 −312 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/bitstream.h
  117. +0 −1,485 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cabac.c
  118. +0 −118 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cabac.h
  119. +0 −1,446 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/common.c
  120. +0 −1,022 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/common.h
  121. +0 −490 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cpu.c
  122. +0 −73 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cpu.h
  123. +0 −1,155 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/dct.c
  124. +0 −80 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/dct.h
  125. +0 −908 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/deblock.c
  126. +0 −899 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/frame.c
  127. +0 −262 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/frame.h
  128. +0 −1,914 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/macroblock.c
  129. +0 −444 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/macroblock.h
  130. +0 −779 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/mc.c
  131. +0 −340 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/mc.h
  132. +0 −607 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/mvpred.c
  133. +0 −719 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/opencl.c
  134. +0 −804 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/opencl.h
  135. +0 −206 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/osdep.c
  136. +0 −414 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/osdep.h
  137. +0 −1,522 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/pixel.c
  138. +0 −155 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/pixel.h
  139. +0 −1,054 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/predict.c
  140. +0 −138 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/predict.h
  141. +0 −830 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/quant.c
  142. +0 −74 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/quant.h
  143. +0 −58 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/rectangle.c
  144. +0 −157 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/rectangle.h
  145. +0 −379 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/set.c
  146. +0 −347 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/set.h
  147. +0 −164 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/threadpool.c
  148. +0 −44 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/threadpool.h
  149. +0 −869 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/vlc.c
  150. +0 −357 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/win32thread.c
  151. +0 −81 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/win32thread.h
  152. +0 −144 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/dct.h
  153. +0 −911 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/mc-c.c
  154. +0 −32 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/mc.h
  155. +0 −220 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/pixel.h
  156. +0 −609 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/predict-c.c
  157. +0 −144 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/predict.h
  158. +0 −156 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/quant.h
  159. +0 −254 vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/util.h
  160. +0 −4,009 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/analyse.c
  161. +0 −44 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/analyse.h
  162. +0 −1,284 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/cabac.c
  163. +0 −722 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/cavlc.c
  164. +0 −4,429 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/encoder.c
  165. +0 −244 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/lookahead.c
  166. +0 −1,419 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/macroblock.c
  167. +0 −198 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/macroblock.h
  168. +0 −1,350 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/me.c
  169. +0 −104 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/me.h
  170. +0 −3,104 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/ratecontrol.c
  171. +0 −66 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/ratecontrol.h
  172. +0 −1,165 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/rdo.c
  173. +0 −853 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/set.c
  174. +0 −47 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/set.h
  175. +0 −780 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/slicetype-cl.c
  176. +0 −2,033 vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/slicetype.c
  177. +0 −964 vendor/github.com/gen2brain/x264-go/x264c/external/x264/x264.h
  178. +191 −0 vendor/github.com/golang/glog/LICENSE
  179. +44 −0 vendor/github.com/golang/glog/README
  180. +1,180 −0 vendor/github.com/golang/glog/glog.go
  181. +124 −0 vendor/github.com/golang/glog/glog_file.go
  182. +0 −169 vendor/github.com/marten-seemann/qtls/generate_cert.go
  183. +2 −0 vendor/github.com/spf13/pflag/.gitignore
  184. +21 −0 vendor/github.com/spf13/pflag/.travis.yml
  185. +28 −0 vendor/github.com/spf13/pflag/LICENSE
  186. +296 −0 vendor/github.com/spf13/pflag/README.md
  187. +94 −0 vendor/github.com/spf13/pflag/bool.go
  188. +147 −0 vendor/github.com/spf13/pflag/bool_slice.go
  189. +209 −0 vendor/github.com/spf13/pflag/bytes.go
  190. +96 −0 vendor/github.com/spf13/pflag/count.go
  191. +86 −0 vendor/github.com/spf13/pflag/duration.go
  192. +128 −0 vendor/github.com/spf13/pflag/duration_slice.go
  193. +1,227 −0 vendor/github.com/spf13/pflag/flag.go
  194. +88 −0 vendor/github.com/spf13/pflag/float32.go
  195. +84 −0 vendor/github.com/spf13/pflag/float64.go
  196. +105 −0 vendor/github.com/spf13/pflag/golangflag.go
  197. +84 −0 vendor/github.com/spf13/pflag/int.go
  198. +88 −0 vendor/github.com/spf13/pflag/int16.go
  199. +88 −0 vendor/github.com/spf13/pflag/int32.go
  200. +84 −0 vendor/github.com/spf13/pflag/int64.go
  201. +88 −0 vendor/github.com/spf13/pflag/int8.go
  202. +128 −0 vendor/github.com/spf13/pflag/int_slice.go
  203. +94 −0 vendor/github.com/spf13/pflag/ip.go
  204. +148 −0 vendor/github.com/spf13/pflag/ip_slice.go
  205. +122 −0 vendor/github.com/spf13/pflag/ipmask.go
  206. +98 −0 vendor/github.com/spf13/pflag/ipnet.go
  207. +80 −0 vendor/github.com/spf13/pflag/string.go
  208. +103 −0 vendor/github.com/spf13/pflag/string_array.go
  209. +149 −0 vendor/github.com/spf13/pflag/string_slice.go
  210. +149 −0 vendor/github.com/spf13/pflag/string_to_int.go
  211. +160 −0 vendor/github.com/spf13/pflag/string_to_string.go
  212. +88 −0 vendor/github.com/spf13/pflag/uint.go
  213. +88 −0 vendor/github.com/spf13/pflag/uint16.go
  214. +88 −0 vendor/github.com/spf13/pflag/uint32.go
  215. +88 −0 vendor/github.com/spf13/pflag/uint64.go
  216. +88 −0 vendor/github.com/spf13/pflag/uint8.go
  217. +126 −0 vendor/github.com/spf13/pflag/uint_slice.go
  218. +0 −383 vendor/golang.org/x/net/internal/iana/gen.go
  219. +0 −39 vendor/golang.org/x/net/internal/socket/defs_aix.go
  220. +0 −36 vendor/golang.org/x/net/internal/socket/defs_darwin.go
  221. +0 −36 vendor/golang.org/x/net/internal/socket/defs_dragonfly.go
  222. +0 −36 vendor/golang.org/x/net/internal/socket/defs_freebsd.go
  223. +0 −41 vendor/golang.org/x/net/internal/socket/defs_linux.go
  224. +0 −39 vendor/golang.org/x/net/internal/socket/defs_netbsd.go
  225. +0 −36 vendor/golang.org/x/net/internal/socket/defs_openbsd.go
  226. +0 −36 vendor/golang.org/x/net/internal/socket/defs_solaris.go
  227. +0 −39 vendor/golang.org/x/net/ipv4/defs_aix.go
  228. +0 −77 vendor/golang.org/x/net/ipv4/defs_darwin.go
  229. +0 −38 vendor/golang.org/x/net/ipv4/defs_dragonfly.go
  230. +0 −75 vendor/golang.org/x/net/ipv4/defs_freebsd.go
  231. +0 −122 vendor/golang.org/x/net/ipv4/defs_linux.go
  232. +0 −37 vendor/golang.org/x/net/ipv4/defs_netbsd.go
  233. +0 −37 vendor/golang.org/x/net/ipv4/defs_openbsd.go
  234. +0 −84 vendor/golang.org/x/net/ipv4/defs_solaris.go
  235. +0 −199 vendor/golang.org/x/net/ipv4/gen.go
  236. +0 −61 vendor/golang.org/x/sys/unix/mkasm_darwin.go
  237. +0 −122 vendor/golang.org/x/sys/unix/mkpost.go
  238. +0 −407 vendor/golang.org/x/sys/unix/mksyscall.go
  239. +0 −415 vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go
  240. +0 −614 vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go
  241. +0 −335 vendor/golang.org/x/sys/unix/mksyscall_solaris.go
  242. +0 −355 vendor/golang.org/x/sys/unix/mksysctl_openbsd.go
  243. +0 −190 vendor/golang.org/x/sys/unix/mksysnum.go
  244. +0 −237 vendor/golang.org/x/sys/unix/types_aix.go
  245. +0 −283 vendor/golang.org/x/sys/unix/types_darwin.go
  246. +0 −263 vendor/golang.org/x/sys/unix/types_dragonfly.go
  247. +0 −400 vendor/golang.org/x/sys/unix/types_freebsd.go
  248. +0 −290 vendor/golang.org/x/sys/unix/types_netbsd.go
  249. +0 −283 vendor/golang.org/x/sys/unix/types_openbsd.go
  250. +0 −266 vendor/golang.org/x/sys/unix/types_solaris.go
  251. +0 −24 vendor/golang.org/x/sys/windows/svc/go12.c
  252. +0 −133 vendor/golang.org/x/text/unicode/bidi/gen.go
  253. +0 −57 vendor/golang.org/x/text/unicode/bidi/gen_ranges.go
  254. +0 −64 vendor/golang.org/x/text/unicode/bidi/gen_trieval.go
  255. +0 −986 vendor/golang.org/x/text/unicode/norm/maketables.go
  256. +0 −117 vendor/golang.org/x/text/unicode/norm/triegen.go
  257. +50 −46 vendor/modules.txt
  258. 0 {static → web}/css/font-awesome.css
  259. 0 {static → web}/css/main.css
  260. BIN {static → web}/fonts/6809 chargen.ttf
  261. BIN {static → web}/fonts/8-Bit-Madness.ttf
  262. 0 {static → web}/game.html
  263. BIN {static → web}/img/background.jpg
  264. BIN {static → web}/img/help_overlay.png
  265. BIN {static → web}/img/ogimage.jpg
  266. BIN {static → web}/img/screen_background1.gif
  267. BIN {static → web}/img/screen_background2.gif
  268. BIN {static → web}/img/screen_background3.gif
  269. BIN {static → web}/img/screen_background4.jpg
  270. BIN {static → web}/img/screen_background5.png
  271. BIN {static → web}/img/screen_loading.gif
  272. 0 {static → web}/index.html
  273. 0 {static → web}/js/controller.js
  274. 0 {static → web}/js/gesture_joystick.js
  275. 0 {static → web}/js/gesture_keyboard.js
  276. 0 {static → web}/js/gesture_touch.js
  277. 0 {static → web}/js/global.js
  278. 0 {static → web}/js/init.js
  279. 0 {static → web}/js/jquery-3.3.1.min.js
  280. 0 {static → web}/js/libopus.js
  281. 0 {static → web}/js/opus.js
  282. 0 {static → web}/js/utils.js
  283. 0 {static → web}/js/ws.js
@@ -56,4 +56,6 @@ turnserver.conf
.idea/

### Ignore build artifact directory
./build
bin/
.coverage.out
_output/
137 Makefile
@@ -1,30 +1,115 @@
# Makefile includes some useful commands to build or format incentives
# More commands could be added

# Variables
PROJECT = cloud-game
REPO_ROOT = github.com/giongto35
ROOT = ${REPO_ROOT}/${PROJECT}

fmt:
@goimports -w cmd pkg tests
@gofmt -s -w cmd pkg tests

compile: fmt
@go install ./cmd/...

check: fmt
@golangci-lint run cmd/... pkg/...
# @staticcheck -checks="all,-S1*" ./cmd/... ./pkg/... ./tests/...

dep:
go mod download
go mod vendor
go mod tidy
# go mod vendor
# go mod tidy

# NOTE: there is problem with go mod vendor when it delete github.com/gen2brain/x264-go/x264c causing unable to build. https://github.com/golang/go/issues/26366
#build.cross: build
# CGO_ENABLED=1 GOOS=darwin GOARC=amd64 go build --ldflags '-linkmode external -extldflags "-static"' -o bin/overlord-darwin ./cmd/overlord
# CGO_ENABLED=1 GOOS=darwin GOARC=amd64 go build --ldflags '-linkmode external -extldflags "-static"' -o bin/overworker-darwin ./cmd/overworker
# CC=arm-linux-musleabihf-gcc GOOS=linux GOARC=amd64 CGO_ENABLED=1 go build --ldflags '-linkmode external -extldflags "-static"' -o bin/overlord-linu ./cmd/overlord
# CC=arm-linux-musleabihf-gcc GOOS=linux GOARC=amd64 CGO_ENABLED=1 go build --ldflags '-linkmode external -extldflags "-static"' -o bin/overworker-linux ./cmd/overworker

# A user can invoke tests in different ways:
# - make test runs all tests;
# - make test TEST_TIMEOUT=10 runs all tests with a timeout of 10 seconds;
# - make test TEST_PKG=./model/... only runs tests for the model package;
# - make test TEST_ARGS="-v -short" runs tests with the specified arguments;
# - make test-race runs tests with race detector enabled.
TEST_TIMEOUT = 60
TEST_PKGS ?= ./cmd/... ./pkg/...
TEST_TARGETS := test-short test-verbose test-race test-cover
.PHONY: $(TEST_TARGETS) test tests
test-short: TEST_ARGS=-short
test-verbose: TEST_ARGS=-v
test-race: TEST_ARGS=-race
test-cover: TEST_ARGS=-cover
$(TEST_TARGETS): test

test: compile
@go test -timeout $(TEST_TIMEOUT)s $(TEST_ARGS) $(TEST_PKGS)

test-e2e: compile
@go test ./tests/e2e/...

cover:
@go test -v -covermode=count -coverprofile=coverage.out $(TEST_PKGS)
# @$(GOPATH)/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $(COVERALLS_TOKEN)

clean:
@rm -rf bin
@rm -rf build
@go clean

dev.tools:
./hack/script/install_tools.sh

dev.build: compile
go build -a -tags netgo -ldflags '-w' -o bin/overlord ./cmd/overlord
go build -a -tags netgo -ldflags '-w' -o bin/overworker ./cmd/overworker

dev.build-local:
go build -o bin/overlord ./cmd/overlord
go build -o bin/overworker ./cmd/overworker

dev.run: dev.build-local
./bin/overlord --v=5 &
./bin/overworker --overlordhost ws://localhost:8000/wso



#dev.run: dev.build
# # Run coordinator first
# ./build/klog -overlordhost overlord &
# # Wait till overlord finish initialized
# # Run a worker connecting to overload
# ./build/klog -overlordhost ws://localhost:8000/wso

#dev.run.docker:
# docker build . -t cloud-game-local
# docker stop cloud-game-local
# docker rm cloud-game-local
# # Overlord and worker should be run separately. Local is for demo purpose
# docker run --privileged -v $PWD/games:/cloud-game/games -d --name cloud-game-local -p 8000:8000 -p 9000:9000 cloud-game-local bash -c "cmd -overlordhost ws://localhost:8000/wso & cmd -overlordhost overlord"

#build:
# go build -o build/cloudretro ./cmd
#
#run: build
# # Run coordinator first
# ./build/cloudretro -overlordhost overlord &
# # Wait till overlord finish initialized
# # Run a worker connecting to overload
# ./build/cloudretro -overlordhost ws://localhost:8000/wso

#run-docker:
# docker build . -t cloud-game-local
# docker stop cloud-game-local || true
# docker rm cloud-game-local || true
# # Overlord and worker should be run separately. Local is for demo purpose
# docker run --privileged -v $(PWD)/games:/cloud-game/games -d --name cloud-game-local -p 8000:8000 -p 9000:9000 cloud-game-local bash -c "cmd -overlordhost ws://localhost:8000/wso & cmd -overlordhost overlord"
#

build:
go build -o build/cloudretro ./cmd

run: build
# Run coordinator first
./build/cloudretro -overlordhost overlord &
# Wait till overlord finish initialized
# Run a worker connecting to overload
./build/cloudretro -overlordhost ws://localhost:8000/wso

run-docker:
docker build . -t cloud-game-local
docker stop cloud-game-local || true
docker rm cloud-game-local || true
# Overlord and worker should be run separately. Local is for demo purpose
docker run --privileged -v $(PWD)/games:/cloud-game/games -d --name cloud-game-local -p 8000:8000 -p 9000:9000 cloud-game-local bash -c "cmd -overlordhost ws://localhost:8000/wso & cmd -overlordhost overlord"

#run with vendor will be faster
build-vendor:
go build -o build/cloudretro -mod=vendor ./cmd

run-fast: build-vendor
./build/cloudretro -overlordhost overlord &
./build/cloudretro -overlordhost ws://localhost:8000/wso
#run-fast: build-vendor
# ./build/cloudretro -overlordhost overlord &
# ./build/cloudretro -overlordhost ws://localhost:8000/wso
#

0 comments on commit 8769e0c

Please sign in to comment.
You can’t perform that action at this time.