Skip to content

CI/CD test pull request, not real #10

CI/CD test pull request, not real

CI/CD test pull request, not real #10

Workflow file for this run

name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
NODE_VERSION: '18'
jobs:
lint-and-typecheck:
name: Lint and Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Run ESLint
run: npm run lint
- name: Run TypeScript type check
run: npm run typecheck
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: graphdone_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
neo4j:
image: neo4j:5.15-community
env:
NEO4J_AUTH: neo4j/graphdone_test_password
NEO4J_PLUGINS: '["graph-data-science", "apoc"]'
NEO4J_dbms_security_procedures_unrestricted: "gds.*,apoc.*"
NEO4J_dbms_security_procedures_allowlist: "gds.*,apoc.*"
options: >-
--health-cmd "cypher-shell -u neo4j -p graphdone_test_password 'RETURN 1'"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 7474:7474
- 7687:7687
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Run tests with coverage
run: npm run test:coverage
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/graphdone_test
NEO4J_URI: bolt://localhost:7687
NEO4J_USER: neo4j
NEO4J_PASSWORD: graphdone_test_password
- name: Upload coverage reports
uses: codecov/codecov-action@v3
with:
directory: ./packages/*/coverage
flags: unittests
fail_ci_if_error: false
mcp-server-test:
name: MCP Server Integration Tests
runs-on: ubuntu-latest
services:
neo4j:
image: neo4j:5.15-community
env:
NEO4J_AUTH: neo4j/graphdone_test_password
NEO4J_PLUGINS: '["graph-data-science", "apoc"]'
NEO4J_dbms_security_procedures_unrestricted: "gds.*,apoc.*"
NEO4J_dbms_security_procedures_allowlist: "gds.*,apoc.*"
options: >-
--health-cmd "cypher-shell -u neo4j -p graphdone_test_password 'RETURN 1'"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 7687:7687
- 7474:7474
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Build MCP server
run: npm run build --workspace=@graphdone/mcp-server
- name: Run MCP server unit tests
run: npm run test --workspace=@graphdone/mcp-server
env:
NEO4J_URI: bolt://localhost:7687
NEO4J_USER: neo4j
NEO4J_PASSWORD: graphdone_test_password
- name: Run MCP server with health check
run: |
# Start MCP server in background
npm run start --workspace=@graphdone/mcp-server &
MCP_PID=$!
# Wait for server to start
sleep 10
# Test health endpoint
curl -f http://localhost:3128/health || (echo "Health check failed" && exit 1)
# Test status endpoint
curl -f http://localhost:3128/status || (echo "Status check failed" && exit 1)
# Verify capabilities count (should be 29 - 22 original + 7 graph management)
CAPABILITIES_COUNT=$(curl -s http://localhost:3128/health | jq '.capabilities | length')
if [ "$CAPABILITIES_COUNT" -ne 29 ]; then
echo "Expected 29 capabilities, got $CAPABILITIES_COUNT"
exit 1
fi
# Clean up
kill $MCP_PID || true
env:
NEO4J_URI: bolt://localhost:7687
NEO4J_USER: neo4j
NEO4J_PASSWORD: graphdone_test_password
- name: Test garbage input resilience
run: |
# Run specific garbage input tests
npm run test --workspace=@graphdone/mcp-server -- garbage-input.test.ts
env:
NEO4J_URI: bolt://localhost:7687
NEO4J_USER: neo4j
NEO4J_PASSWORD: graphdone_test_password
- name: Run mock validation tests
run: |
# Run mock vs real database comparison tests
npm run test --workspace=@graphdone/mcp-server -- mock-validation.test.ts
env:
NEO4J_URI: bolt://localhost:7687
NEO4J_USER: neo4j
NEO4J_PASSWORD: graphdone_test_password
- name: Upload MCP test coverage
uses: codecov/codecov-action@v3
with:
directory: ./packages/mcp-server/coverage
flags: mcp-server
fail_ci_if_error: false
build:
name: Build
runs-on: ubuntu-latest
needs: [lint-and-typecheck, test, mcp-server-test]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Build packages
run: npm run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
packages/*/dist
!packages/*/dist/**/*.map
retention-days: 7
docker-build:
name: Docker Build
runs-on: ubuntu-latest
needs: [lint-and-typecheck, test, mcp-server-test]
if: github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker images
run: |
docker build -f packages/server/Dockerfile -t graphdone-server .
docker build -f packages/web/Dockerfile -t graphdone-web .
- name: Test Docker containers
run: |
# Start containers for testing
docker-compose -f docker-compose.yml up -d
sleep 30
# Basic health checks
curl -f http://localhost:4000/health || exit 1
curl -f http://localhost:3000 || exit 1
# Cleanup
docker-compose down
security-scan:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Run npm audit
run: npm audit --audit-level=high
- name: Run Snyk security scan
uses: snyk/actions/node@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high