Elffuss BraidHub

kikocis/continue public

main · 11.8 KiBRawPermalink
1name: PR Checks
2
3# PR Checks run on all PRs to the main branch and must pass before merging.
4on:
5 pull_request:
6 branches:
7 - main
8
9 push:
10 branches:
11 - main
12
13jobs:
14 track-rerun:
15 runs-on: ubuntu-latest
16 if: github.run_attempt > 1
17 steps:
18 - uses: actions/checkout@v5
19 - name: Track workflow rerun
20 uses: ./.github/actions/track-rerun
21
22 prettier-check:
23 runs-on: ubuntu-latest
24 steps:
25 - uses: actions/checkout@v5
26 - uses: actions/setup-node@v5
27 with:
28 node-version-file: ".nvmrc"
29
30 - uses: actions/cache@v4
31 id: root-cache
32 with:
33 path: node_modules
34 key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }}
35
36 - name: Install root dependencies
37 if: steps.root-cache.outputs.cache-hit != 'true'
38 run: npm ci
39
40 - name: Check code formatting with Prettier
41 run: npx prettier --check "**/*.{js,jsx,ts,tsx,json,css,md}" --ignore-path .gitignore --ignore-path .prettierignore
42
43 core-checks:
44 runs-on: ubuntu-latest
45 steps:
46 - uses: actions/checkout@v5
47 with:
48 fetch-depth: 0 # Needed for git diff to work
49 - name: Setup packages
50 uses: ./.github/actions/setup-packages
51 - name: Setup core component
52 uses: ./.github/actions/setup-component
53 with:
54 component: core
55 include-root: true
56
57 - name: Check if LLM-related files changed
58 id: llm-changes
59 uses: ./.github/actions/check-llm-changes
60 with:
61 is_fork: ${{ github.event.pull_request.head.repo.fork == true }}
62 is_dependabot: ${{ github.actor == 'dependabot[bot]' }}
63
64 - name: Type check and lint
65 run: |
66 cd core
67 npx tsc --noEmit
68 npm run lint
69 env:
70 OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
71
72 - name: Run tests
73 run: |
74 cd core
75 npm test
76 npm run vitest
77 env:
78 IGNORE_API_KEY_TESTS: ${{ steps.llm-changes.outputs.ignore_api_tests }}
79 OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
80 ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
81 GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
82 MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
83 AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
84 AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }}
85 AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }}
86 AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }}
87 VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
88 RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }}
89 INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }}
90
91 gui-checks:
92 runs-on: ubuntu-latest
93 steps:
94 - uses: actions/checkout@v5
95 - name: Setup packages
96 uses: ./.github/actions/setup-packages
97 - name: Setup core component
98 uses: ./.github/actions/setup-component
99 with:
100 component: core
101 include-root: true
102 - name: Setup gui component
103 uses: ./.github/actions/setup-component
104 with:
105 component: gui
106 include-packages: false
107 env:
108 GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
109
110 - name: Type check and lint
111 run: |
112 cd gui
113 npx tsc --noEmit
114 npm run lint
115
116 - name: Run tests
117 run: |
118 cd gui
119 npm test
120
121 binary-checks:
122 runs-on: ubuntu-latest
123 steps:
124 - uses: actions/checkout@v5
125 - name: Setup packages
126 uses: ./.github/actions/setup-packages
127 - name: Setup core component
128 uses: ./.github/actions/setup-component
129 with:
130 component: core
131 include-root: true
132 - name: Setup binary component
133 uses: ./.github/actions/setup-component
134 with:
135 component: binary
136 include-packages: false
137
138 - name: Type check
139 run: |
140 cd binary
141 npx tsc --noEmit
142
143 vscode-checks:
144 runs-on: ubuntu-latest
145 steps:
146 - uses: actions/checkout@v5
147 - name: Setup packages
148 uses: ./.github/actions/setup-packages
149 - name: Setup core component
150 uses: ./.github/actions/setup-component
151 with:
152 component: core
153 include-root: true
154 - name: Setup vscode component
155 uses: ./.github/actions/setup-component
156 with:
157 component: vscode
158 include-packages: false
159 env:
160 GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
161
162 - name: Type check and lint
163 run: |
164 cd extensions/vscode
165 npm run write-build-timestamp
166 npx tsc --noEmit
167 npm run lint
168
169 - name: Run vitest tests
170 run: |
171 cd extensions/vscode
172 npm run vitest
173
174 get-packages-matrix:
175 runs-on: ubuntu-latest
176 outputs:
177 packages: ${{ steps.get-packages.outputs.packages }}
178 steps:
179 - uses: actions/checkout@v5
180 - name: Get package list
181 id: get-packages
182 run: |
183 packages=$(find packages/ -maxdepth 1 -type d -not -path packages/ -exec basename {} \; | sort | jq -R -s -c 'split("\n")[:-1]')
184 echo "packages=$packages" >> $GITHUB_OUTPUT
185 echo "Found packages: $packages"
186
187 packages-checks:
188 needs: get-packages-matrix
189 runs-on: ubuntu-latest
190 strategy:
191 matrix:
192 package: ${{ fromJson(needs.get-packages-matrix.outputs.packages) }}
193 steps:
194 - uses: actions/checkout@v5
195 with:
196 fetch-depth: 0 # Needed for git diff to work
197 - name: Setup packages
198 uses: ./.github/actions/setup-packages
199
200 - name: Check if LLM-related files changed
201 id: llm-changes
202 uses: ./.github/actions/check-llm-changes
203 with:
204 is_fork: ${{ github.event.pull_request.head.repo.fork == true }}
205 is_dependabot: ${{ github.actor == 'dependabot[bot]' }}
206
207 - name: Test and check ${{ matrix.package }}
208 run: |
209 cd packages/${{ matrix.package }}
210 npm ci
211 npm test
212 env:
213 IGNORE_API_KEY_TESTS: ${{ steps.llm-changes.outputs.ignore_api_tests }}
214 OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
215 ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
216 GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
217 MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
218 AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
219 AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }}
220 AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }}
221 AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }}
222 VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
223 RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }}
224 INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }}
225
226 vscode-get-test-file-matrix:
227 runs-on: ubuntu-latest
228 outputs:
229 test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}
230 steps:
231 - uses: actions/checkout@v5
232 - uses: actions/setup-node@v5
233 with:
234 node-version-file: ".nvmrc"
235
236 - name: Cache npm
237 uses: actions/cache@v4
238 with:
239 path: ~/.npm
240 key: ${{ runner.os }}-npm-cache-matrix-${{ hashFiles('core/package-lock.json', 'extensions/vscode/package-lock.json') }}
241
242 - name: Cache packages node_modules
243 uses: actions/cache@v4
244 with:
245 path: |
246 packages/*/node_modules
247 key: ${{ runner.os }}-packages-node-modules-${{ hashFiles('packages/*/package-lock.json') }}
248
249 - name: Cache core node modules
250 uses: actions/cache@v4
251 with:
252 path: core/node_modules
253 key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
254
255 - name: Cache vscode extension node modules
256 uses: actions/cache@v4
257 id: vscode-cache
258 with:
259 path: extensions/vscode/node_modules
260 key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }}
261
262 - name: Build packages and get test files
263 id: vscode-get-test-file-matrix
264 run: |
265 node ./scripts/build-packages.js
266 cd extensions/vscode
267 npm ci
268 npm run e2e:compile
269 if [[ "${{ github.event.pull_request.head.repo.fork }}" == "true" || "${{ github.actor }}" == "dependabot[bot]" ]]; then
270 # Exclude SSH tests for forks
271 FILES=$(ls -1 e2e/_output/tests/*.test.js | grep -v "SSH" | jq -R . | jq -s .)
272 else
273 # Include all tests for non-forks
274 FILES=$(ls -1 e2e/_output/tests/*.test.js | jq -R . | jq -s .)
275 fi
276 echo "test_file_matrix<<EOF" >> $GITHUB_OUTPUT
277 echo "$FILES" >> $GITHUB_OUTPUT
278 echo "EOF" >> $GITHUB_OUTPUT
279 env:
280 # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333
281 GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
282
283 - name: Debug Outputs
284 run: |
285 echo "Test files: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}"
286
287 vscode-package-extension-linux:
288 runs-on: ubuntu-latest
289 timeout-minutes: 15
290 steps:
291 - uses: actions/checkout@v5
292 with:
293 fetch-depth: 0
294
295 - name: Build VS Code extension
296 uses: ./.github/actions/build-vscode-extension
297 with:
298 platform: linux
299 arch: x64
300 npm_config_arch: x64
301 pre-release: false
302 commit-sha: ${{ github.sha }}
303 github-token: ${{ secrets.GITHUB_TOKEN }}
304
305 - name: Upload build artifact
306 uses: actions/upload-artifact@v4
307 with:
308 name: vscode-extension-build-Linux
309 path: extensions/vscode/build
310
311 vscode-e2e-tests:
312 name: ${{ matrix.test_file || 'unknown' }} (${{ matrix.command }})
313 needs: [vscode-get-test-file-matrix, vscode-package-extension-linux]
314 runs-on: ubuntu-latest
315 timeout-minutes: 15
316 # Tests requiring secrets need approval from maintainers
317 strategy:
318 fail-fast: false
319 matrix:
320 test_file: ${{ fromJson(needs.vscode-get-test-file-matrix.outputs.test_file_matrix) }}
321 command: ["e2e:ci:run", "e2e:ci:run-yaml"]
322 steps:
323 - uses: actions/checkout@v5
324 - name: Run VS Code E2E test
325 uses: ./.github/actions/run-vscode-e2e-test
326 with:
327 test_file: ${{ matrix.test_file }}
328 command: ${{ matrix.command }}
329 ssh_key: ${{ secrets.GH_ACTIONS_SSH_TEST_KEY_PEM }}
330 ssh_host: ${{ secrets.GH_ACTIONS_SSH_TEST_DNS_NAME }}
331 is_fork: ${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }}
332
333 jetbrains-tests:
334 runs-on: ubuntu-latest
335 timeout-minutes: 15
336 steps:
337 - uses: actions/checkout@v5
338 - name: Run JetBrains tests
339 uses: ./.github/actions/run-jetbrains-tests
340 with:
341 github-token: ${{ secrets.GITHUB_TOKEN }}
342 ci-github-token: ${{ secrets.CI_GITHUB_TOKEN }}
343
344 # GitHub does not have a way of requiring that all checks pass (you must manually select each job)
345 # This action at least lets us manage the list of required tests via source control
346
347 # so that creators of new jobs can add them to this list
348 require-all-checks-to-pass:
349 if: always()
350 runs-on: ubuntu-latest
351 needs:
352 - prettier-check
353 - core-checks
354 - gui-checks
355 - binary-checks
356 - vscode-checks
357 - get-packages-matrix
358 - packages-checks
359 - vscode-get-test-file-matrix
360 - vscode-package-extension-linux
361 - vscode-e2e-tests
362 - jetbrains-tests
363
364 steps:
365 - name: Decide whether the needed jobs succeeded or failed
366 uses: re-actors/alls-green@release/v1
367 with:
368 jobs: ${{ toJSON(needs) }}