mirror of
https://github.com/cline/cline.git
synced 2026-09-19 02:05:44 +08:00
* Fix VSCode CI * fix nightly publish * Fix install * Fix biome * fix tsc * Fix windows set-up * Ignore .vscode-test * Add a LICENSE to the vscode extension * Add type roots * Remove workspaces * remove vscode as a bun workspace
163 lines
6.0 KiB
YAML
163 lines
6.0 KiB
YAML
name: ext-vscode-test-e2e
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
types: [opened, reopened, synchronize, ready_for_review]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
jobs:
|
|
detect-changes:
|
|
runs-on: ubuntu-latest
|
|
name: Detect Changes
|
|
outputs:
|
|
e2e: ${{ steps.force.outputs.run_all == 'true' || steps.filter.outputs.e2e == 'true' }}
|
|
steps:
|
|
- id: force
|
|
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
|
|
run: echo "run_all=true" >> "$GITHUB_OUTPUT"
|
|
|
|
- uses: actions/checkout@v4
|
|
if: steps.force.outputs.run_all != 'true'
|
|
|
|
- uses: dorny/paths-filter@v3
|
|
if: steps.force.outputs.run_all != 'true'
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
e2e:
|
|
- 'apps/vscode/src/**'
|
|
- 'apps/vscode/webview-ui/**'
|
|
- 'apps/vscode/proto/**'
|
|
- 'apps/vscode/tests/**'
|
|
- 'apps/vscode/scripts/**'
|
|
- 'apps/vscode/standalone/**'
|
|
- 'apps/vscode/assets/**'
|
|
- 'apps/vscode/walkthrough/**'
|
|
- 'apps/vscode/package.json'
|
|
- 'apps/vscode/package-lock.json'
|
|
- 'apps/vscode/buf.yaml'
|
|
- 'apps/vscode/tsconfig*.json'
|
|
- 'apps/vscode/biome.jsonc'
|
|
- 'apps/vscode/esbuild.mjs'
|
|
- 'apps/vscode/.mocharc.json'
|
|
- 'apps/vscode/.vscode-test.mjs'
|
|
- 'apps/vscode/.vscodeignore'
|
|
- 'apps/vscode/playwright*.ts'
|
|
- '.github/workflows/ext-vscode-test-e2e.yml'
|
|
|
|
matrix_prep:
|
|
needs: detect-changes
|
|
if: needs.detect-changes.outputs.e2e == 'true'
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
steps:
|
|
- id: set-matrix
|
|
run: |
|
|
echo 'matrix=[{"runner":"ubuntu"},{"runner":"windows"},{"runner":"macos"}]' >> $GITHUB_OUTPUT
|
|
|
|
e2e:
|
|
needs: [detect-changes, matrix_prep]
|
|
if: needs.detect-changes.outputs.e2e == 'true'
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
|
|
runs-on: ${{ matrix.runner }}-latest
|
|
timeout-minutes: 20
|
|
permissions:
|
|
id-token: write
|
|
contents: read
|
|
defaults:
|
|
run:
|
|
working-directory: apps/vscode
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Node.js environment
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
# Cache root dependencies - only reuse if package-lock.json exactly matches
|
|
- name: Cache root dependencies
|
|
uses: actions/cache@v4
|
|
id: root-cache
|
|
with:
|
|
path: apps/vscode/node_modules
|
|
key: ${{ runner.os }}-npm-${{ hashFiles('apps/vscode/package-lock.json') }}
|
|
|
|
# Cache webview-ui dependencies - only reuse if package-lock.json exactly matches
|
|
- name: Cache webview-ui dependencies
|
|
uses: actions/cache@v4
|
|
id: webview-cache
|
|
with:
|
|
path: apps/vscode/webview-ui/node_modules
|
|
key: ${{ runner.os }}-npm-webview-${{ hashFiles('apps/vscode/webview-ui/package-lock.json') }}
|
|
|
|
# Cache VS Code installation
|
|
- name: Cache VS Code
|
|
uses: actions/cache@v4
|
|
id: vscode-cache
|
|
with:
|
|
path: apps/vscode/.vscode-test
|
|
key: vscode-${{ runner.os }}-stable-${{ hashFiles('apps/vscode/.vscode-test.mjs', 'apps/vscode/package.json') }}
|
|
restore-keys: |
|
|
vscode-${{ runner.os }}-stable-
|
|
|
|
# Cache Playwright browsers
|
|
- name: Cache Playwright browsers
|
|
uses: actions/cache@v4
|
|
id: playwright-cache
|
|
with:
|
|
path: |
|
|
~/.cache/ms-playwright
|
|
~/Library/Caches/ms-playwright
|
|
~/AppData/Local/ms-playwright
|
|
key: playwright-browsers-${{ runner.os }}-${{ hashFiles('apps/vscode/package-lock.json') }}
|
|
restore-keys: |
|
|
playwright-browsers-${{ runner.os }}-
|
|
|
|
- name: Install extension dependencies
|
|
working-directory: ${{ github.workspace }}
|
|
run: npm --prefix apps/vscode ci
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install webview-ui dependencies
|
|
working-directory: ${{ github.workspace }}
|
|
run: npm --prefix apps/vscode/webview-ui ci
|
|
|
|
- name: Install vsce
|
|
run: npm install -g @vscode/vsce
|
|
|
|
- name: Install xvfb on Linux
|
|
if: matrix.runner == 'ubuntu'
|
|
run: sudo apt-get update && sudo apt-get install -y xvfb
|
|
|
|
# Run optimized E2E tests (eliminates redundant builds)
|
|
- name: Run E2E tests - Linux
|
|
if: matrix.runner == 'ubuntu'
|
|
run: xvfb-run -a npm run test:e2e:optimal
|
|
|
|
- name: Run E2E tests - Non-Linux
|
|
if: matrix.runner != 'ubuntu'
|
|
run: npm run test:e2e:optimal
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: ${{ failure() }}
|
|
with:
|
|
name: playwright-recordings-${{ matrix.runner }}
|
|
path: |
|
|
test-results/playwright/
|