-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmake.lua
103 lines (90 loc) · 2.87 KB
/
xmake.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
task("test")
on_run(function()
import("core.base.task")
task.run("unittest")
task.run("perftest")
end)
set_menu {
-- Settings menu usage
usage = "xmake test [options]"
, description = "run test case"
, options = {
}
}
task("unittest")
on_run(function()
cprint('${green} 开始单元测试...')
os.exec("tox -e py37")
end)
set_menu {
-- Settings menu usage
usage = "xmake unittest [options]"
, description = "run test case"
, options = {
}
}
task("perftest")
on_run(function()
cprint('开始性能测试...')
import("core.base.task")
task.run("perftest-websocket")
end)
set_menu {
usage = "xmake perftest [options]"
, description = "run test case"
, options = {
}
}
task("perftest-websocket")
on_run(function()
math.randomseed(os.time())
local loc = 'tests/perf/scripts'
local message_load = 3000
local host = "127.0.0.1"
local port = math.random(1000, 8000)
local websocket_server_script= 'src/websocket_server.go'
local websocketd_cmd = string.format("sh -c 'timeout 30 go run %s --host %s --port %s &'", websocket_server_script, host, port)
local websocket_server_addr = string.format("ws://%s:%s", host, port)
local perftest_websocket_cmd = string.format("pyenv exec pytest --websocket-server=%s --websocket-message-load=%s tests/perf/websocket_test.py", websocket_server_addr, message_load)
cprint('开始websocket采集性能测试...')
os.cd(loc)
os.exec(websocketd_cmd)
os.cd('-')
os.exec(perftest_websocket_cmd)
end)
task("perftest-http")
on_run(function()
cprint('${green} 开始http采集性能测试...')
end)
task("perftest-socket")
on_run(function()
cprint('${green} 开始socket采集性能测试...')
end)
task("package")
on_run(function()
cprint('${green} 开始打包 ...')
local package_cmd = "python3.7 setup.py sdist --formats=gztar,zip bdist_wheel"
local clean_cmd1 = "python3.7 setup.py clean --all "
local clean_cmd2 = "rm -rf dist"
local clean_cmd3 = "rm -rf build"
os.exec(clean_cmd1)
os.exec(clean_cmd2)
os.exec(clean_cmd3)
os.exec(package_cmd)
end)
task("publish")
on_run(function()
import("core.base.task")
task.run("package")
local repo = ' https://github.com/WALL-EEEEEEE
local publish_cmd = string.format("twine upload --repository-url %s dist/* ", repo)
cprint('${green} 开始发布 ...')
os.exec(publish_cmd)
end)
set_menu {
-- Settings menu usage
usage = "xmake pushlish [options]"
, description = "publish package"
, options = {
}
}