Skip to content

Commit 56f40af

Browse files
committed
fix integration test workflows
1 parent 911e3a9 commit 56f40af

File tree

1 file changed

+82
-21
lines changed

1 file changed

+82
-21
lines changed

.github/workflows/integration-test-workflow.yml

Lines changed: 82 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,18 @@ jobs:
2121
- os: ubuntu-latest
2222
target: linux-x64-musl
2323
artifact: mcp-docsrs-linux-x64-musl
24-
- os: macos-latest
24+
needs-docker: true
25+
- os: ubuntu-24.04-arm
26+
target: linux-arm64
27+
artifact: mcp-docsrs-linux-arm64
28+
- os: ubuntu-24.04-arm
29+
target: linux-arm64-musl
30+
artifact: mcp-docsrs-linux-arm64-musl
31+
needs-docker: true
32+
- os: macos-13 # Intel Mac for x64 binary
2533
target: darwin-x64
2634
artifact: mcp-docsrs-darwin-x64
27-
- os: macos-latest
35+
- os: macos-latest # Apple Silicon for ARM64 binary
2836
target: darwin-arm64
2937
artifact: mcp-docsrs-darwin-arm64
3038
- os: windows-latest
@@ -39,6 +47,7 @@ jobs:
3947
uses: oven-sh/setup-bun@v2
4048
with:
4149
bun-version: ${{ env.BUN_VERSION }}
50+
no-cache: ${{ runner.os == 'Windows' }} # Disable cache on Windows due to issues
4251

4352
- name: Download artifact
4453
uses: actions/download-artifact@v4
@@ -60,10 +69,18 @@ jobs:
6069
fi
6170
6271
# Test basic functionality
63-
$EXECUTABLE --version
72+
if [ "${{ matrix.needs-docker }}" == "true" ]; then
73+
# Test MUSL binaries in Alpine container
74+
docker run --rm -v $PWD/dist:/workspace:ro -w /workspace alpine:latest sh -c "
75+
apk add --no-cache libstdc++ libgcc &&
76+
/workspace/${{ matrix.artifact }} --version
77+
"
78+
else
79+
# Test native binaries directly
80+
$EXECUTABLE --version
81+
fi
6482
65-
# Test with environment variables
66-
DB_PATH=":memory:" timeout 5s $EXECUTABLE || true
83+
# Test with environment variables is now handled in the Docker script for MUSL
6784
shell: bash
6885

6986
- name: Test cache functionality
@@ -86,31 +103,75 @@ jobs:
86103
87104
- name: Test with sample crate lookup
88105
run: |
89-
# Set executable name based on platform
90-
if [ "${{ matrix.os }}" == "windows-latest" ]; then
91-
EXECUTABLE="./dist/${{ matrix.artifact }}.exe"
92-
else
93-
EXECUTABLE="./dist/${{ matrix.artifact }}"
94-
fi
106+
if [ "${{ matrix.needs-docker }}" == "true" ]; then
107+
# For MUSL builds, create a test script that runs inside Alpine
108+
cat > docker-integration-test.sh << 'EOF'
109+
#!/bin/sh
110+
set -e
111+
112+
# Install dependencies
113+
apk add --no-cache libstdc++ libgcc nodejs npm
114+
npm install -g bun
115+
116+
# Test basic functionality
117+
echo "Testing binary version..."
118+
/workspace/${{ matrix.artifact }} --version
119+
120+
# Test server startup
121+
echo "Testing server startup..."
122+
DB_PATH=":memory:" timeout 5s /workspace/${{ matrix.artifact }} || true
95123
96-
# Create integration test script
97-
cat > integration-test.js << 'EOF'
124+
# Create and run integration test
125+
cat > /tmp/integration-test.js << 'JSEOF'
98126
import { spawn } from 'child_process';
99-
100-
const executable = process.env.EXECUTABLE;
127+
128+
const executable = '/workspace/${{ matrix.artifact }}';
101129
const server = spawn(executable, [], {
102130
env: { ...process.env, DB_PATH: ':memory:' }
103131
});
104-
132+
105133
// Give server time to start
106134
await new Promise(resolve => setTimeout(resolve, 2000));
107-
135+
108136
// Test server is running
109-
console.log('MCP server started successfully');
110-
137+
console.log('MCP server started successfully in Alpine');
138+
111139
// Clean shutdown
112140
server.kill('SIGTERM');
141+
JSEOF
142+
143+
cd /tmp && bun integration-test.js
113144
EOF
114-
115-
EXECUTABLE=$EXECUTABLE bun integration-test.js
145+
146+
# Run the test script in Alpine container
147+
docker run --rm -v $PWD/dist:/workspace:ro -v $PWD/docker-integration-test.sh:/test.sh:ro alpine:latest sh /test.sh
148+
else
149+
# Native testing for non-MUSL builds
150+
if [ "${{ matrix.os }}" == "windows-latest" ]; then
151+
EXECUTABLE="./dist/${{ matrix.artifact }}.exe"
152+
else
153+
EXECUTABLE="./dist/${{ matrix.artifact }}"
154+
fi
155+
156+
# Create integration test script
157+
cat > integration-test.js << 'EOF'
158+
import { spawn } from 'child_process';
159+
160+
const executable = process.env.EXECUTABLE;
161+
const server = spawn(executable, [], {
162+
env: { ...process.env, DB_PATH: ':memory:' }
163+
});
164+
165+
// Give server time to start
166+
await new Promise(resolve => setTimeout(resolve, 2000));
167+
168+
// Test server is running
169+
console.log('MCP server started successfully');
170+
171+
// Clean shutdown
172+
server.kill('SIGTERM');
173+
EOF
174+
175+
EXECUTABLE=$EXECUTABLE bun integration-test.js
176+
fi
116177
shell: bash

0 commit comments

Comments
 (0)