-
Notifications
You must be signed in to change notification settings - Fork 474
124 lines (102 loc) · 3.6 KB
/
build.yml
File metadata and controls
124 lines (102 loc) · 3.6 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
name: Build MCP Server
on:
push:
branches:
- main
pull_request:
branches:
- "main"
permissions:
contents: read
jobs:
build:
name: Build the project
runs-on: windows-latest
steps:
- uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Remove .npmrc - uses standard registry for internal build check - non-release version
run: |
if (Test-Path .npmrc) {
Remove-Item .npmrc
}
shell: pwsh
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
- name: Clean install dependencies
run: npm ci
- name: Build the project
run: npm run build
- name: Validate tool names and parameters
run: npm run validate-tools
- name: Run tests
run: npm test
- name: Display coverage summary
run: |
Write-Host "=== Code Coverage Summary ==="
if (Test-Path "coverage/lcov-report/index.html") {
Write-Host "Coverage report generated successfully"
if (Test-Path "coverage/coverage-summary.json") {
$coverage = Get-Content "coverage/coverage-summary.json" | ConvertFrom-Json
$total = $coverage.total
Write-Host "Lines: $($total.lines.pct)%"
Write-Host "Functions: $($total.functions.pct)%"
Write-Host "Branches: $($total.branches.pct)%"
Write-Host "Statements: $($total.statements.pct)%"
}
}
shell: pwsh
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage/lcov.info
flags: unittests
name: azure-devops-mcp-coverage
fail_ci_if_error: false
- name: Validate server startup via npx
shell: pwsh
run: |
$result = & npx mcp-server-azuredevops 2>&1 | Out-String
if ($result -notmatch "Usage: mcp-server-azuredevops <organization>") {
Write-Host "Expected usage message not found in output:"
Write-Host $result
exit 1
}
Write-Host "Validation passed."
exit 0
static-code-analysis:
name: Static code analysis
runs-on: windows-latest
steps:
- uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
- name: Clean install dependencies
run: npm ci
- name: Static code analysis
run: npm run eslint
- name: Check code formatting
run: npm run format-check
- name: Verify package version is synced
run: |
git diff --exit-code ./src/version.ts
if (!$?) {
Write-Host "Version mismatch detected. Please ensure that the version information in version.ts is up to date with package.json."
exit 1
}
git diff --exit-code ./package-lock.json
if (!$?) {
Write-Host "Please run 'npm install' to update package-lock.json and add changes to the commit."
exit 1
}