-
Notifications
You must be signed in to change notification settings - Fork 625
/
Copy pathTaskfile.yml
147 lines (126 loc) · 4.09 KB
/
Taskfile.yml
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
version: '3'
tasks:
clean:
desc: clean up
cmds:
- task: clean-agents
- task: clean-server
lint:
desc: lint-agent
env:
PYTHONPATH: "./agents/ten_packages/system/ten_runtime_python/lib:./agents/ten_packages/system/ten_runtime_python/interface:./agents/ten_packages/system/ten_ai_base/interface"
cmds:
- ./agents/scripts/pylint.sh
install-tools:
desc: install tools
cmds:
- pip install pylint
build:
desc: build
cmds:
- task: build-agent
- task: build-server
use:
desc: use agent, default 'agents/examples/default'
vars:
AGENT: '{{.AGENT| default "agents/examples/default"}}'
cmds:
- ln -sf {{.USER_WORKING_DIR}}/{{.AGENT}}/manifest.json ./agents/
- ln -sf {{.USER_WORKING_DIR}}/{{.AGENT}}/property.json ./agents/
- task: build
run-server:
desc: run backend http server
cmds:
- source .env && /app/server/bin/api
run-gd-server:
desc: run tman dev http server for graph designer
dir: ./agents
cmds:
- tman designer
run:
desc: run servers
deps:
- task: run-server
- task: run-gd-server
build-agent:
desc: build agent
dir: ./agents
internal: true
cmds:
- ./scripts/install_deps_and_build.sh linux x64 && mv bin/main bin/worker
build-server:
desc: build server
dir: ./server
cmds:
- go mod tidy && go mod download && go build -o bin/api main.go
clean-agents:
desc: clean up agents
dir: ./agents
internal: true
cmds:
- rm -rf manifest.json property.json manifest-lock.json bin/main bin/worker out .release ten_packages/system ten_packages/system/agora_rtc_sdk ten_packages/system/azure_speech_sdk ten_packages/system/nlohmann_json ten_packages/extension/agora_rtc ten_packages/extension/agora_rtm ten_packages/extension/agora_sess_ctrl ten_packages/extension/azure_tts ten_packages/addon_loader
- find . -type d -name .pytest_cache -exec rm -rf {} \; || true
- find . -type d -name __pycache__ -exec rm -rf {} \; || true
- find . -type d -name .ten -exec rm -rf {} \; || true
- find . -name .coverage -exec rm -f {} \; || true
clean-server:
desc: clean up server
dir: ./server
internal: true
cmds:
- rm -rf bin
test:
desc: run tests
cmds:
- task: test-agent-extensions
- task: test-server
test-server:
desc: test server
dir: ./server
internal: true
cmds:
- go test -v ./...
test-agent-extensions:
desc: run standalone testing of extensions
internal: true
env:
PYTHONPATH: "{{.USER_WORKING_DIR}}:{{.USER_WORKING_DIR}}/agents/ten_packages/system/ten_runtime_python/lib:{{.USER_WORKING_DIR}}/agents/ten_packages/system/ten_runtime_python/interface:{{.USER_WORKING_DIR}}/agents/ten_packages/system/ten_ai_base/interface"
vars:
EXTENSIONS:
sh: 'find agents/ten_packages/extension -type d -exec test -d "{}/tests" \; -print'
cmds:
- for: { var: EXTENSIONS }
task: test-extension
vars:
EXTENSION: '{{ .ITEM }}'
test-extension:
desc: run standalone testing of one single extension
vars:
EXTENSION: '{{.EXTENSION| default "agents/ten_packages/extension/elevenlabs_tts_python"}}'
env:
PYTHONPATH: "{{.USER_WORKING_DIR}}:{{.USER_WORKING_DIR}}/agents/ten_packages/system/ten_runtime_python/lib:{{.USER_WORKING_DIR}}/agents/ten_packages/system/ten_runtime_python/interface:{{.USER_WORKING_DIR}}/agents/ten_packages/system/ten_ai_base/interface"
dotenv: ['.env']
cmds:
- cd {{.EXTENSION}} && tman -y install --standalone && ./tests/bin/start {{ .CLI_ARGS }}
format:
desc: format code
cmds:
- task: black-format
black-format:
desc: format python code with black
internal: true
cmds:
- black . {{ .CLI_ARGS }}
check:
desc: check code
cmds:
- task: format-check
format-check:
desc: check code formatting
cmds:
- task: black-format-check
black-format-check:
desc: check code formatting with black
internal: true
cmds:
- black --check . {{ .CLI_ARGS }}