forked from uscensusbureau/us-census-bureau-data-api-mcp
-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (83 loc) · 2.66 KB
/
Copy pathtest.yml
File metadata and controls
94 lines (83 loc) · 2.66 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
name: MCP Server - Tests
on:
push:
branches: ['main']
paths:
- 'mcp-server/**'
- '.github/workflows/test.yml'
pull_request:
types:
- opened
- reopened
- synchronize
- closed
workflow_dispatch:
jobs:
test:
name: Unit & Integration Tests
runs-on: ubuntu-latest
environment: test
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: mcp_db_test
POSTGRES_USER: mcp_user_test
POSTGRES_PASSWORD: mcp_pass_test
ports:
- 5434:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
# Set up database (run migrations)
- name: Install database dependencies
working-directory: ./mcp-db
run: npm ci
- name: Run database migrations
working-directory: ./mcp-db
env:
DATABASE_URL: postgresql://mcp_user_test:mcp_pass_test@localhost:5434/mcp_db_test
run: npm run migrate:up
# Test MCP server
- name: Install MCP server dependencies
working-directory: ./mcp-server
run: npm ci
- name: Run MCP server tests
working-directory: ./mcp-server
env:
CENSUS_API_KEY: ${{ secrets.CENSUS_API_KEY }}
NODE_ENV: test
POSTGRES_HOST: localhost
POSTGRES_PORT: 5434
POSTGRES_DB: mcp_db_test
POSTGRES_USER: mcp_user_test
POSTGRES_PASSWORD: mcp_pass_test
run: npm run test -- --reporter=verbose --coverage.enabled true
- name: Report Coverage
if: always()
uses: davelosert/vitest-coverage-report-action@v2
continue-on-error: true
with:
working-directory: ./mcp-server
- name: Publish Results Badge
uses: wjervis7/vitest-badge-action@v1.0.0
if: success() || failure() # run whether steps succeed or not
continue-on-error: true
with:
summary-path: ./mcp-server/coverage/coverage-summary.json
vitest-config-path: ./mcp-server/vitest.config.ts
result-type: lines
gist-token: ${{ secrets.MCP_GIST_BADGE_TOKEN }}
gist-url: https://gist.github.com/luke-keller-census/0589e2c69696f077eef7d6af818a108b
upload-badge: ${{ github.ref == 'refs/heads/main' }}
badge-text: "MCP Server Coverage"
badge-fail-color: D73A49,CB2431
badge-pass-color: 34D058,28A745