Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

main.yml 6.7 KB

You have to be logged in to leave a comment. Sign In
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
  1. name: CI
  2. on:
  3. pull_request:
  4. push:
  5. branches:
  6. - main
  7. workflow_dispatch:
  8. concurrency:
  9. group: ${{ github.workflow }}-${{ github.ref }}
  10. cancel-in-progress: ${{ github.event_name == 'pull_request' }}
  11. env:
  12. OPENAI_API_KEY: xxx
  13. ANTHROPIC_API_KEY: xxx
  14. AZURE_OPENAI_API_HOST: xxx
  15. VITE_TELEMETRY_DISABLED: 1
  16. jobs:
  17. build:
  18. name: Build and test on Node ${{ matrix.node }} and ${{ matrix.os }}
  19. timeout-minutes: 12
  20. runs-on: ${{ matrix.os }}
  21. strategy:
  22. fail-fast: false
  23. matrix:
  24. # Temporarily disabled 22.x due to github runner compatibility issues
  25. # TODO(Michael): Re-enable once issues are resolved, 2024-08-23
  26. node: ['18.x', '20.x']
  27. os: [ubuntu-latest, windows-latest, macOS-latest]
  28. exclude:
  29. # Remove when https://github.com/nodejs/node/issues/51766 is resolved
  30. - node: '22.x'
  31. os: windows-latest
  32. steps:
  33. - name: Checkout repo
  34. uses: actions/checkout@v4
  35. - name: Use Node ${{ matrix.node }}
  36. uses: actions/setup-node@v4
  37. with:
  38. node-version: ${{ matrix.node }}
  39. cache: 'npm'
  40. - name: Use Python 3.12
  41. uses: actions/setup-python@v5
  42. with:
  43. python-version: 3.12
  44. - name: Install Dependencies
  45. run: |
  46. npm ci
  47. - name: Test
  48. run: npm run test -- --ci --coverage --maxWorkers=2
  49. - name: Build
  50. run: npm run build
  51. style-check:
  52. name: Style Check
  53. timeout-minutes: 5
  54. runs-on: ubuntu-latest
  55. steps:
  56. - name: Checkout repo
  57. uses: actions/checkout@v4
  58. - name: Use Node
  59. uses: actions/setup-node@v4
  60. with:
  61. node-version-file: '.nvmrc'
  62. cache: 'npm'
  63. - name: Install Dependencies
  64. run: |
  65. npm ci
  66. - name: Lint Project
  67. run: |
  68. npm run lint
  69. - name: Lint UI
  70. working-directory: src/app
  71. run: |
  72. npm run lint
  73. - name: Run Style Check
  74. run: |
  75. npm run format:check
  76. - name: Check Dependency Versions
  77. run: |
  78. npm exec check-dependency-version-consistency
  79. - name: Check for circular dependencies
  80. run: npx madge $(git ls-files '*.ts') --circular
  81. assets:
  82. name: Generate Assets
  83. timeout-minutes: 5
  84. runs-on: ubuntu-latest
  85. steps:
  86. - name: Checkout repo
  87. uses: actions/checkout@v4
  88. - name: Use Node
  89. uses: actions/setup-node@v4
  90. with:
  91. node-version-file: '.nvmrc'
  92. cache: 'npm'
  93. - name: Install Dependencies
  94. run: npm install
  95. - name: Generate JSON Schema
  96. run: npm run jsonSchema:generate
  97. - name: Check for changes
  98. run: |
  99. if [[ -n $(git status --porcelain) ]]; then
  100. echo "Changes detected after generating assets:"
  101. git status --porcelain
  102. exit 1
  103. else
  104. echo "No changes detected."
  105. fi
  106. python:
  107. name: Check Python
  108. timeout-minutes: 5
  109. runs-on: ubuntu-latest
  110. strategy:
  111. matrix:
  112. python-version: [3.9, 3.12]
  113. steps:
  114. - name: Checkout repo
  115. uses: actions/checkout@v4
  116. - name: Use Python ${{ matrix.python-version }}
  117. uses: actions/setup-python@v5
  118. with:
  119. python-version: ${{ matrix.python-version }}
  120. - name: Install Dependencies
  121. run: |
  122. pip install ruff
  123. - name: Check Formatting
  124. run: |
  125. ruff check --select I --fix
  126. ruff format
  127. git diff --exit-code || (echo "Files were modified by ruff. Please commit these changes." && exit 1)
  128. - name: Run Tests
  129. run: |
  130. python -m unittest discover -s src/python -p '*_test.py'
  131. docs:
  132. name: Build Docs
  133. timeout-minutes: 5
  134. runs-on: ubuntu-latest
  135. steps:
  136. - name: Checkout repo
  137. uses: actions/checkout@v4
  138. - name: Use Node
  139. uses: actions/setup-node@v4
  140. with:
  141. node-version-file: '.nvmrc'
  142. cache: 'npm'
  143. - name: Install Dependencies
  144. working-directory: site
  145. run: npm install
  146. - name: Type Check
  147. working-directory: site
  148. run: npm run typecheck
  149. - name: Build Documentation
  150. working-directory: site
  151. run: npm run build
  152. webui:
  153. name: webui tests
  154. timeout-minutes: 5
  155. runs-on: ubuntu-latest
  156. steps:
  157. - name: Checkout repo
  158. uses: actions/checkout@v4
  159. - name: Use Node
  160. uses: actions/setup-node@v4
  161. with:
  162. node-version-file: '.nvmrc'
  163. cache: 'npm'
  164. - name: Install Dependencies
  165. run: npm ci
  166. - name: Run App Tests
  167. run: npm run test:app
  168. integration-tests:
  169. name: Run Integration Tests
  170. runs-on: ubuntu-latest
  171. timeout-minutes: 5
  172. steps:
  173. - name: Checkout repo
  174. uses: actions/checkout@v4
  175. - name: Use Node
  176. uses: actions/setup-node@v4
  177. with:
  178. node-version-file: '.nvmrc'
  179. cache: 'npm'
  180. - name: Use Python 3.12
  181. uses: actions/setup-python@v5
  182. with:
  183. python-version: 3.12
  184. - name: Install Dependencies
  185. run: |
  186. npm ci
  187. - name: Run Integration Tests
  188. run: npm run test:integration -- --ci --coverage --maxWorkers=2
  189. share-test:
  190. name: Share Test
  191. runs-on: ubuntu-latest
  192. steps:
  193. - name: Checkout repo
  194. uses: actions/checkout@v4
  195. - name: Install Dependencies
  196. run: npm ci
  197. - name: Run local server
  198. run: |
  199. npm run build
  200. PROMPTFOO_CONFIG_DIR=~/tmp LOG_LEVEL=DEBUG API_PORT=8500 node dist/src/server/index.js &
  201. - name: run promptfoo eval
  202. id: eval
  203. run: |
  204. PROMPTFOO_REMOTE_API_BASE_URL=http://localhost:8500 PROMPTFOO_SHARING_APP_BASE_URL=http://localhost:8500 node dist/src/main.js eval -c .github/workflows/files/promptfooconfig.yaml --share
  205. - name: Test that the eval results are uploaded
  206. run: |
  207. response=$(curl -s http://localhost:8500/api/results)
  208. echo "Response: $response"
  209. # Use jq to extract the array length
  210. count=$(echo "$response" | jq '.data | length')
  211. echo "Array Length: $count"
  212. # Check if the count is exactly 1
  213. if [ "$count" -ne 1 ]; then
  214. echo "Error: Expected 1 entry, but got $count"
  215. exit 1
  216. fi
  217. - name: Share to cloud
  218. run: |
  219. if [ -n "${{ secrets.PROMPTFOO_STAGING_API_KEY }}" ]; then
  220. node dist/src/main.js auth login -k ${{ secrets.PROMPTFOO_STAGING_API_KEY }} -h https://api.promptfoo-staging.app
  221. node dist/src/main.js eval -c .github/workflows/files/promptfooconfig.yaml --share
  222. fi
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...