Elffuss BraidHub

kikocis/continue public

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