Elffuss BraidHub

kikocis/continue public

8eb3ae7b8d16 · 4.2 KiBRawPermalink
1name: 'Run VS Code E2E Test'
2description: 'Run a single VS Code E2E test with all required setup'
3inputs:
4 test_file:
5 description: 'E2E test file to run'
6 required: true
7 command:
8 description: 'Command to run (e2e:ci:run or e2e:ci:run-yaml)'
9 required: true
10 ssh_key:
11 description: 'SSH private key for testing'
12 required: false
13 ssh_host:
14 description: 'SSH host for testing'
15 required: false
16 is_fork:
17 description: 'Whether this is a fork (affects SSH tests)'
18 required: false
19 default: 'false'
20
21runs:
22 using: 'composite'
23 steps:
24 - uses: actions/setup-node@v4
25 with:
26 node-version-file: ".nvmrc"
27
28 - uses: actions/cache@v4
29 id: vscode-node-modules-cache
30 with:
31 path: extensions/vscode/node_modules
32 key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }}
33
34 # We don't want to cache the Continue extension, so it is deleted at the end of the job
35 - uses: actions/cache@v4
36 id: test-extensions-cache
37 with:
38 path: extensions/vscode/e2e/.test-extensions
39 key: CONSTANT
40
41 - uses: actions/cache@v4
42 id: storage-cache
43 with:
44 path: extensions/vscode/e2e/storage
45 key: ${{ runner.os }}-vscode-storage-${{ hashFiles('extensions/vscode/package-lock.json') }}
46
47 - name: Download build artifact
48 uses: actions/download-artifact@v4
49 with:
50 name: vscode-extension-build-Linux
51 path: extensions/vscode/build
52
53 - name: Build packages and download e2e dependencies
54 shell: bash
55 run: |
56 node ./scripts/build-packages.js
57 if [ "${{ steps.storage-cache.outputs.cache-hit }}" != "true" ]; then
58 cd core
59 npm ci
60 cd ../extensions/vscode
61 npm run e2e:ci:download
62 else
63 cd core
64 npm ci
65 fi
66
67 - name: Fix VSCode binary permissions
68 shell: bash
69 run: |
70 chmod +x extensions/vscode/e2e/storage/VSCode-linux-x64/code
71 chmod +x extensions/vscode/e2e/storage/chromedriver-linux64/chromedriver
72
73 - name: Set up SSH
74 if: ${{ inputs.ssh_key != '' && inputs.ssh_host != '' && inputs.is_fork == 'false' }}
75 shell: bash
76 env:
77 SSH_KEY: ${{ inputs.ssh_key }}
78 SSH_HOST: ${{ inputs.ssh_host }}
79 run: |
80 mkdir -p ~/.ssh
81 echo "$SSH_KEY" > ~/.ssh/id_rsa
82 chmod 600 ~/.ssh/id_rsa
83 ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts
84 echo -e "Host ssh-test-container\n\tHostName $SSH_HOST\n\tUser ec2-user\n\tIdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
85
86 - name: Set up Xvfb
87 shell: bash
88 run: |
89 Xvfb :99 &
90 export DISPLAY=:99
91
92 - name: Run e2e tests
93 shell: bash
94 run: |
95 cd extensions/vscode
96 IGNORE_SSH_TESTS="${{ inputs.is_fork }}" TEST_FILE="${{ inputs.test_file }}" npm run ${{ inputs.command }}
97 env:
98 DISPLAY: :99
99
100 - name: Delete continue from test extensions
101 shell: bash
102 run: |
103 cd extensions/vscode
104 rm -rf e2e/.test-extensions/continue*
105
106 - name: Sanitize test file name
107 id: sanitize_filename
108 if: always()
109 shell: bash
110 run: |
111 FILENAME="${{ inputs.test_file }}"
112 SANITIZED_FILENAME="${FILENAME//\//-}" # Replace / with - using bash parameter expansion
113 echo "sanitized_test_file=${SANITIZED_FILENAME}" >> $GITHUB_OUTPUT
114
115 - name: Upload e2e test screenshots
116 if: failure()
117 uses: actions/upload-artifact@v4
118 with:
119 name: e2e-failure-screenshots-${{ steps.sanitize_filename.outputs.sanitized_test_file || 'unknown' }}-${{ inputs.command == 'e2e:ci:run-yaml' && 'yaml' || 'json' }}
120 path: extensions/vscode/e2e/storage/screenshots
121
122 - name: Find e2e log file
123 if: always()
124 shell: bash
125 run: |
126 echo "Searching for e2e.log file..."
127 find $GITHUB_WORKSPACE -name "e2e.log" -type f
128
129 - name: Upload e2e logs
130 if: always()
131 uses: actions/upload-artifact@v4
132 with:
133 name: e2e-logs-${{ steps.sanitize_filename.outputs.sanitized_test_file || 'unknown' }}-${{ inputs.command == 'e2e:ci:run-yaml' && 'yaml' || 'json' }}
134 path: extensions/vscode/e2e.log