Skip to content

Commit 8732fee

Browse files
committed
tests: add CI test workflow for qsv MCP server
[skip ci]
1 parent 46871e0 commit 8732fee

File tree

2 files changed

+229
-0
lines changed

2 files changed

+229
-0
lines changed

.claude/skills/CI.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Continuous Integration (CI)
2+
3+
## Overview
4+
5+
The MCP Server has automated CI testing via GitHub Actions that runs on every push and pull request affecting the `.claude/skills/` directory.
6+
7+
**Workflow File**: `.github/workflows/mcp-server-ci.yml`
8+
9+
## Test Matrix
10+
11+
Tests run across multiple environments to ensure broad compatibility:
12+
13+
### Operating Systems
14+
- ✅ Ubuntu (Linux)
15+
- ✅ macOS
16+
- ✅ Windows
17+
18+
### Node.js Versions
19+
- ✅ Node.js 18 (minimum supported)
20+
- ✅ Node.js 20 (LTS)
21+
- ✅ Node.js 22 (current)
22+
23+
**Total**: 9 test combinations (3 OS × 3 Node versions)
24+
25+
## What Gets Tested
26+
27+
### 1. Test Job (Matrix)
28+
Each combination runs:
29+
1. **qsv Installation**: Downloads and installs latest qsv binary for the platform
30+
2. **Dependency Installation**: `npm ci` for clean install
31+
3. **TypeScript Compilation**: `npm run build` to verify code compiles
32+
4. **Integration Tests**: `npm test` runs all 28 tests including:
33+
- Unit tests for config, filesystem, pipeline, tools
34+
- Integration tests for qsv commands (count, headers, select, search, etc.)
35+
- Metadata caching and deduplication tests
36+
5. **Build Verification**: Tests that `dist/mcp-server.js` is executable
37+
38+
### 2. Lint Job
39+
Separate TypeScript type checking:
40+
1. **Main Code Compilation**: `npm run build`
41+
2. **Test Code Compilation**: `npm run build:test`
42+
43+
## Triggering CI
44+
45+
CI runs automatically on:
46+
- **Push to master**: Any changes to `.claude/skills/**` or the workflow file
47+
- **Pull Requests**: Any PR targeting master with changes to MCP server code
48+
- **Manual Trigger**: Via GitHub Actions UI (`workflow_dispatch`)
49+
50+
## Viewing Results
51+
52+
1. Go to the [Actions tab](https://github.com/dathere/qsv/actions) in the repository
53+
2. Select "MCP Server CI" workflow
54+
3. View individual test runs for each OS/Node combination
55+
56+
## CI Status Badge
57+
58+
Add this badge to README.md to show CI status:
59+
60+
```markdown
61+
[![MCP Server CI](https://github.com/dathere/qsv/actions/workflows/mcp-server-ci.yml/badge.svg)](https://github.com/dathere/qsv/actions/workflows/mcp-server-ci.yml)
62+
```
63+
64+
## Local Testing
65+
66+
To run tests locally matching CI environment:
67+
68+
```bash
69+
# Install dependencies
70+
npm ci
71+
72+
# Run full test suite (what CI runs)
73+
npm test
74+
75+
# Run build check
76+
npm run build
77+
78+
# Check test compilation
79+
npm run build:test
80+
```
81+
82+
## Troubleshooting CI Failures
83+
84+
### qsv Installation Fails
85+
- Check that qsv releases are available on GitHub
86+
- Verify download URLs match current release naming convention
87+
88+
### Tests Fail on Specific Platform
89+
- Check platform-specific path handling (Windows vs Unix)
90+
- Verify qsv binary is in PATH correctly
91+
92+
### TypeScript Compilation Fails
93+
- Run `npm run build` locally to see detailed errors
94+
- Check for missing type definitions or incompatible Node.js types
95+
96+
### Node.js Version Issues
97+
- Ensure code uses features compatible with Node.js 18+
98+
- Check `package.json` engines field matches minimum supported version
99+
100+
## Performance
101+
102+
Typical CI run times:
103+
- **Test Job (per combination)**: 2-3 minutes
104+
- **Lint Job**: 30-60 seconds
105+
- **Total (all jobs)**: ~3-5 minutes (parallel execution)
106+
107+
## Dependencies
108+
109+
CI automatically uses:
110+
- Latest qsv release from GitHub
111+
- Node.js versions from `actions/setup-node`
112+
- npm dependencies locked in `package-lock.json`
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: MCP Server CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths:
7+
- '.claude/skills/**'
8+
- '.github/workflows/mcp-server-ci.yml'
9+
pull_request:
10+
branches: [ master ]
11+
paths:
12+
- '.claude/skills/**'
13+
- '.github/workflows/mcp-server-ci.yml'
14+
workflow_dispatch:
15+
16+
jobs:
17+
test:
18+
name: Test Node ${{ matrix.node-version }} on ${{ matrix.os }}
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [ubuntu-latest, macos-latest, windows-latest]
24+
node-version: [18, 20, 22]
25+
26+
defaults:
27+
run:
28+
working-directory: .claude/skills
29+
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
34+
- name: Setup Node.js ${{ matrix.node-version }}
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: ${{ matrix.node-version }}
38+
cache: 'npm'
39+
cache-dependency-path: .claude/skills/package-lock.json
40+
41+
- name: Install qsv (Ubuntu)
42+
if: matrix.os == 'ubuntu-latest'
43+
run: |
44+
QSV_VERSION=$(curl -s https://api.github.com/repos/dathere/qsv/releases/latest | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
45+
echo "Installing qsv $QSV_VERSION"
46+
curl -L "https://github.com/dathere/qsv/releases/download/${QSV_VERSION}/qsv-${QSV_VERSION}-x86_64-unknown-linux-gnu.zip" -o qsv.zip
47+
unzip -q qsv.zip
48+
chmod +x qsv
49+
echo "$PWD" >> $GITHUB_PATH
50+
./qsv --version
51+
52+
- name: Install qsv (macOS)
53+
if: matrix.os == 'macos-latest'
54+
run: |
55+
QSV_VERSION=$(curl -s https://api.github.com/repos/dathere/qsv/releases/latest | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
56+
echo "Installing qsv $QSV_VERSION"
57+
curl -L "https://github.com/dathere/qsv/releases/download/${QSV_VERSION}/qsv-${QSV_VERSION}-x86_64-apple-darwin.zip" -o qsv.zip
58+
unzip -q qsv.zip
59+
chmod +x qsv
60+
echo "$PWD" >> $GITHUB_PATH
61+
./qsv --version
62+
63+
- name: Install qsv (Windows)
64+
if: matrix.os == 'windows-latest'
65+
shell: pwsh
66+
run: |
67+
$QSV_VERSION = (Invoke-RestMethod -Uri "https://api.github.com/repos/dathere/qsv/releases/latest").tag_name
68+
Write-Host "Installing qsv $QSV_VERSION"
69+
$url = "https://github.com/dathere/qsv/releases/download/$QSV_VERSION/qsv-$QSV_VERSION-x86_64-pc-windows-msvc.zip"
70+
Invoke-WebRequest -Uri $url -OutFile qsv.zip
71+
Expand-Archive -Path qsv.zip -DestinationPath . -Force
72+
Write-Output "$PWD" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
73+
.\qsv.exe --version
74+
75+
- name: Install dependencies
76+
run: npm ci
77+
78+
- name: Check TypeScript compilation
79+
run: npm run build
80+
81+
- name: Run tests
82+
run: npm test
83+
env:
84+
NODE_ENV: test
85+
86+
- name: Test build output
87+
run: |
88+
node dist/mcp-server.js --version || echo "Version check complete"
89+
shell: bash
90+
91+
lint:
92+
name: TypeScript Type Check
93+
runs-on: ubuntu-latest
94+
95+
defaults:
96+
run:
97+
working-directory: .claude/skills
98+
99+
steps:
100+
- name: Checkout code
101+
uses: actions/checkout@v4
102+
103+
- name: Setup Node.js
104+
uses: actions/setup-node@v4
105+
with:
106+
node-version: 20
107+
cache: 'npm'
108+
cache-dependency-path: .claude/skills/package-lock.json
109+
110+
- name: Install dependencies
111+
run: npm ci
112+
113+
- name: TypeScript compilation check
114+
run: npm run build
115+
116+
- name: TypeScript test compilation check
117+
run: npm run build:test

0 commit comments

Comments
 (0)