Skip to content

Commit e01330e

Browse files
committed
fix: address code review issues for VS Code CI workflows
- Add compile step before tests (tests need compiled output) - Use xvfb-run wrapper for Linux tests (proper display server) - Add VSIX file validation (fail fast if missing) - Fix channel variable check in pipeline.build.ps1 (was checking literal string 'Channel' instead of $Channel variable)
1 parent 8e872e2 commit e01330e

3 files changed

Lines changed: 23 additions & 20 deletions

File tree

.github/workflows/release-vscode.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ jobs:
5656
working-directory: packages/vscode-extension/out/package
5757
run: |
5858
VSIX_FILE=$(ls *.vsix 2>/dev/null | head -1)
59+
if [ -z "$VSIX_FILE" ]; then
60+
echo "::error::No VSIX file found in out/package/"
61+
exit 1
62+
fi
5963
echo "file=$VSIX_FILE" >> $GITHUB_OUTPUT
6064
echo "path=packages/vscode-extension/out/package/$VSIX_FILE" >> $GITHUB_OUTPUT
6165
echo "Found VSIX: $VSIX_FILE"

.github/workflows/vscode-ci.yml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -93,35 +93,30 @@ jobs:
9393
name: extension-preview
9494
path: packages/vscode-extension/out/package
9595

96-
- name: Start Xvfb (Linux)
97-
if: runner.os == 'Linux'
98-
run: |
99-
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
100-
echo "Started Xvfb"
101-
10296
- name: Install dependencies
10397
working-directory: packages/vscode-extension
10498
run: npm ci
10599

106-
- name: Run tests (PowerShell 7.x)
107-
if: matrix.pwsh == true
100+
- name: Compile extension and tests
101+
working-directory: packages/vscode-extension
102+
run: npm run compile
103+
104+
- name: Run tests (Linux)
105+
if: runner.os == 'Linux'
106+
working-directory: packages/vscode-extension
107+
run: xvfb-run -a npm test
108+
109+
- name: Run tests (macOS/Windows - PowerShell 7.x)
110+
if: runner.os != 'Linux' && matrix.pwsh == true
108111
shell: pwsh
109112
working-directory: packages/vscode-extension
110-
run: |
111-
# Run extension tests
112-
npm test
113-
env:
114-
DISPLAY: ':99.0'
113+
run: npm test
115114

116-
- name: Run tests (PowerShell 5.1)
115+
- name: Run tests (Windows - PowerShell 5.1)
117116
if: matrix.pwsh == false
118117
shell: powershell
119118
working-directory: packages/vscode-extension
120-
run: |
121-
# Run extension tests
122-
npm test
123-
env:
124-
DISPLAY: ':99.0'
119+
run: npm test
125120

126121
# Auto-publish preview on main merge
127122
publish-preview:
@@ -154,6 +149,10 @@ jobs:
154149
working-directory: packages/vscode-extension/out/package
155150
run: |
156151
VSIX_FILE=$(ls *.vsix 2>/dev/null | head -1)
152+
if [ -z "$VSIX_FILE" ]; then
153+
echo "::error::No VSIX file found in out/package/"
154+
exit 1
155+
fi
157156
echo "file=$VSIX_FILE" >> $GITHUB_OUTPUT
158157
echo "Found VSIX: $VSIX_FILE"
159158

packages/vscode-extension/pipeline.build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ if ($Env:BUILD_SOURCEBRANCH -like '*/tags/*' -and $Env:BUILD_SOURCEBRANCHNAME -l
4646
$version = $Build;
4747

4848
# Handle channel
49-
if ([String]::IsNullOrEmpty('Channel')) {
49+
if ([String]::IsNullOrEmpty($Channel)) {
5050
$Channel = 'preview';
5151
}
5252
$channelSuffix = '-preview';

0 commit comments

Comments
 (0)