Skip to content

Commit bb3f8de

Browse files
committed
spec improvements on how they run in github action to improve flakiness
try port rotation to get more consitancy on server builds check if envs are set add ports to the test running command remove the listene command more spec changes to support changing ports dynamically add dependency install bundle install from bun install change order of dep install fixed action syntax rename
1 parent e4d305c commit bb3f8de

File tree

10 files changed

+157
-83
lines changed

10 files changed

+157
-83
lines changed

.github/workflows/cicd.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Ruby
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
name: Ruby ${{ matrix.ruby }}
13+
strategy:
14+
matrix:
15+
ruby: ['3.1.3', '3.2', '3.3', '3.4']
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: oven-sh/setup-bun@v2
21+
with:
22+
bun-version: 1.2.16
23+
24+
- name: Install dependencies for typescript-mcp && pagination-server
25+
run: |
26+
cd spec/fixtures/typescript-mcp
27+
bun install
28+
cd ../pagination-server
29+
bun install
30+
cd ../../..
31+
32+
- name: Set up Ruby
33+
uses: ruby/setup-ruby@v1
34+
with:
35+
ruby-version: ${{ matrix.ruby }}
36+
bundler-cache: true
37+
38+
- name: Install dependencies for gem and fast-mcp
39+
run: |
40+
bundle install
41+
cd spec/fixtures/fast-mcp-ruby
42+
bundle install
43+
cd ../../..
44+
45+
46+
- name: Generate random ports
47+
id: portgen
48+
run: |
49+
echo "PORT1=$(( (RANDOM % 1000) + 3000 ))" >> $GITHUB_ENV
50+
echo "PORT2=$(( (RANDOM % 1000) + 4000 ))" >> $GITHUB_ENV
51+
echo "PORT3=$(( (RANDOM % 1000) + 5000 ))" >> $GITHUB_ENV
52+
53+
- name: Run the test suite
54+
run: PORT1=$PORT1 PORT2=$PORT2 PORT3=$PORT3 bundle exec rake
55+
env:
56+
PORT1: ${{ env.PORT1 }}
57+
PORT2: ${{ env.PORT2 }}
58+
PORT3: ${{ env.PORT3 }}

.github/workflows/main.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

examples/tools/streamable_mcp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
name: "streamable_mcp",
1717
transport_type: :streamable,
1818
config: {
19-
url: "http://localhost:3005/mcp"
19+
url: "http://localhost:#{ENV.fetch('PORT1', 3005)}/mcp"
2020
}
2121
)
2222

spec/fixtures/fast-mcp-ruby/lib/app.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
require "rack/handler/puma"
1010

1111
is_silent = ARGV.include?("--silent")
12+
port = ENV.fetch("PORT2", 3006)
1213

1314
class NullWriter
1415
def write(*args)
@@ -107,10 +108,10 @@ def content
107108

108109
unless is_silent
109110
# Run the Rack application with Puma
110-
puts "Starting Rack application with MCP middleware on http://localhost:3006"
111+
puts "Starting Rack application with MCP middleware on http://localhost:#{port}"
111112
puts "MCP endpoints:"
112-
puts " - http://localhost:3006/mcp/sse (SSE endpoint)"
113-
puts " - http://localhost:3006/mcp/messages (JSON-RPC endpoint)"
113+
puts " - http://localhost:#{port}/mcp/sse (SSE endpoint)"
114+
puts " - http://localhost:#{port}/mcp/messages (JSON-RPC endpoint)"
114115
puts "Press Ctrl+C to stop"
115116
end
116117

@@ -124,7 +125,7 @@ def content
124125
log_writer = is_silent ? Puma::LogWriter.new(NullWriter.new, NullWriter.new) : Puma::LogWriter.stdio
125126

126127
config = Puma::Configuration.new(log_writer: log_writer) do |user_config|
127-
user_config.bind "tcp://localhost:3006"
128+
user_config.bind "tcp://127.0.0.1:#{port}"
128129
user_config.app app
129130
end
130131

spec/fixtures/pagination-server/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ if (process.argv.includes("--stdio")) {
295295
process.exit(1);
296296
});
297297
} else {
298-
const PORT = process.env.PORT || 3007;
298+
const PORT = process.env.PORT3 || 3007;
299299
app.listen(PORT, () => {
300300
log(`🚀 MCP Streamable server running on port ${PORT}`);
301301
log(`📡 Endpoint: http://localhost:${PORT}/mcp`);

spec/fixtures/typescript-mcp/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ if (process.argv.includes("--stdio")) {
297297
process.exit(1);
298298
});
299299
} else {
300-
const PORT = process.env.PORT || 3005;
300+
const PORT = process.env.PORT1 || 3005;
301301
app.listen(PORT, () => {
302302
log(`🚀 MCP Streamable server running on port ${PORT}`);
303303
log(`📡 Endpoint: http://localhost:${PORT}/mcp`);

spec/ruby_llm/mcp/transport/sse_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def client
2020
name: "fast-mcp-ruby",
2121
transport_type: :sse,
2222
config: {
23-
url: "http://127.0.0.1:3006/mcp/sse",
23+
url: "http://127.0.0.1:#{TestServerManager::PORTS[:sse]}/mcp/sse",
2424
request_timeout: 100
2525
}
2626
)

0 commit comments

Comments
 (0)