e2e.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. name: E2E Tests
  2. on:
  3. push:
  4. branches:
  5. - main
  6. pull_request:
  7. types: [opened, reopened, synchronize, ready_for_review]
  8. workflow_dispatch:
  9. concurrency:
  10. group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  11. cancel-in-progress: true
  12. jobs:
  13. matrix_prep:
  14. runs-on: ubuntu-latest
  15. outputs:
  16. matrix: ${{ steps.set-matrix.outputs.matrix }}
  17. steps:
  18. - id: set-matrix
  19. run: |
  20. echo 'matrix=[{"runner":"ubuntu"},{"runner":"windows"},{"runner":"macos"}]' >> $GITHUB_OUTPUT
  21. e2e:
  22. needs: matrix_prep
  23. strategy:
  24. fail-fast: false
  25. matrix:
  26. include: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
  27. runs-on: ${{ matrix.runner }}-latest
  28. timeout-minutes: 20
  29. permissions:
  30. id-token: write
  31. contents: read
  32. steps:
  33. - uses: actions/checkout@v4
  34. - name: Setup Node.js environment
  35. uses: actions/setup-node@v4
  36. with:
  37. node-version: 22
  38. # Cache root dependencies - only reuse if package-lock.json exactly matches
  39. - name: Cache root dependencies
  40. uses: actions/cache@v4
  41. id: root-cache
  42. with:
  43. path: node_modules
  44. key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
  45. # Cache webview-ui dependencies - only reuse if package-lock.json exactly matches
  46. - name: Cache webview-ui dependencies
  47. uses: actions/cache@v4
  48. id: webview-cache
  49. with:
  50. path: webview-ui/node_modules
  51. key: ${{ runner.os }}-npm-webview-${{ hashFiles('webview-ui/package-lock.json') }}
  52. # Cache VS Code installation
  53. - name: Cache VS Code
  54. uses: actions/cache@v4
  55. id: vscode-cache
  56. with:
  57. path: .vscode-test
  58. key: vscode-${{ runner.os }}-stable-${{ hashFiles('.vscode-test.mjs', 'package.json') }}
  59. restore-keys: |
  60. vscode-${{ runner.os }}-stable-
  61. # Cache Playwright browsers
  62. - name: Cache Playwright browsers
  63. uses: actions/cache@v4
  64. id: playwright-cache
  65. with:
  66. path: |
  67. ~/.cache/ms-playwright
  68. ~/Library/Caches/ms-playwright
  69. ~/AppData/Local/ms-playwright
  70. key: playwright-browsers-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
  71. restore-keys: |
  72. playwright-browsers-${{ runner.os }}-
  73. - name: Install root dependencies
  74. if: steps.root-cache.outputs.cache-hit != 'true'
  75. run: npm ci
  76. - name: Install webview-ui dependencies
  77. if: steps.webview-cache.outputs.cache-hit != 'true'
  78. run: cd webview-ui && npm ci
  79. - name: Install xvfb on Linux
  80. if: matrix.runner == 'ubuntu'
  81. run: sudo apt-get update && sudo apt-get install -y xvfb
  82. # Run optimized E2E tests (eliminates redundant builds)
  83. - name: Run E2E tests - Linux
  84. if: matrix.runner == 'ubuntu'
  85. run: xvfb-run -a npm run test:e2e:optimal
  86. - name: Run E2E tests - Non-Linux
  87. if: matrix.runner != 'ubuntu'
  88. run: npm run test:e2e:optimal
  89. - uses: actions/upload-artifact@v4
  90. if: ${{ failure() }}
  91. with:
  92. name: playwright-recordings-${{ matrix.runner }}
  93. path: |
  94. test-results/playwright/