-
Notifications
You must be signed in to change notification settings - Fork 2
114 lines (97 loc) · 3.64 KB
/
build-and-test-extension.yml
File metadata and controls
114 lines (97 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Build and Test Extension - CodeQL Development MCP Server
on:
pull_request:
branches: ['main']
paths:
- '.github/workflows/build-and-test-extension.yml'
- '.node-version'
- 'extensions/vscode/**'
- 'server/dist/**'
- 'server/ql/*/tools/src/**'
- 'server/src/**'
push:
branches: ['main']
paths:
- '.github/workflows/build-and-test-extension.yml'
- '.node-version'
- 'extensions/vscode/**'
- 'server/dist/**'
- 'server/ql/*/tools/src/**'
- 'server/src/**'
workflow_dispatch:
permissions:
contents: read
jobs:
build-and-test-extension:
name: Build and Test Extension
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js environment
uses: actions/setup-node@v6
with:
cache: 'npm'
node-version-file: '.node-version'
- name: Install dependencies
run: npm ci --include=optional
- name: Build server (dependency)
run: npm run build -w server
- name: Run extension unit tests with coverage
working-directory: extensions/vscode
run: npm run test:coverage
- name: Bundle extension and server
working-directory: extensions/vscode
run: |
npm run clean
npm run lint
npm run bundle
npm run bundle:server
- name: Setup CodeQL environment for integration tests
uses: ./.github/actions/setup-codeql-environment
with:
add-to-path: 'true'
install-language-runtimes: 'false'
- name: Cache VS Code for integration tests
uses: actions/cache@v5
with:
key: vscode-test-${{ runner.os }}-stable
path: extensions/vscode/.vscode-test
- name: Download VS Code for integration tests
working-directory: extensions/vscode
run: npm run download:vscode
- name: Run Extension Host integration tests
working-directory: extensions/vscode
run: xvfb-run -a npm run test:integration
- name: Verify VSIX packaging
working-directory: extensions/vscode
run: |
VERSION=$(node -e "console.log(require('./package.json').version)")
npx @vscode/vsce package --no-dependencies --out "codeql-development-mcp-server-v${VERSION}.vsix"
- name: Verify VSIX contents
working-directory: extensions/vscode
run: |
echo "## VSIX Contents" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
npx @vscode/vsce ls --no-dependencies --tree 2>&1 | head -50 >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Check for uncommitted changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "❌ Uncommitted changes detected after build:"
git status --porcelain
git diff
exit 1
else
echo "✅ No uncommitted changes after build"
fi
- name: Summary
run: |
echo "## Build and Test Extension Summary" >> $GITHUB_STEP_SUMMARY
echo "✅ ESLint checks completed" >> $GITHUB_STEP_SUMMARY
echo "✅ Unit tests passed with coverage" >> $GITHUB_STEP_SUMMARY
echo "✅ Extension bundled successfully" >> $GITHUB_STEP_SUMMARY
echo "✅ Server bundled into extension" >> $GITHUB_STEP_SUMMARY
echo "✅ Extension Host integration tests passed" >> $GITHUB_STEP_SUMMARY
echo "✅ VSIX packaging verified" >> $GITHUB_STEP_SUMMARY
echo "✅ No uncommitted changes detected" >> $GITHUB_STEP_SUMMARY