-
Notifications
You must be signed in to change notification settings - Fork 2
146 lines (127 loc) · 4.72 KB
/
client-integration-tests.yml
File metadata and controls
146 lines (127 loc) · 4.72 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: QL MCP Client Integration Tests
on:
push:
branches: [main]
paths:
- '.github/actions/setup-codeql-environment/action.yml'
- '.github/workflows/client-integration-tests.yml'
- '.node-version'
- '.codeql-version'
- 'client/**'
- 'server/**'
pull_request:
branches: [main]
paths:
- '.github/actions/setup-codeql-environment/action.yml'
- '.github/workflows/client-integration-tests.yml'
- '.node-version'
- '.codeql-version'
- 'client/**'
- 'server/**'
workflow_dispatch:
permissions:
contents: read
jobs:
integration-tests:
name: Integration Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
env:
HTTP_HOST: 'localhost'
HTTP_PORT: '3000'
TIMEOUT_SECONDS: '30'
URL_SCHEME: 'http'
steps:
- name: MCP Integration Tests - Checkout repository
uses: actions/checkout@v6
- name: MCP Integration Tests - Setup Node.js environment
uses: actions/setup-node@v6
with:
cache: 'npm'
node-version-file: '.node-version'
- name: MCP Integration Tests - Install OS dependencies (Ubuntu)
if: runner.os == 'Linux'
run: sudo apt-get install -y jq
- name: MCP Integration Tests - Install OS dependencies (Windows)
if: runner.os == 'Windows'
run: choco install jq -y
- name: MCP Integration Tests - Install node dependencies for client and server workspaces
run: npm ci --workspace=client && npm ci --workspace=server
- name: MCP Integration Tests - Setup CodeQL environment
uses: ./.github/actions/setup-codeql-environment
with:
install-language-runtimes: false
## Install packs used in the integration tests.
- name: MCP Integration Tests - Install CodeQL packs
shell: bash
run: ./server/scripts/install-packs.sh
## Extract test databases used in the integration tests.
- name: MCP Integration Tests - Extract test databases
shell: bash
run: ./server/scripts/extract-test-databases.sh
## Run integration tests. This script builds the server bundle and runs tests.
## We do NOT use 'npm run build-and-test' as it runs query unit tests which
## have a dedicated workflow (query-unit-tests.yml).
- name: MCP Integration Tests - Run integration tests
run: npm run test:integration --workspace=client
- name: MCP Integration Tests - Stop the background MCP server process (Unix)
if: always() && runner.os != 'Windows'
run: |
if [ -f server.pid ]; then
PID=$(cat server.pid)
echo "Stopping server with PID $PID"
if kill -0 $PID 2>/dev/null; then
kill $PID || true
sleep 2
# Force kill if still running
if kill -0 $PID 2>/dev/null; then
echo "Force killing server process"
kill -9 $PID || true
fi
else
echo "Server process was not running"
fi
rm server.pid
else
echo "No server.pid file found"
fi
# Clean up log files
if [ -f server.log ]; then
echo "Removing server.log"
rm server.log
fi
- name: MCP Integration Tests - Stop the background MCP server process (Windows)
if: always() && runner.os == 'Windows'
shell: pwsh
run: |
if (Test-Path server.pid) {
$PID = Get-Content server.pid
Write-Host "Stopping server with PID $PID"
try {
$process = Get-Process -Id $PID -ErrorAction SilentlyContinue
if ($process) {
Stop-Process -Id $PID -Force -ErrorAction SilentlyContinue
Start-Sleep -Seconds 2
} else {
Write-Host "Server process was not running"
}
} catch {
Write-Host "Server process was not running or already stopped"
}
Remove-Item server.pid -Force -ErrorAction SilentlyContinue
} else {
Write-Host "No server.pid file found"
}
# Clean up log files
if (Test-Path server.log) {
Write-Host "Removing server.log"
Remove-Item server.log -Force -ErrorAction SilentlyContinue
}
- name: MCP Integration Tests - Summary
shell: bash
run: |
echo "## Integration Tests Summary (${{ matrix.os }})" >> $GITHUB_STEP_SUMMARY
echo "✅ MCP server integration tests passed on ${{ matrix.os }}" >> $GITHUB_STEP_SUMMARY