-
Notifications
You must be signed in to change notification settings - Fork 4
193 lines (158 loc) · 5.06 KB
/
ci.yml
File metadata and controls
193 lines (158 loc) · 5.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: Build & Test (Windows)
runs-on: windows-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build TypeScript
run: npm run build
- name: Verify dist files exist
run: |
node -e "
const fs = require('fs');
const files = ['dist/cli.js', 'dist/mcp-server.js', 'dist/memoryStore.js', 'dist/deepseek.js'];
for (const f of files) {
if (!fs.existsSync(f)) {
console.error('Missing:', f);
process.exit(1);
}
console.log('Found:', f);
}
"
- name: Smoke test - CLI help
run: |
echo "help" | node dist/cli.js
env:
MEMORY_PATH: test-memory.json
- name: Smoke test - CLI add and search
run: |
node -e "
const { execSync } = require('child_process');
const opts = { encoding: 'utf8', env: { ...process.env, MEMORY_PATH: 'test-memory.json' } };
// Add a memory
const add = execSync('echo add --tags test,ci Test memory from CI | node dist/cli.js', opts);
console.log('Add result:', add);
// Search for it
const search = execSync('echo search test | node dist/cli.js', opts);
console.log('Search result:', search);
if (!search.includes('Test memory')) {
console.error('Search did not find the added memory');
process.exit(1);
}
console.log('CLI smoke tests passed');
"
- name: Smoke test - MCP server initialization
run: |
node -e "
const { spawn } = require('child_process');
const server = spawn('node', ['dist/mcp-server.js'], {
env: { ...process.env, MEMORY_PATH: 'test-memory.json' },
stdio: ['pipe', 'pipe', 'pipe']
});
let stdout = '';
let stderr = '';
server.stdout.on('data', (d) => stdout += d);
server.stderr.on('data', (d) => stderr += d);
const initRequest = JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'initialize',
params: {
protocolVersion: '2024-11-05',
capabilities: {},
clientInfo: { name: 'ci-test', version: '1.0.0' }
}
}) + '\n\n';
server.stdin.write(initRequest);
const timeout = setTimeout(() => {
console.error('Timed out waiting for MCP server response');
process.exit(1);
}, 5000);
server.stdout.on('data', () => {
clearTimeout(timeout);
console.log('stdout:', stdout);
console.log('stderr:', stderr);
process.exit(0);
});
server.stderr.on('data', () => {
clearTimeout(timeout);
console.log('stdout:', stdout);
console.log('stderr:', stderr);
process.exit(0);
});
"
shell: pwsh
- name: Cleanup test files
if: always()
run: |
node -e "
const fs = require('fs');
['test-memory.json', 'test-memory.json.lock'].forEach(f => {
if (fs.existsSync(f)) fs.unlinkSync(f);
});
"
typecheck:
name: Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run TypeScript compiler (strict)
run: npx tsc --noEmit
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run npm audit
run: npm audit --audit-level=moderate
- name: Check for known vulnerabilities
uses: actions/dependency-review-action@v4
if: github.event_name == 'pull_request'