Skip to content

Commit 021a876

Browse files
feat: run e2e tests on vsc release
1 parent 6c9f66c commit 021a876

4 files changed

Lines changed: 179 additions & 107 deletions

File tree

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: 'Run VS Code E2E Tests'
2+
description: 'Runs VS Code E2E tests with test matrix generation and execution'
3+
inputs:
4+
github-token:
5+
description: 'GitHub token for accessing private repositories'
6+
required: true
7+
ci-github-token:
8+
description: 'CI GitHub token for accessing private repositories'
9+
required: true
10+
ssh_key:
11+
description: 'SSH key for SSH tests'
12+
required: false
13+
ssh_host:
14+
description: 'SSH host for SSH tests'
15+
required: false
16+
is_fork:
17+
description: 'Whether this is running on a fork'
18+
required: false
19+
default: 'false'
20+
outputs:
21+
test_file_matrix:
22+
description: 'Matrix of test files to run'
23+
value: ${{ steps.get-test-file-matrix.outputs.test_file_matrix }}
24+
25+
runs:
26+
using: "composite"
27+
steps:
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version-file: ".nvmrc"
31+
32+
- name: Cache npm
33+
uses: actions/cache@v4
34+
with:
35+
path: ~/.npm
36+
key: ${{ runner.os }}-npm-cache-matrix-${{ hashFiles('core/package-lock.json', 'extensions/vscode/package-lock.json') }}
37+
38+
- name: Cache packages node_modules
39+
uses: actions/cache@v4
40+
with:
41+
path: |
42+
packages/*/node_modules
43+
key: ${{ runner.os }}-packages-node-modules-${{ hashFiles('packages/*/package-lock.json') }}
44+
45+
- name: Cache core node modules
46+
uses: actions/cache@v4
47+
with:
48+
path: core/node_modules
49+
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
50+
51+
- name: Cache vscode extension node modules
52+
uses: actions/cache@v4
53+
id: vscode-cache
54+
with:
55+
path: extensions/vscode/node_modules
56+
key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }}
57+
58+
- name: Build packages and get test files
59+
id: get-test-file-matrix
60+
shell: bash
61+
run: |
62+
node ./scripts/build-packages.js
63+
cd extensions/vscode
64+
npm ci
65+
npm run e2e:compile
66+
if [[ "${{ inputs.is_fork }}" == "true" ]]; then
67+
# Exclude SSH tests for forks
68+
FILES=$(ls -1 e2e/_output/tests/*.test.js | grep -v "SSH" | jq -R . | jq -s .)
69+
else
70+
# Include all tests for non-forks
71+
FILES=$(ls -1 e2e/_output/tests/*.test.js | jq -R . | jq -s .)
72+
fi
73+
echo "test_file_matrix<<EOF" >> $GITHUB_OUTPUT
74+
echo "$FILES" >> $GITHUB_OUTPUT
75+
echo "EOF" >> $GITHUB_OUTPUT
76+
env:
77+
# https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333
78+
GITHUB_TOKEN: ${{ inputs.ci-github-token }}
79+
80+
- name: Debug Outputs
81+
shell: bash
82+
run: |
83+
echo "Test files: ${{ steps.get-test-file-matrix.outputs.test_file_matrix }}"
84+
85+
- name: Build VS Code extension
86+
uses: ./.github/actions/build-vscode-extension
87+
with:
88+
platform: linux
89+
arch: x64
90+
npm_config_arch: x64
91+
pre-release: false
92+
commit-sha: ${{ github.sha }}
93+
github-token: ${{ inputs.github-token }}
94+
95+
- name: Upload build artifact
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: vscode-extension-build-Linux
99+
path: extensions/vscode/build

.github/workflows/e2e-tests.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: 'E2E Tests'
2+
description: 'Reusable workflow for running VS Code E2E tests'
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
is_fork:
8+
description: 'Whether this is running on a fork'
9+
type: boolean
10+
default: false
11+
secrets:
12+
CI_GITHUB_TOKEN:
13+
required: true
14+
GITHUB_TOKEN:
15+
required: true
16+
GH_ACTIONS_SSH_TEST_KEY_PEM:
17+
required: false
18+
GH_ACTIONS_SSH_TEST_DNS_NAME:
19+
required: false
20+
21+
jobs:
22+
vscode-get-test-file-matrix:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
test_file_matrix: ${{ steps.get-matrix.outputs.test_file_matrix }}
26+
steps:
27+
- uses: actions/checkout@v5
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Get test matrix
32+
id: get-matrix
33+
uses: ./.github/actions/run-vscode-e2e-tests
34+
with:
35+
github-token: ${{ secrets.GITHUB_TOKEN }}
36+
ci-github-token: ${{ secrets.CI_GITHUB_TOKEN }}
37+
is_fork: ${{ inputs.is_fork }}
38+
39+
vscode-e2e-tests:
40+
name: ${{ matrix.test_file || 'unknown' }} (${{ matrix.command }})
41+
needs: [vscode-get-test-file-matrix]
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 15
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
test_file: ${{ fromJson(needs.vscode-get-test-file-matrix.outputs.test_file_matrix) }}
48+
command: ["e2e:ci:run", "e2e:ci:run-yaml"]
49+
steps:
50+
- uses: actions/checkout@v5
51+
- name: Run VS Code E2E test
52+
uses: ./.github/actions/run-vscode-e2e-test
53+
with:
54+
test_file: ${{ matrix.test_file }}
55+
command: ${{ matrix.command }}
56+
ssh_key: ${{ secrets.GH_ACTIONS_SSH_TEST_KEY_PEM }}
57+
ssh_host: ${{ secrets.GH_ACTIONS_SSH_TEST_DNS_NAME }}
58+
is_fork: ${{ inputs.is_fork }}

.github/workflows/main.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ jobs:
110110
runs-on: ubuntu-latest
111111
needs:
112112
- build
113+
- vscode-e2e-tests
113114
steps:
114115
- name: Checkout
115116
uses: actions/checkout@v5
@@ -135,10 +136,23 @@ jobs:
135136
token: ${{ secrets.CI_GITHUB_TOKEN }}
136137
repository: continuedev/continue
137138

139+
vscode-e2e-tests:
140+
needs: check_release_name
141+
if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch'
142+
uses: ./.github/workflows/e2e-tests.yml
143+
with:
144+
is_fork: false
145+
secrets:
146+
CI_GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
147+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148+
GH_ACTIONS_SSH_TEST_KEY_PEM: ${{ secrets.GH_ACTIONS_SSH_TEST_KEY_PEM }}
149+
GH_ACTIONS_SSH_TEST_DNS_NAME: ${{ secrets.GH_ACTIONS_SSH_TEST_DNS_NAME }}
150+
138151
publish:
139152
runs-on: ubuntu-latest
140153
needs:
141154
- build
155+
- vscode-e2e-tests
142156
if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish_build == 'true'
143157
permissions:
144158
contents: write

.github/workflows/pr-checks.yaml

Lines changed: 8 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -192,112 +192,15 @@ jobs:
192192
AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }}
193193
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
194194

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-
280195
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]' }}
196+
uses: ./.github/workflows/e2e-tests.yml
197+
with:
198+
is_fork: ${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }}
199+
secrets:
200+
CI_GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
201+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
202+
GH_ACTIONS_SSH_TEST_KEY_PEM: ${{ secrets.GH_ACTIONS_SSH_TEST_KEY_PEM }}
203+
GH_ACTIONS_SSH_TEST_DNS_NAME: ${{ secrets.GH_ACTIONS_SSH_TEST_DNS_NAME }}
301204

302205
jetbrains-tests:
303206
runs-on: ubuntu-latest
@@ -350,8 +253,6 @@ jobs:
350253
- vscode-checks
351254
- get-packages-matrix
352255
- packages-checks
353-
- vscode-get-test-file-matrix
354-
- vscode-package-extension-linux
355256
- vscode-e2e-tests
356257
- jetbrains-tests
357258
- pr-review-action-tests

0 commit comments

Comments
 (0)