-
Notifications
You must be signed in to change notification settings - Fork 3
130 lines (111 loc) · 4.32 KB
/
Copy pathbuild-and-test-extension.yml
File metadata and controls
130 lines (111 loc) · 4.32 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Build and Test Extension - CodeQL Development MCP Server
on:
pull_request:
branches: ['main', 'next']
paths:
- '.github/workflows/build-and-test-extension.yml'
- '.node-version'
- 'extensions/vscode/**'
- 'package.json'
- 'package-lock.json'
- 'server/dist/**'
- 'server/ql/*/tools/src/**'
- 'server/src/**'
push:
branches: ['main', 'next']
paths:
- '.github/workflows/build-and-test-extension.yml'
- '.node-version'
- 'extensions/vscode/**'
- 'package.json'
- 'package-lock.json'
- 'server/dist/**'
- 'server/ql/*/tools/src/**'
- 'server/src/**'
permissions:
contents: read
jobs:
build-and-test-extension:
name: Build and Test Extension (Node ${{ matrix.node }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['.node-version', '26']
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup Node.js environment (from .node-version)
if: matrix.node == '.node-version'
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
cache: 'npm'
node-version-file: '.node-version'
- name: Setup Node.js environment (explicit version)
if: matrix.node != '.node-version'
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
cache: 'npm'
node-version: ${{ matrix.node }}
- name: Install dependencies
run: npm ci --include=optional --ignore-scripts
- 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@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
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