Elffuss BraidHub

kikocis/continue public

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