Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 129 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
# Phase 1: Core Tests and Quality Checks (run in parallel)
test:
name: Test
runs-on: ubuntu-latest
Expand Down Expand Up @@ -47,9 +48,6 @@ jobs:
- name: Run unit tests
run: make test

- name: Run integration tests
run: make test-integration

- name: Generate coverage report
run: make test-coverage

Expand Down Expand Up @@ -85,10 +83,126 @@ jobs:
version: latest
args: --timeout=5m

security:
name: Security Scan
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
scan-ref: '.'
format: 'sarif'
output: 'trivy-results.sarif'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
continue-on-error: true
with:
sarif_file: 'trivy-results.sarif'

stdio-transport-test:
name: STDIO Transport Test
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install Python dependencies
run: pip install requests

- name: Download dependencies
run: make deps

- name: Build server
run: make build

- name: Test STDIO transport
run: python3 scripts/test_stdio_integration.py

sse-transport-test:
name: SSE Transport Test
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install Python dependencies
run: pip install requests

- name: Download dependencies
run: make deps

- name: Build server
run: make build

- name: Test SSE transport
run: python3 scripts/test_sse_integration.py --port 8081

http-streams-transport-test:
name: HTTP Streams Transport Test
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install Python dependencies
run: pip install requests

- name: Download dependencies
run: make deps

- name: Build server
run: make build

- name: Test HTTP Streams transport
run: python3 scripts/test_http_streams_integration.py --port 8082

# Phase 2: Build Jobs (after core tests pass)
build:
name: Build
runs-on: ubuntu-latest
needs: [test, lint]
needs: [test, lint, security, stdio-transport-test, sse-transport-test, http-streams-transport-test]

strategy:
matrix:
Expand Down Expand Up @@ -122,7 +236,7 @@ jobs:
docker:
name: Build and Push Docker Image
runs-on: ubuntu-latest
needs: [test, lint]
needs: [test, lint, security, stdio-transport-test, sse-transport-test, http-streams-transport-test]
if: github.event_name != 'pull_request'

permissions:
Expand Down Expand Up @@ -167,6 +281,7 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max

# Phase 3: Release (last, after everything else passes)
release:
name: Create Release
runs-on: ubuntu-latest
Expand All @@ -179,6 +294,15 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check if tag is on main branch
run: |
if ! git branch --contains ${{ github.ref }} | grep -q "main"; then
echo "Tag is not on main branch, skipping release"
exit 78
fi

- name: Download all artifacts
uses: actions/download-artifact@v4
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,9 @@ coverage.html
.dockerignore

# Go module cache
/go/pkg/mod/
/go/pkg/mod/

# Python cache
__pycache__/
*.pyc
*.pyo
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ RUN chown appuser:appgroup mcp-server
# Switch to non-root user
USER appuser

# Expose port for SSE transport
# Expose port for HTTP Streams transport
EXPOSE 8080

# Default command
ENTRYPOINT ["./mcp-server"]

# Default arguments (can be overridden)
CMD ["-transport=sse", "-addr=8080"]
CMD ["-transport=http-streams", "-addr=8080"]
24 changes: 20 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,33 @@ dev: ## Run in development mode with hot reload
@which air > /dev/null || (echo "Installing air..." && go install github.com/cosmtrek/air@latest)
air

test-integration: build ## Run integration tests
@echo "Running integration tests..."
test-integration: build ## Run integration tests (SSE only - legacy)
@echo "Running SSE integration tests..."
@./$(BINARY_NAME) -transport=sse -addr=8081 > /dev/null 2>&1 & \
SERVER_PID=$$!; \
sleep 2; \
python3 scripts/test_sse_integration.py 8081; \
python3 scripts/test_sse_integration.py --base-url=http://localhost:8081; \
TEST_RESULT=$$?; \
kill $$SERVER_PID 2>/dev/null || true; \
exit $$TEST_RESULT

test-all: test test-integration ## Run all tests (unit + integration)
test-integration-stdio: build ## Run STDIO integration tests
@echo "Running STDIO integration tests..."
python3 scripts/test_stdio_integration.py --server-binary=./$(BINARY_NAME)

test-integration-sse: build ## Run SSE integration tests
@echo "Running SSE integration tests..."
@python3 scripts/test_sse_integration.py --base-url=http://localhost:8081

test-integration-http-streams: build ## Run HTTP Streams integration tests
@echo "Running HTTP Streams integration tests..."
@python3 scripts/test_http_streams_integration.py 8082

test-integration-all: build ## Run all transport integration tests in parallel
@echo "Running all transport integration tests..."
python3 scripts/test_all_transports.py --transport=all

test-all: test test-integration-all ## Run all tests (unit + all transport integration)

benchmark: ## Run benchmarks
$(GOTEST) -bench=. -benchmem ./...
Expand Down
Loading
Loading