Skip to content

Commit 723276d

Browse files
committed
Bash on Windows as an actions workflow fix...
1 parent 390f0c8 commit 723276d

File tree

1 file changed

+19
-39
lines changed

1 file changed

+19
-39
lines changed

.github/workflows/client-integration-tests.yml

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ on:
66
paths:
77
- '.github/actions/setup-codeql-environment/action.yml'
88
- '.github/workflows/client-integration-tests.yml'
9-
- '.node-version'
109
- '.codeql-version'
10+
- '.node-version'
1111
- 'client/**'
1212
- 'server/**'
1313
pull_request:
1414
branches: [main]
1515
paths:
1616
- '.github/actions/setup-codeql-environment/action.yml'
1717
- '.github/workflows/client-integration-tests.yml'
18-
- '.node-version'
1918
- '.codeql-version'
19+
- '.node-version'
2020
- 'client/**'
2121
- 'server/**'
2222
workflow_dispatch:
@@ -76,69 +76,49 @@ jobs:
7676
shell: bash
7777
run: ./server/scripts/extract-test-databases.sh
7878

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+
7986
## Run integration tests. This script builds the server bundle and runs tests.
8087
## We do NOT use 'npm run build-and-test' as it runs query unit tests which
8188
## have a dedicated workflow (query-unit-tests.yml).
8289
- name: MCP Integration Tests - Run integration tests
90+
shell: bash
8391
run: npm run test:integration --workspace=client
8492

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
8796
run: |
8897
if [ -f server.pid ]; then
8998
PID=$(cat server.pid)
9099
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
93102
sleep 2
94103
# Force kill if still running
95-
if kill -0 $PID 2>/dev/null; then
104+
if kill -0 "$PID" 2>/dev/null; then
96105
echo "Force killing server process"
97-
kill -9 $PID || true
106+
kill -9 "$PID" || true
98107
fi
99108
else
100109
echo "Server process was not running"
101110
fi
102-
rm server.pid
111+
rm -f server.pid
103112
else
104113
echo "No server.pid file found"
105114
fi
106115
107116
# Clean up log files
108117
if [ -f server.log ]; then
109118
echo "Removing server.log"
110-
rm server.log
119+
rm -f server.log
111120
fi
112121
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-
142122
- name: MCP Integration Tests - Summary
143123
shell: bash
144124
run: |

0 commit comments

Comments
 (0)