2020
2121 steps :
2222 - name : Checkout code
23- 23+ 2424
25+ - name : Install jq
26+ run : sudo apt-get install -y jq
27+
2528 - name : Run docker compose
2629 uses :
hoverkraft-tech/[email protected] 2730 with :
@@ -31,47 +34,75 @@ jobs:
3134 - name : Wait for services to be ready
3235 run : |
3336 echo "Waiting for services to be ready..."
34- sleep 30 # Give services time to initialize
35- docker ps # Display running containers
37+ # Longer wait time for services
38+ sleep 60
39+ # Show running containers
40+ docker ps
3641
3742 - name : Install cmcp client
3843 run : |
3944 pip install cmcp
4045
41- - name : Test FastAPI endpoints
46+ - name : Test FastAPI endpoints with better error handling
4247 run : |
4348 echo "Testing FastAPI /mcp/compile endpoint..."
44- curl -s -X POST http://localhost:8000/mcp/compile \
49+ RESPONSE=$( curl -s -S -f -X POST http://localhost:8000/mcp/compile \
4550 -H "Content-Type: application/json" \
4651 -d '{
4752 "code": "[filename: Cargo.toml]\n[package]\nname = \"hello_world\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[dependencies]\n\n[filename: src/main.rs]\nfn main() {\n println!(\"Hello, World!\");\n}"
48- }' | jq
53+ }' || echo "CURL_FAILED")
54+
55+ if [ "$RESPONSE" = "CURL_FAILED" ]; then
56+ echo "Failed to connect to FastAPI service. Debug information:"
57+ docker ps
58+ docker logs $(docker ps -q --filter name=api)
59+ exit 1
60+ fi
61+
62+ echo "$RESPONSE" | jq || echo "$RESPONSE"
4963
5064 echo "Testing FastAPI /mcp/compile-and-fix endpoint..."
51- curl -s -X POST http://localhost:8000/mcp/compile-and-fix \
65+ RESPONSE=$( curl -s -S -f -X POST http://localhost:8000/mcp/compile-and-fix \
5266 -H "Content-Type: application/json" \
5367 -d '{
5468 "code": "[filename: Cargo.toml]\n[package]\nname = \"hello_world\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[dependencies]\n\n[filename: src/main.rs]\nfn main() {\n println!(\"Hello, World!\" // Missing closing parenthesis\n}",
5569 "description": "A simple hello world program",
5670 "max_attempts": 3
57- }'
71+ }' || echo "CURL_FAILED")
72+
73+ if [ "$RESPONSE" = "CURL_FAILED" ]; then
74+ echo "Failed to connect to FastAPI service. Debug information:"
75+ docker ps
76+ docker logs $(docker ps -q --filter name=api)
77+ exit 1
78+ fi
79+
80+ echo "$RESPONSE"
5881
5982 - name : Test MCP Server with cmcp client
6083 run : |
6184 echo "Testing MCP server compile method..."
6285 echo '{
6386 "code": "[filename: Cargo.toml]\n[package]\nname = \"hello_world\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[dependencies]\n\n[filename: src/main.rs]\nfn main() {\n println!(\"Hello, World!\");\n}"
64- }' | cmcp call http://localhost:3000 rust-compiler compile
87+ }' | cmcp call http://localhost:3000 rust-compiler compile || {
88+ echo "CMCP call failed. Debug information:";
89+ docker ps;
90+ exit 1;
91+ }
6592
6693 echo "Testing MCP server compileAndFix method..."
6794 echo '{
6895 "code": "[filename: Cargo.toml]\n[package]\nname = \"hello_world\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[dependencies]\n\n[filename: src/main.rs]\nfn main() {\n println!(\"Hello, World!\" // Missing closing parenthesis\n}",
6996 "description": "A simple hello world program",
7097 "max_attempts": 3
71- }' | cmcp call http://localhost:3000 rust-compiler compileAndFix
98+ }' | cmcp call http://localhost:3000 rust-compiler compileAndFix || {
99+ echo "CMCP call failed. Debug information:";
100+ docker ps;
101+ exit 1;
102+ }
72103
73104 - name : Check Docker logs on failure
74105 if : failure()
75106 run : |
76107 echo "Checking Docker logs for troubleshooting..."
77- docker- compose logs
108+ docker compose logs || echo "Failed to get logs"
0 commit comments