|
6 | 6 | paths: |
7 | 7 | - '.github/actions/setup-codeql-environment/action.yml' |
8 | 8 | - '.github/workflows/client-integration-tests.yml' |
9 | | - - '.node-version' |
10 | 9 | - '.codeql-version' |
| 10 | + - '.node-version' |
11 | 11 | - 'client/**' |
12 | 12 | - 'server/**' |
13 | 13 | pull_request: |
14 | 14 | branches: [main] |
15 | 15 | paths: |
16 | 16 | - '.github/actions/setup-codeql-environment/action.yml' |
17 | 17 | - '.github/workflows/client-integration-tests.yml' |
18 | | - - '.node-version' |
19 | 18 | - '.codeql-version' |
| 19 | + - '.node-version' |
20 | 20 | - 'client/**' |
21 | 21 | - 'server/**' |
22 | 22 | workflow_dispatch: |
@@ -76,69 +76,49 @@ jobs: |
76 | 76 | shell: bash |
77 | 77 | run: ./server/scripts/extract-test-databases.sh |
78 | 78 |
|
| 79 | + ## Configure npm to use bash for running scripts on Windows, since the |
| 80 | + ## integration test scripts are bash scripts that cmd.exe cannot execute. |
| 81 | + - name: MCP Integration Tests - Configure npm script shell (Windows) |
| 82 | + if: runner.os == 'Windows' |
| 83 | + shell: bash |
| 84 | + run: npm config set script-shell "$(which bash)" |
| 85 | + |
79 | 86 | ## Run integration tests. This script builds the server bundle and runs tests. |
80 | 87 | ## We do NOT use 'npm run build-and-test' as it runs query unit tests which |
81 | 88 | ## have a dedicated workflow (query-unit-tests.yml). |
82 | 89 | - name: MCP Integration Tests - Run integration tests |
| 90 | + shell: bash |
83 | 91 | run: npm run test:integration --workspace=client |
84 | 92 |
|
85 | | - - name: MCP Integration Tests - Stop the background MCP server process (Unix) |
86 | | - if: always() && runner.os != 'Windows' |
| 93 | + - name: MCP Integration Tests - Stop the background MCP server process |
| 94 | + if: always() |
| 95 | + shell: bash |
87 | 96 | run: | |
88 | 97 | if [ -f server.pid ]; then |
89 | 98 | PID=$(cat server.pid) |
90 | 99 | echo "Stopping server with PID $PID" |
91 | | - if kill -0 $PID 2>/dev/null; then |
92 | | - kill $PID || true |
| 100 | + if kill -0 "$PID" 2>/dev/null; then |
| 101 | + kill "$PID" || true |
93 | 102 | sleep 2 |
94 | 103 | # Force kill if still running |
95 | | - if kill -0 $PID 2>/dev/null; then |
| 104 | + if kill -0 "$PID" 2>/dev/null; then |
96 | 105 | echo "Force killing server process" |
97 | | - kill -9 $PID || true |
| 106 | + kill -9 "$PID" || true |
98 | 107 | fi |
99 | 108 | else |
100 | 109 | echo "Server process was not running" |
101 | 110 | fi |
102 | | - rm server.pid |
| 111 | + rm -f server.pid |
103 | 112 | else |
104 | 113 | echo "No server.pid file found" |
105 | 114 | fi |
106 | 115 |
|
107 | 116 | # Clean up log files |
108 | 117 | if [ -f server.log ]; then |
109 | 118 | echo "Removing server.log" |
110 | | - rm server.log |
| 119 | + rm -f server.log |
111 | 120 | fi |
112 | 121 |
|
113 | | - - name: MCP Integration Tests - Stop the background MCP server process (Windows) |
114 | | - if: always() && runner.os == 'Windows' |
115 | | - shell: pwsh |
116 | | - run: | |
117 | | - if (Test-Path server.pid) { |
118 | | - $PID = Get-Content server.pid |
119 | | - Write-Host "Stopping server with PID $PID" |
120 | | - try { |
121 | | - $process = Get-Process -Id $PID -ErrorAction SilentlyContinue |
122 | | - if ($process) { |
123 | | - Stop-Process -Id $PID -Force -ErrorAction SilentlyContinue |
124 | | - Start-Sleep -Seconds 2 |
125 | | - } else { |
126 | | - Write-Host "Server process was not running" |
127 | | - } |
128 | | - } catch { |
129 | | - Write-Host "Server process was not running or already stopped" |
130 | | - } |
131 | | - Remove-Item server.pid -Force -ErrorAction SilentlyContinue |
132 | | - } else { |
133 | | - Write-Host "No server.pid file found" |
134 | | - } |
135 | | -
|
136 | | - # Clean up log files |
137 | | - if (Test-Path server.log) { |
138 | | - Write-Host "Removing server.log" |
139 | | - Remove-Item server.log -Force -ErrorAction SilentlyContinue |
140 | | - } |
141 | | -
|
142 | 122 | - name: MCP Integration Tests - Summary |
143 | 123 | shell: bash |
144 | 124 | run: | |
|
0 commit comments