Elffuss BraidHub

kikocis/continue public

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