| 1 | name: PR checks |
| 2 | |
| 3 | # PR Checks run on all PRs to the main branch and must pass before merging. |
| 4 | on: |
| 5 | pull_request: |
| 6 | branches: |
| 7 | - main |
| 8 | |
| 9 | push: |
| 10 | branches: |
| 11 | - main |
| 12 | |
| 13 | jobs: |
| 14 | install-root: |
| 15 | runs-on: ubuntu-latest |
| 16 | steps: |
| 17 | - uses: actions/checkout@v4 |
| 18 | |
| 19 | - uses: actions/setup-node@v4 |
| 20 | with: |
| 21 | node-version-file: ".nvmrc" |
| 22 | |
| 23 | - uses: actions/cache@v4 |
| 24 | id: root-cache |
| 25 | with: |
| 26 | path: node_modules |
| 27 | key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} |
| 28 | |
| 29 | - name: Install root dependencies |
| 30 | if: steps.root-cache.outputs.cache-hit != 'true' |
| 31 | run: npm ci |
| 32 | |
| 33 | prettier-check: |
| 34 | needs: install-root |
| 35 | runs-on: ubuntu-latest |
| 36 | steps: |
| 37 | - uses: actions/checkout@v4 |
| 38 | |
| 39 | - uses: actions/setup-node@v4 |
| 40 | with: |
| 41 | node-version-file: ".nvmrc" |
| 42 | |
| 43 | - uses: actions/cache@v4 |
| 44 | with: |
| 45 | path: node_modules |
| 46 | key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} |
| 47 | |
| 48 | - name: Check code formatting with Prettier |
| 49 | run: npx prettier --check "**/*.{js,jsx,ts,tsx,json,css,md}" --ignore-path .gitignore --ignore-path .prettierignore |
| 50 | |
| 51 | install-config-yaml: |
| 52 | needs: install-root |
| 53 | runs-on: ubuntu-latest |
| 54 | steps: |
| 55 | - uses: actions/checkout@v4 |
| 56 | |
| 57 | - uses: actions/setup-node@v4 |
| 58 | with: |
| 59 | node-version-file: ".nvmrc" |
| 60 | |
| 61 | - uses: actions/cache@v4 |
| 62 | with: |
| 63 | path: node_modules |
| 64 | key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} |
| 65 | |
| 66 | - uses: actions/cache@v4 |
| 67 | id: config-yaml-cache |
| 68 | with: |
| 69 | path: packages/config-yaml/node_modules |
| 70 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 71 | |
| 72 | - name: Install config-yaml dependencies |
| 73 | if: steps.config-yaml-cache.outputs.cache-hit != 'true' |
| 74 | run: | |
| 75 | cd packages/config-yaml |
| 76 | npm ci |
| 77 | |
| 78 | config-yaml-checks: |
| 79 | needs: install-config-yaml |
| 80 | runs-on: ubuntu-latest |
| 81 | steps: |
| 82 | - uses: actions/checkout@v4 |
| 83 | |
| 84 | - uses: actions/setup-node@v4 |
| 85 | with: |
| 86 | node-version-file: ".nvmrc" |
| 87 | |
| 88 | - uses: actions/cache@v4 |
| 89 | with: |
| 90 | path: node_modules |
| 91 | key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} |
| 92 | |
| 93 | - uses: actions/cache@v4 |
| 94 | id: config-yaml-cache |
| 95 | with: |
| 96 | path: packages/config-yaml/node_modules |
| 97 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 98 | |
| 99 | - name: Build and check config-yaml |
| 100 | run: | |
| 101 | cd packages/config-yaml |
| 102 | npx tsc --noEmit |
| 103 | # Tests are currently failing, commenting out for now |
| 104 | # npm test |
| 105 | npm run build |
| 106 | |
| 107 | install-core: |
| 108 | needs: install-root |
| 109 | runs-on: ubuntu-latest |
| 110 | steps: |
| 111 | - uses: actions/checkout@v4 |
| 112 | |
| 113 | - uses: actions/setup-node@v4 |
| 114 | with: |
| 115 | node-version-file: ".nvmrc" |
| 116 | |
| 117 | - uses: actions/cache@v4 |
| 118 | id: root-cache |
| 119 | with: |
| 120 | path: node_modules |
| 121 | key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} |
| 122 | |
| 123 | - uses: actions/cache@v4 |
| 124 | id: core-cache |
| 125 | with: |
| 126 | path: core/node_modules |
| 127 | key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} |
| 128 | |
| 129 | - name: Install core dependencies |
| 130 | if: steps.core-cache.outputs.cache-hit != 'true' |
| 131 | run: | |
| 132 | cd core |
| 133 | npm ci |
| 134 | |
| 135 | core-checks: |
| 136 | needs: [install-core, install-config-yaml] |
| 137 | runs-on: ubuntu-latest |
| 138 | steps: |
| 139 | - uses: actions/checkout@v4 |
| 140 | |
| 141 | - uses: actions/setup-node@v4 |
| 142 | with: |
| 143 | node-version-file: ".nvmrc" |
| 144 | |
| 145 | - uses: actions/cache@v4 |
| 146 | id: root-cache |
| 147 | with: |
| 148 | path: node_modules |
| 149 | key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} |
| 150 | |
| 151 | - uses: actions/cache@v4 |
| 152 | id: core-cache |
| 153 | with: |
| 154 | path: core/node_modules |
| 155 | key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} |
| 156 | |
| 157 | - uses: actions/cache@v4 |
| 158 | id: config-yaml-cache |
| 159 | with: |
| 160 | path: packages/config-yaml/node_modules |
| 161 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 162 | |
| 163 | - name: Build config-yaml |
| 164 | run: | |
| 165 | cd packages/config-yaml |
| 166 | npm run build |
| 167 | |
| 168 | - name: Type check and lint |
| 169 | run: | |
| 170 | cd core |
| 171 | npx tsc --noEmit |
| 172 | npm run lint |
| 173 | env: |
| 174 | OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 175 | |
| 176 | install-gui: |
| 177 | needs: [install-root, install-core, install-config-yaml] |
| 178 | runs-on: ubuntu-latest |
| 179 | steps: |
| 180 | - uses: actions/checkout@v4 |
| 181 | |
| 182 | - uses: actions/setup-node@v4 |
| 183 | with: |
| 184 | node-version-file: ".nvmrc" |
| 185 | |
| 186 | - uses: actions/cache@v4 |
| 187 | with: |
| 188 | path: node_modules |
| 189 | key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} |
| 190 | |
| 191 | - uses: actions/cache@v4 |
| 192 | with: |
| 193 | path: core/node_modules |
| 194 | key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} |
| 195 | |
| 196 | - uses: actions/cache@v4 |
| 197 | id: gui-cache |
| 198 | with: |
| 199 | path: gui/node_modules |
| 200 | key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} |
| 201 | |
| 202 | - uses: actions/cache@v4 |
| 203 | id: config-yaml-cache |
| 204 | with: |
| 205 | path: packages/config-yaml/node_modules |
| 206 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 207 | |
| 208 | - name: Build config-yaml |
| 209 | run: | |
| 210 | cd packages/config-yaml |
| 211 | npm run build |
| 212 | |
| 213 | - name: Install gui dependencies |
| 214 | if: steps.gui-cache.outputs.cache-hit != 'true' |
| 215 | run: | |
| 216 | cd gui |
| 217 | npm ci |
| 218 | |
| 219 | gui-checks: |
| 220 | needs: install-gui |
| 221 | runs-on: ubuntu-latest |
| 222 | steps: |
| 223 | - uses: actions/checkout@v4 |
| 224 | |
| 225 | - uses: actions/setup-node@v4 |
| 226 | with: |
| 227 | node-version-file: ".nvmrc" |
| 228 | |
| 229 | - uses: actions/cache@v4 |
| 230 | with: |
| 231 | path: node_modules |
| 232 | key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} |
| 233 | |
| 234 | - uses: actions/cache@v4 |
| 235 | with: |
| 236 | path: core/node_modules |
| 237 | key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} |
| 238 | |
| 239 | - uses: actions/cache@v4 |
| 240 | id: gui-cache |
| 241 | with: |
| 242 | path: gui/node_modules |
| 243 | key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} |
| 244 | |
| 245 | - uses: actions/cache@v4 |
| 246 | id: config-yaml-cache |
| 247 | with: |
| 248 | path: packages/config-yaml/node_modules |
| 249 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 250 | |
| 251 | - name: Build config-yaml |
| 252 | run: | |
| 253 | cd packages/config-yaml |
| 254 | npm run build |
| 255 | |
| 256 | - name: Type check and lint |
| 257 | run: | |
| 258 | cd gui |
| 259 | npx tsc --noEmit |
| 260 | npm run lint |
| 261 | |
| 262 | binary-checks: |
| 263 | needs: [install-root, install-core, install-config-yaml] |
| 264 | runs-on: ubuntu-latest |
| 265 | steps: |
| 266 | - uses: actions/checkout@v4 |
| 267 | |
| 268 | - uses: actions/setup-node@v4 |
| 269 | with: |
| 270 | node-version-file: ".nvmrc" |
| 271 | |
| 272 | - uses: actions/cache@v4 |
| 273 | with: |
| 274 | path: node_modules |
| 275 | key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} |
| 276 | |
| 277 | - uses: actions/cache@v4 |
| 278 | with: |
| 279 | path: core/node_modules |
| 280 | key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} |
| 281 | |
| 282 | - uses: actions/cache@v4 |
| 283 | id: binary-cache |
| 284 | with: |
| 285 | path: binary/node_modules |
| 286 | key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }} |
| 287 | |
| 288 | - uses: actions/cache@v4 |
| 289 | id: config-yaml-cache |
| 290 | with: |
| 291 | path: packages/config-yaml/node_modules |
| 292 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 293 | |
| 294 | - name: Build config-yaml |
| 295 | run: | |
| 296 | cd packages/config-yaml |
| 297 | npm run build |
| 298 | |
| 299 | - name: Install binary dependencies |
| 300 | if: steps.binary-cache.outputs.cache-hit != 'true' |
| 301 | run: | |
| 302 | cd binary |
| 303 | npm ci |
| 304 | |
| 305 | - name: Type check |
| 306 | run: | |
| 307 | cd binary |
| 308 | npx tsc --noEmit |
| 309 | |
| 310 | install-vscode: |
| 311 | needs: [install-root, install-core, install-config-yaml] |
| 312 | runs-on: ubuntu-latest |
| 313 | steps: |
| 314 | - uses: actions/checkout@v4 |
| 315 | |
| 316 | - uses: actions/setup-node@v4 |
| 317 | with: |
| 318 | node-version-file: ".nvmrc" |
| 319 | |
| 320 | - uses: actions/cache@v4 |
| 321 | with: |
| 322 | path: node_modules |
| 323 | key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} |
| 324 | |
| 325 | - uses: actions/cache@v4 |
| 326 | with: |
| 327 | path: core/node_modules |
| 328 | key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} |
| 329 | |
| 330 | - uses: actions/cache@v4 |
| 331 | id: vscode-cache |
| 332 | with: |
| 333 | path: extensions/vscode/node_modules |
| 334 | key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} |
| 335 | |
| 336 | - uses: actions/cache@v4 |
| 337 | id: config-yaml-cache |
| 338 | with: |
| 339 | path: packages/config-yaml/node_modules |
| 340 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 341 | |
| 342 | - name: Build config-yaml |
| 343 | run: | |
| 344 | cd packages/config-yaml |
| 345 | npm run build |
| 346 | |
| 347 | - name: Install vscode dependencies |
| 348 | if: steps.vscode-cache.outputs.cache-hit != 'true' |
| 349 | run: | |
| 350 | cd extensions/vscode |
| 351 | npm ci |
| 352 | env: |
| 353 | GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} |
| 354 | |
| 355 | vscode-checks: |
| 356 | needs: install-vscode |
| 357 | runs-on: ubuntu-latest |
| 358 | steps: |
| 359 | - uses: actions/checkout@v4 |
| 360 | |
| 361 | - uses: actions/setup-node@v4 |
| 362 | with: |
| 363 | node-version-file: ".nvmrc" |
| 364 | |
| 365 | - uses: actions/cache@v4 |
| 366 | with: |
| 367 | path: node_modules |
| 368 | key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} |
| 369 | |
| 370 | - uses: actions/cache@v4 |
| 371 | with: |
| 372 | path: core/node_modules |
| 373 | key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} |
| 374 | |
| 375 | - uses: actions/cache@v4 |
| 376 | id: vscode-cache |
| 377 | with: |
| 378 | path: extensions/vscode/node_modules |
| 379 | key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} |
| 380 | |
| 381 | - uses: actions/cache@v4 |
| 382 | id: config-yaml-cache |
| 383 | with: |
| 384 | path: packages/config-yaml/node_modules |
| 385 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 386 | |
| 387 | - name: Build config-yaml |
| 388 | run: | |
| 389 | cd packages/config-yaml |
| 390 | npm run build |
| 391 | |
| 392 | - name: Type check and lint |
| 393 | run: | |
| 394 | cd extensions/vscode |
| 395 | npm run write-build-timestamp |
| 396 | npx tsc --noEmit |
| 397 | npm run lint |
| 398 | |
| 399 | - name: Run vitest tests |
| 400 | run: | |
| 401 | cd extensions/vscode |
| 402 | npm run vitest |
| 403 | |
| 404 | core-tests: |
| 405 | needs: [install-core, install-config-yaml] |
| 406 | runs-on: ubuntu-latest |
| 407 | steps: |
| 408 | - uses: actions/checkout@v4 |
| 409 | |
| 410 | - uses: actions/setup-node@v4 |
| 411 | with: |
| 412 | node-version-file: ".nvmrc" |
| 413 | |
| 414 | - uses: actions/cache@v4 |
| 415 | with: |
| 416 | path: core/node_modules |
| 417 | key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} |
| 418 | |
| 419 | - uses: actions/cache@v4 |
| 420 | id: config-yaml-cache |
| 421 | with: |
| 422 | path: packages/config-yaml/node_modules |
| 423 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 424 | |
| 425 | - name: Build config-yaml |
| 426 | run: | |
| 427 | cd packages/config-yaml |
| 428 | npm run build |
| 429 | |
| 430 | - name: Run core tests |
| 431 | run: | |
| 432 | cd core |
| 433 | npm test |
| 434 | npm run vitest |
| 435 | env: |
| 436 | IGNORE_API_KEY_TESTS: ${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }} |
| 437 | OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 438 | ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} |
| 439 | GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} |
| 440 | MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} |
| 441 | AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} |
| 442 | AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }} |
| 443 | AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }} |
| 444 | AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }} |
| 445 | |
| 446 | package-tests: |
| 447 | runs-on: ubuntu-latest |
| 448 | steps: |
| 449 | - uses: actions/checkout@v4 |
| 450 | |
| 451 | - uses: actions/setup-node@v4 |
| 452 | with: |
| 453 | node-version-file: ".nvmrc" |
| 454 | |
| 455 | - uses: actions/cache@v4 |
| 456 | with: |
| 457 | path: core/node_modules |
| 458 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 459 | |
| 460 | - name: Install dependencies |
| 461 | run: | |
| 462 | cd packages/config-yaml |
| 463 | npm ci |
| 464 | |
| 465 | - name: Run config-yaml tests |
| 466 | run: | |
| 467 | cd packages/config-yaml |
| 468 | npm test |
| 469 | |
| 470 | vscode-get-test-file-matrix: |
| 471 | runs-on: ubuntu-latest |
| 472 | needs: [install-root, install-vscode, install-config-yaml] |
| 473 | outputs: |
| 474 | test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }} |
| 475 | steps: |
| 476 | - uses: actions/checkout@v4 |
| 477 | |
| 478 | - name: Cache node modules |
| 479 | uses: actions/cache@v3 |
| 480 | with: |
| 481 | path: extensions/vscode/node_modules |
| 482 | key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} |
| 483 | |
| 484 | - uses: actions/cache@v4 |
| 485 | id: config-yaml-cache |
| 486 | with: |
| 487 | path: packages/config-yaml/node_modules |
| 488 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 489 | |
| 490 | - name: Build config-yaml |
| 491 | run: | |
| 492 | cd packages/config-yaml |
| 493 | npm run build |
| 494 | |
| 495 | - name: Get test files |
| 496 | id: vscode-get-test-file-matrix |
| 497 | run: | |
| 498 | cd extensions/vscode |
| 499 | npm ci |
| 500 | npm run e2e:compile |
| 501 | if [[ "${{ github.event.pull_request.head.repo.fork }}" == "true" || "${{ github.actor }}" == "dependabot[bot]" ]]; then |
| 502 | # Exclude SSH tests for forks |
| 503 | FILES=$(ls -1 e2e/_output/tests/*.test.js | grep -v "SSH" | jq -R . | jq -s .) |
| 504 | else |
| 505 | # Include all tests for non-forks |
| 506 | FILES=$(ls -1 e2e/_output/tests/*.test.js | jq -R . | jq -s .) |
| 507 | fi |
| 508 | echo "test_file_matrix<<EOF" >> $GITHUB_OUTPUT |
| 509 | echo "$FILES" >> $GITHUB_OUTPUT |
| 510 | echo "EOF" >> $GITHUB_OUTPUT |
| 511 | |
| 512 | - name: Debug Outputs |
| 513 | run: | |
| 514 | echo "Test files: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}" |
| 515 | |
| 516 | vscode-package-extension: |
| 517 | runs-on: ubuntu-latest |
| 518 | needs: [install-vscode, install-core, install-config-yaml] |
| 519 | steps: |
| 520 | - uses: actions/checkout@v4 |
| 521 | |
| 522 | - uses: actions/setup-node@v4 |
| 523 | with: |
| 524 | node-version-file: ".nvmrc" |
| 525 | |
| 526 | - uses: actions/cache@v4 |
| 527 | id: vscode-node-modules-cache |
| 528 | with: |
| 529 | path: extensions/vscode/node_modules |
| 530 | key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} |
| 531 | |
| 532 | - uses: actions/cache@v4 |
| 533 | id: core-node-modules-cache |
| 534 | with: |
| 535 | path: core/node_modules |
| 536 | key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} |
| 537 | |
| 538 | - uses: actions/cache@v4 |
| 539 | id: config-yaml-cache |
| 540 | with: |
| 541 | path: packages/config-yaml/node_modules |
| 542 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 543 | |
| 544 | - name: Build config-yaml |
| 545 | run: | |
| 546 | cd packages/config-yaml |
| 547 | npm run build |
| 548 | |
| 549 | - name: Package extension |
| 550 | run: | |
| 551 | cd extensions/vscode |
| 552 | npm run package |
| 553 | |
| 554 | - name: Upload build artifact |
| 555 | uses: actions/upload-artifact@v4 |
| 556 | with: |
| 557 | name: vscode-extension-build |
| 558 | path: extensions/vscode/build |
| 559 | |
| 560 | vscode-download-e2e-dependencies: |
| 561 | runs-on: ubuntu-latest |
| 562 | needs: [install-vscode, install-core, install-config-yaml] |
| 563 | steps: |
| 564 | - uses: actions/checkout@v4 |
| 565 | |
| 566 | - uses: actions/setup-node@v4 |
| 567 | with: |
| 568 | node-version-file: ".nvmrc" |
| 569 | |
| 570 | - uses: actions/cache@v4 |
| 571 | id: vscode-node-modules-cache |
| 572 | with: |
| 573 | path: extensions/vscode/node_modules |
| 574 | key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} |
| 575 | |
| 576 | - uses: actions/cache@v4 |
| 577 | id: storage-cache |
| 578 | with: |
| 579 | path: extensions/vscode/e2e/storage |
| 580 | key: ${{ runner.os }}-vscode-storage-${{ hashFiles('extensions/vscode/package-lock.json') }} |
| 581 | |
| 582 | - uses: actions/cache@v4 |
| 583 | id: config-yaml-cache |
| 584 | with: |
| 585 | path: packages/config-yaml/node_modules |
| 586 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 587 | |
| 588 | - name: Build config-yaml |
| 589 | run: | |
| 590 | cd packages/config-yaml |
| 591 | npm run build |
| 592 | |
| 593 | - name: Download Dependencies |
| 594 | if: steps.storage-cache.outputs.cache-hit != 'true' |
| 595 | run: | |
| 596 | cd extensions/vscode |
| 597 | npm run e2e:ci:download |
| 598 | |
| 599 | - name: Upload e2e dependencies |
| 600 | uses: actions/upload-artifact@v4 |
| 601 | with: |
| 602 | name: vscode-e2e-dependencies |
| 603 | path: extensions/vscode/e2e/storage |
| 604 | |
| 605 | vscode-e2e-tests: |
| 606 | name: ${{ matrix.test_file || 'unknown' }} (${{ matrix.command }}) |
| 607 | needs: |
| 608 | [ |
| 609 | vscode-download-e2e-dependencies, |
| 610 | vscode-get-test-file-matrix, |
| 611 | vscode-package-extension, |
| 612 | install-vscode, |
| 613 | install-core, |
| 614 | install-config-yaml, |
| 615 | ] |
| 616 | runs-on: ubuntu-latest |
| 617 | # Tests requiring secrets need approval from maintainers |
| 618 | strategy: |
| 619 | fail-fast: false |
| 620 | matrix: |
| 621 | test_file: ${{ fromJson(needs.vscode-get-test-file-matrix.outputs.test_file_matrix) }} |
| 622 | command: ["e2e:ci:run", "e2e:ci:run-yaml"] |
| 623 | steps: |
| 624 | - uses: actions/checkout@v4 |
| 625 | |
| 626 | - uses: actions/setup-node@v4 |
| 627 | with: |
| 628 | node-version-file: ".nvmrc" |
| 629 | |
| 630 | - uses: actions/cache@v4 |
| 631 | id: vscode-node-modules-cache |
| 632 | with: |
| 633 | path: extensions/vscode/node_modules |
| 634 | key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} |
| 635 | |
| 636 | # We don't want to cache the Continue extension, so it is deleted at the end of the job |
| 637 | - uses: actions/cache@v4 |
| 638 | id: test-extensions-cache |
| 639 | with: |
| 640 | path: extensions/vscode/e2e/.test-extensions |
| 641 | key: CONSTANT |
| 642 | |
| 643 | - name: Download build artifact |
| 644 | uses: actions/download-artifact@v4 |
| 645 | with: |
| 646 | name: vscode-extension-build |
| 647 | path: extensions/vscode/build |
| 648 | |
| 649 | - name: Download e2e dependencies |
| 650 | uses: actions/download-artifact@v4 |
| 651 | with: |
| 652 | name: vscode-e2e-dependencies |
| 653 | path: extensions/vscode/e2e/storage |
| 654 | |
| 655 | - uses: actions/cache@v4 |
| 656 | id: config-yaml-cache |
| 657 | with: |
| 658 | path: packages/config-yaml/node_modules |
| 659 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 660 | |
| 661 | - name: Build config-yaml |
| 662 | run: | |
| 663 | cd packages/config-yaml |
| 664 | npm run build |
| 665 | |
| 666 | - name: Fix VSCode binary permissions |
| 667 | run: | |
| 668 | chmod +x extensions/vscode/e2e/storage/VSCode-linux-x64/code |
| 669 | chmod +x extensions/vscode/e2e/storage/chromedriver-linux64/chromedriver |
| 670 | |
| 671 | - name: Set up SSH |
| 672 | env: |
| 673 | SSH_KEY: ${{ secrets.GH_ACTIONS_SSH_TEST_KEY_PEM }} |
| 674 | SSH_HOST: ${{ secrets.GH_ACTIONS_SSH_TEST_DNS_NAME }} |
| 675 | run: | |
| 676 | mkdir -p ~/.ssh |
| 677 | echo "$SSH_KEY" > ~/.ssh/id_rsa |
| 678 | chmod 600 ~/.ssh/id_rsa |
| 679 | ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts |
| 680 | echo -e "Host ssh-test-container\n\tHostName $SSH_HOST\n\tUser ec2-user\n\tIdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config |
| 681 | if: ${{ github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' }} |
| 682 | |
| 683 | - name: Set up Xvfb |
| 684 | run: | |
| 685 | Xvfb :99 & |
| 686 | export DISPLAY=:99 |
| 687 | |
| 688 | - name: Run e2e tests |
| 689 | run: | |
| 690 | cd extensions/vscode |
| 691 | IGNORE_SSH_TESTS="${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }}" TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }} |
| 692 | env: |
| 693 | DISPLAY: :99 |
| 694 | |
| 695 | - name: Delete continue from test extensions |
| 696 | run: | |
| 697 | cd extensions/vscode |
| 698 | rm -rf e2e/.test-extensions/continue* |
| 699 | |
| 700 | - name: Sanitize test file name |
| 701 | id: sanitize_filename |
| 702 | if: always() |
| 703 | run: | |
| 704 | FILENAME="${{ matrix.test_file }}" |
| 705 | SANITIZED_FILENAME="${FILENAME//\//-}" # Replace / with - using bash parameter expansion |
| 706 | echo "sanitized_test_file=${SANITIZED_FILENAME}" >> $GITHUB_OUTPUT |
| 707 | |
| 708 | - name: Upload e2e test screenshots |
| 709 | if: failure() |
| 710 | uses: actions/upload-artifact@v4 |
| 711 | with: |
| 712 | name: e2e-failure-screenshots-${{ steps.sanitize_filename.outputs.sanitized_test_file || 'unknown' }}-${{ matrix.command == 'e2e:ci:run-yaml' && 'yaml' || 'json' }} |
| 713 | path: extensions/vscode/e2e/storage/screenshots |
| 714 | |
| 715 | - name: Find e2e log file |
| 716 | if: always() |
| 717 | run: | |
| 718 | echo "Searching for e2e.log file..." |
| 719 | find $GITHUB_WORKSPACE -name "e2e.log" -type f |
| 720 | |
| 721 | - name: Upload e2e logs |
| 722 | if: always() |
| 723 | uses: actions/upload-artifact@v4 |
| 724 | with: |
| 725 | name: e2e-logs-${{ steps.sanitize_filename.outputs.sanitized_test_file || 'unknown' }}-${{ matrix.command == 'e2e:ci:run-yaml' && 'yaml' || 'json' }} |
| 726 | path: extensions/vscode/e2e.log |
| 727 | |
| 728 | gui-tests: |
| 729 | needs: [install-gui, install-core, install-config-yaml] |
| 730 | runs-on: ubuntu-latest |
| 731 | steps: |
| 732 | - uses: actions/checkout@v4 |
| 733 | |
| 734 | - uses: actions/setup-node@v4 |
| 735 | with: |
| 736 | node-version-file: ".nvmrc" |
| 737 | |
| 738 | - uses: actions/cache@v4 |
| 739 | id: gui-cache |
| 740 | with: |
| 741 | path: gui/node_modules |
| 742 | key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} |
| 743 | |
| 744 | - uses: actions/cache@v4 |
| 745 | with: |
| 746 | path: core/node_modules |
| 747 | key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} |
| 748 | |
| 749 | - uses: actions/cache@v4 |
| 750 | id: config-yaml-cache |
| 751 | with: |
| 752 | path: packages/config-yaml/node_modules |
| 753 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 754 | |
| 755 | - name: Build config-yaml |
| 756 | run: | |
| 757 | cd packages/config-yaml |
| 758 | npm run build |
| 759 | |
| 760 | - name: Install GUI dependencies |
| 761 | if: steps.gui-cache.outputs.cache-hit != 'true' |
| 762 | run: cd gui && npm ci |
| 763 | env: |
| 764 | GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} |
| 765 | |
| 766 | - name: Run gui tests |
| 767 | run: | |
| 768 | cd gui |
| 769 | npm test |
| 770 | |
| 771 | jetbrains-tests: |
| 772 | needs: [install-root, core-checks, install-config-yaml] |
| 773 | runs-on: ubuntu-latest |
| 774 | steps: |
| 775 | - uses: actions/checkout@v4 |
| 776 | - uses: actions/cache@v4 |
| 777 | with: |
| 778 | path: core/node_modules |
| 779 | key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} |
| 780 | |
| 781 | - uses: actions/cache@v4 |
| 782 | id: config-yaml-cache |
| 783 | with: |
| 784 | path: packages/config-yaml/node_modules |
| 785 | key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} |
| 786 | |
| 787 | - name: Build config-yaml |
| 788 | run: | |
| 789 | cd packages/config-yaml |
| 790 | npm run build |
| 791 | |
| 792 | - name: Setup Java |
| 793 | uses: actions/setup-java@v4.5.0 |
| 794 | with: |
| 795 | distribution: zulu |
| 796 | java-version: 17 |
| 797 | |
| 798 | - name: Setup FFmpeg |
| 799 | uses: AnimMouse/setup-ffmpeg@v1 |
| 800 | with: |
| 801 | token: ${{ secrets.GITHUB_TOKEN }} |
| 802 | |
| 803 | - name: Setup Gradle |
| 804 | uses: gradle/actions/setup-gradle@v3 |
| 805 | |
| 806 | - name: Use Node.js from .nvmrc |
| 807 | uses: actions/setup-node@v4 |
| 808 | with: |
| 809 | node-version-file: ".nvmrc" |
| 810 | |
| 811 | - uses: actions/cache@v4 |
| 812 | id: gui-cache |
| 813 | with: |
| 814 | path: gui/node_modules |
| 815 | key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} |
| 816 | |
| 817 | # We can shave off another minute off our CI script by finding a way to share this with vscode-tests |
| 818 | - name: Run prepackage script |
| 819 | run: | |
| 820 | cd extensions/vscode |
| 821 | npm ci |
| 822 | npm run prepackage |
| 823 | env: |
| 824 | # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 |
| 825 | GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} |
| 826 | |
| 827 | - uses: actions/cache@v4 |
| 828 | id: binary-cache |
| 829 | with: |
| 830 | path: binary/node_modules |
| 831 | key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }} |
| 832 | |
| 833 | - name: Build the binaries |
| 834 | run: | |
| 835 | cd binary |
| 836 | npm run build |
| 837 | |
| 838 | - name: Start test IDE |
| 839 | run: | |
| 840 | cd extensions/intellij |
| 841 | export DISPLAY=:99.0 |
| 842 | Xvfb -ac :99 -screen 0 1920x1080x24 & |
| 843 | sleep 10 |
| 844 | mkdir -p build/reports |
| 845 | ./gradlew runIdeForUiTests & |
| 846 | |
| 847 | - name: Wait for JB connection |
| 848 | uses: jtalk/url-health-check-action@v3 |
| 849 | with: |
| 850 | url: http://127.0.0.1:8082 |
| 851 | max-attempts: 15 |
| 852 | retry-delay: 30s |
| 853 | |
| 854 | - name: Run tests |
| 855 | run: | |
| 856 | cd extensions/intellij |
| 857 | export DISPLAY=:99.0 |
| 858 | ./gradlew test |
| 859 | |
| 860 | - name: Move video |
| 861 | if: ${{ failure() }} |
| 862 | run: | |
| 863 | cd extensions/intellij |
| 864 | mv video build/reports |
| 865 | |
| 866 | - name: Copy logs |
| 867 | if: ${{ failure() }} |
| 868 | run: | |
| 869 | cd extensions/intellij |
| 870 | mv build/idea-sandbox/system/log/ build/reports |
| 871 | |
| 872 | - name: Save fails report |
| 873 | if: ${{ failure() }} |
| 874 | uses: actions/upload-artifact@v4 |
| 875 | with: |
| 876 | name: jb-failure-report |
| 877 | path: | |
| 878 | ${{ github.workspace }}/extensions/intellij/build/reports |
| 879 | |
| 880 | # GitHub does not have a way of requiring that all checks pass (you must manually select each job) |
| 881 | # This action at least lets us manage the list of required tests via source control |
| 882 | # so that creators of new jobs can add them to this list |
| 883 | require-all-checks-to-pass: |
| 884 | if: always() |
| 885 | runs-on: ubuntu-latest |
| 886 | needs: |
| 887 | - install-root |
| 888 | - prettier-check |
| 889 | - install-core |
| 890 | - core-checks |
| 891 | - install-gui |
| 892 | - gui-checks |
| 893 | - binary-checks |
| 894 | - install-vscode |
| 895 | - vscode-checks |
| 896 | - core-tests |
| 897 | - package-tests |
| 898 | - vscode-get-test-file-matrix |
| 899 | - vscode-package-extension |
| 900 | - vscode-download-e2e-dependencies |
| 901 | - vscode-e2e-tests |
| 902 | - gui-tests |
| 903 | - jetbrains-tests |
| 904 | - config-yaml-checks |
| 905 | - install-config-yaml |
| 906 | |
| 907 | steps: |
| 908 | - name: Decide whether the needed jobs succeeded or failed |
| 909 | uses: re-actors/alls-green@release/v1 |
| 910 | with: |
| 911 | jobs: ${{ toJSON(needs) }} |